For completeness: - name: configure supervisor copy: src=supervisord.conf dest=/etc/supervisor/supervisord.conf notify: restart supervisor
- name: configure supervisor defaults copy: src=supervisor.default dest=/etc/default/supervisor notify: restart supervisor - name: copy over file copy: src=im_supervisor dest=/usr/local/bin/im_supervisor mode=0700 notify: restart supervisor - meta: flush_handlers # only if you want to do this now and not at the end of the play In your handlers file: - name: restart supervisor shell: ... There are also supervisor modules in ansible that you can use, or the service module. On Tue, Sep 9, 2014 at 3:18 PM, Scott Sturdivant <[email protected] > wrote: > You want "when: restart_supervisor|changed". See: > http://docs.ansible.com/playbooks_variables.html#filters-often-used-with-conditionals > > However, by registering the variable each time, you're not going to get > the behavior you're after. If the first task changes, but the second two > do not, I don't believe that you'll restart supervisor. Instead, look into > handlers: > http://docs.ansible.com/playbooks_intro.html#handlers-running-operations-on-change > > On Tue, Sep 9, 2014 at 12:35 PM, Mark Olliver < > [email protected]> wrote: > >> Hi, >> >> I am getting the following error one the second run of my play book but i >> am not sure why or what I should be doing to correct it. >> >> fatal: [idb-13] => error while evaluating conditional: {u'changed': >> False, u'group': u'root', u'uid': 0, 'dest': >> u'/usr/local/bin/im_supervisor', 'md5sum': >> 'a5d74c539224f1c7a3dfdf091af13c64', u'owner': u'root', u'state': u'file', >> u'gid': 0, u'mode': u'0700', 'invocation': {'module_name': u'copy', >> 'module_args': u'src=im_supervisor dest=/usr/local/bin/im_supervisor >> mode=0700'}, u'path': u'/usr/local/bin/im_supervisor', u'size': 239} >> >> >> Here is the relevant part of the common/tasks/main.yml >> - name: configure supervisor >> copy: src=supervisord.conf dest=/etc/supervisor/supervisord.conf >> register: restart_supervisor >> >> - name: configure supervisor default >> copy: src=supervisor.default dest=/etc/default/supervisor >> register: restart_supervisor >> >> - copy: src=im_supervisor dest=/usr/local/bin/im_supervisor mode=0700 >> register: restart_supervisor >> >> - shell: /usr/local/bin/im_supervisor restart; >> when: restart_supervisor >> >> Thanks >> >> Mark >> >> >> -- >> MARK OLLIVERHEAD OF IT OPERATIONS >> T. +44(0) 20 7775 5628 [image: Infectious Media]3-7 Herbal Hill / >> London / EC1R 5EJwww.infectiousmedia.com [image: Infectious Media] >> <http://www.infectiousmedia.com/> [image: Facebook] >> <http://www.facebook.com/infectiousmedia>[image: Twitter] >> <https://twitter.com/infectiousmedia>[image: LinkedIn] >> <http://www.linkedin.com/company/infectious-media-ltd>[image: Youtube] >> <http://www.youtube.com/user/InfectiousMediaLtd> This email and any >> attachments are confidential and may also beprivileged. If you are not >> the intended recipient, please notify the senderimmediately, and do not >> disclose the contents to another person, use it forany purpose, or >> store, or copy the information in any medium. Please alsodestroy and >> delete the message from your computer. >> >> -- >> 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/CALKPxXi1BrFU-AZnEsnBVifLjpJL_VjYuKmhdPk-nwwD3OJHmw%40mail.gmail.com >> <https://groups.google.com/d/msgid/ansible-project/CALKPxXi1BrFU-AZnEsnBVifLjpJL_VjYuKmhdPk-nwwD3OJHmw%40mail.gmail.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/CAPcsqx%3DZp%2Br3WAET4oXiyKC_SBVM04%3DmO8wDXr%3DezKBBwBcyPw%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CAPcsqx%3DZp%2Br3WAET4oXiyKC_SBVM04%3DmO8wDXr%3DezKBBwBcyPw%40mail.gmail.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%2BnsWgx4cDquVvAKwWt5MR8hGNzGZcaX5yEmZikrR65Qahvkdg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
