Hi, I have problem with my role in ansible. Everything works fine until task
call handler. If I changed configuration file (template) only for a single
instance of apache, all instances are restarted. How can I force ansible to
restart just that instance, the configuration of which I made the change?
Group_vars:
apache:
- instance: apache1
httpd_conf: http_apache1.j2
etc...
- instance: apache2
httpd_conf: http_apache2.j2
etc...
Task:
- name: Apache Configuration
template: src={{ item.httpd_conf }} dest=/{{ item.instance
}}/apache/conf/httpd.conf
with_items: apache
notify: Restart Apache
Handler:
- name: Restart Apache
service: name={{ item.instance }} state=restarted
with_items: apache
TASK: | Apache Configuration] *****************************
*changed:* [host] => (item=({ 'instance': 'apache1', 'httpd_conf':
'http_apache1.j2'}))
ok: [host] => (item=({ 'instance': 'apache2', 'httpd_conf':
'http_apache2.j2'}))
NOTIFIED: | Restart Apache] ***************************************
*changed*: [host] => (item=({ 'instance': 'apache1', 'httpd_conf':
'http_apache1.j2'}))
*changed:* [host] => (item=({ 'instance': 'apache2', 'httpd_conf':
'http_apache2.j2'}))
Thanks in advance for your help.
--
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/e11d93a4-0c52-4129-b620-f10a34c68279%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.