"What am I doing wrong?" Not running this step as root.
Consider "remote_user: root" in your playbook for this step, as you can't run it as user "raven". Also, sudo'ing from raven to raven is a little strange, I think you probably want to just not set sudo_user, then it would assume "raven" is sudoing to "root". On Thu, Jul 24, 2014 at 12:58 PM, Thomas Hudson <[email protected]> wrote: > 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 > <https://groups.google.com/d/msgid/ansible-project/4838c027-00f8-475f-8214-15721b1ac526%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CA%2BnsWgzLfFhd-paAarh%3DT6cnm%3DcELjLzuN10L0kZPP4kp8AV6w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
