I'm getting this error with the following playbook:

---
# file: deploy.yml
# usage: ansible-playbook deploy.yml --inventory-file <hosts-file> 
--extra-vars "service_name=<service-name> rpm_src_url=<rpm URL>" 
# extra-vars:
#       service_name    - name of the RPM service e.g. medio-spitback
#       rpm_src_url     - URL where RPM to install can be downloaded
- hosts: webservers
  remote_user: raven
  gather_facts: false
  sudo: yes
  sudo_user: raven
  vars:
    rpm_dest: "/tmp/{{ service_name }}.rpm"
  tasks:
  - name: download RPM to host
    get_url: url="{{ rpm_src_url }}" dest="{{ rpm_dest }}" force=yes
  - name: yum uninstall service if needed
    yum: name="{{ service_name }}" state=absent
  - name: yum install RPM
    yum: name="{{ rpm_dest }}" state=present
  - name: ensure service is running
    service: name="{{ service_name }}" state=started
  - name: Delete uploaded RPM
    file: dest="{{ rpm_dest }}" state=absent


The full logging:

TASK: [yum uninstall service if needed] 
***************************************
<dla19-sea.hq.msrch> ESTABLISH CONNECTION FOR USER: raven on PORT 22 TO 
dla19-sea.hq.msrch
<dla19-sea.hq.msrch> REMOTE_MODULE yum name="medio-spitback" state=absent
<dla19-sea.hq.msrch> EXEC /bin/sh -c 'mkdir -p 
/tmp/ansible-tmp-1406220230.33-96765765740082 && chmod a+rx 
/tmp/ansible-tmp-1406220230.33-96765765740082 && echo 
/tmp/ansible-tmp-1406220230.33-96765765740082'
<dla19-sea.hq.msrch> PUT /tmp/tmpq7NAYC TO 
/tmp/ansible-tmp-1406220230.33-96765765740082/yum
<dla19-sea.hq.msrch> EXEC /bin/sh -c 'chmod a+r 
/tmp/ansible-tmp-1406220230.33-96765765740082/yum'
<dla19-sea.hq.msrch> EXEC /bin/sh -c 'LC_CTYPE=en_US.UTF-8 LANG=en_US.UTF-8 
/usr/bin/python -tt /tmp/ansible-tmp-1406220230.33-96765765740082/yum'
<dla19-sea.hq.msrch> EXEC /bin/sh -c 'rm -rf 
/tmp/ansible-tmp-1406220230.33-96765765740082/ >/dev/null 2>&1'
failed: [dla19-sea.hq.msrch] => {"changed": false, "failed": true, "rc": 1, 
"results": ["Loaded plugins: fastestmirror\n"]}
msg: You need to be root to perform this command.

What am I doing wrong?

TIA
Tomy

-- 
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/4838c027-00f8-475f-8214-15721b1ac526%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to