Ansible roles change workflow order by moving handlers.

0 votes
I want to change postgresql configuration file, restart service and then add db user. But the problem is my workflow does the same in a different order. Can I change it to the order I want bu moving the handlers?
Mar 12, 2019 in Ansible by Vijay
76 views

1 answer to this question.

0 votes

Flush handlers with meta: flush_handlers before the task that requires it:

- name: change postgre pg_hba.conf
  template: src=pg_hba.conf.j2 dest=/etc/postgresql/9.4/main/pg_hba.conf 
  notify: restart postgresql service
  tags: pg_hba

- meta: flush_handlers

- name: set password for postgres
  postgresql_user:
    db: postgres
    user: postgres
    password: postgres
answered Mar 12, 2019 by William

Related Questions In Ansible

+1 vote
2 answers

What is the difference between ansible playbook and roles?

Hi, Roles: Roles containing certain vars_files, tasks, and handlers ...READ MORE

answered Jan 21 in Ansible by vivek
• 510 points
2,620 views
0 votes
1 answer

Filter lists by attributes - Ansible

Filter the dicts using selectattr_filter in combination with ...READ MORE

answered Jan 14, 2019 in Ansible by Haider
158 views
0 votes
1 answer

Ansible playbook for moving files from one node to another remote node

The best way to do this is: copy ...READ MORE

answered Jan 16, 2019 in Ansible by Nigya

edited Jan 18, 2019 by Vardhan 2,031 views
0 votes
1 answer

Virtualization Infrastructure supported by Ansible

Yes, Vagrant supports Ansible, in-fact Ansible is ...READ MORE

answered Jan 25, 2019 in Ansible by Sai
42 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,400 points
368 views
0 votes
1 answer
0 votes
1 answer

Install multiple roles - Ansible

You'll need a requirements.yaml file which will ...READ MORE

answered Jan 9, 2019 in Ansible by Rishi
553 views
0 votes
1 answer

Install ansible galaxy roles

Here is a very basic example that ...READ MORE

answered Jan 9, 2019 in Ansible by Disha
90 views