I have the following playbook
---
- name: myPlaybook
hosts: "{{machine_to_setup}}"
remote_user: "{{user_to_use}}"
become: yes
roles:
# Install Gosa - part 1
- { role: gosa, become: yes }
(I know become is duplicated.
With the following role content:
---
# Requires Ansible version 2.1 onwards
# Installing the yum EPEL repository
- name: Download rpm Package for EPEL
get_url:
url: https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
dest: /tmp/epel.rpm
mode: 0777
force: true
- name: Install EPEL Package
yum:
name: /tmp/epel.rpm
state: present
And I am running the command from ansible tower on ansible 2.1 using the following parameters:
machine_to_setup: 192.168.20.4
user_to_use: sshUser
Yet during the Install EPEL Package stage I get the following error:
fatal: [192.168.20.4]: FAILED! => {"changed": true, "failed": true, "invocation": {"module_args": {"conf_file": null, "disable_gpg_check": false, "disablerepo": null, "enablerepo": null, "exclude": null, "install_repoquery": true, "list": null, "name": ["/tmp/epel.rpm"], "state": "present", "update_cache": false, "validate_certs": true}, "module_name": "yum"}, "msg": "You need to be root to perform this command.\n", "rc": 1, "results": ["Loaded plugins: fastestmirror\n"]}
Which is mainly : "You need to be root to perform this command"
So why is ansible not becoming a super user even though I am clearly telling it to.