ansible-handlers

Ansible not detecting Role default variables in its handler

浪子不回头ぞ 提交于 2019-12-20 02:11:03
问题 Does ansible pass Role Default variables to the Handlers within the same Role? Here's a minimal excerpt of the playbook that has the issue: Role hierarchy - playbook.yml - roles/ - gunicorn/ - defaults/ - main.yml - handlers/ - main.yml - code-checkout/ - tasks/ - main.yml Here's the file contents gunicorn/defaults/main.yml --- gu_log: "/tmp/gunicorn.log" gunicorn/handlers/main.yml --- - name: Clear Gunicorn Log shell: rm {{ gu_log }} finalize/tasks/main.yml --- - name: Test Handlers shell:

How to force handler to run before executing a task in Ansible?

ぐ巨炮叔叔 提交于 2019-12-18 11:05:43
问题 I have a playbook which should configure on specified IP, and than connect to this app to configure stuff inside. I've got a problem: I need to restart app after I've changed anything in app config, and if I do not restart app, connection to it failed (no connection because app knows nothing about new config with new IP address I'm trying to access). My current playbook: tasks: - name: Configure app template: src=app.conf.j2 dest=/etc/app.conf notify: restart app - name: Change data in app

Ansible not detecting Role default variables in its handler

假装没事ソ 提交于 2019-12-01 23:26:38
Does ansible pass Role Default variables to the Handlers within the same Role? Here's a minimal excerpt of the playbook that has the issue: Role hierarchy - playbook.yml - roles/ - gunicorn/ - defaults/ - main.yml - handlers/ - main.yml - code-checkout/ - tasks/ - main.yml Here's the file contents gunicorn/defaults/main.yml --- gu_log: "/tmp/gunicorn.log" gunicorn/handlers/main.yml --- - name: Clear Gunicorn Log shell: rm {{ gu_log }} finalize/tasks/main.yml --- - name: Test Handlers shell: ls notify: - Restart Gunicorn playbook.yml --- - name: Deploy hosts: webservers tasks: - include: roles

How to force handler to run before executing a task in Ansible?

依然范特西╮ 提交于 2019-11-28 06:10:31
I have a playbook which should configure on specified IP, and than connect to this app to configure stuff inside. I've got a problem: I need to restart app after I've changed anything in app config, and if I do not restart app, connection to it failed (no connection because app knows nothing about new config with new IP address I'm trying to access). My current playbook: tasks: - name: Configure app template: src=app.conf.j2 dest=/etc/app.conf notify: restart app - name: Change data in app configure_app: host={{new_ip}} data={{data}} handlers: - name: restart app service: name=app state