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
644 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, 2020 in Ansible by vivek
• 530 points
21,021 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
1,399 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 9,257 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
560 views
+15 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,503 views
+2 votes
1 answer
0 votes
1 answer

Install multiple roles - Ansible

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

answered Jan 10, 2019 in Ansible by Rishi
1,868 views
0 votes
1 answer

Install ansible galaxy roles

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

answered Jan 10, 2019 in Ansible by Disha
524 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP