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.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a9357f0f-95f0-4085-a1f4-8c3aebb5c625%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to