# issues with task not working

**URL:** <https://forum.ansible.com/t/issues-with-task-not-working/25341>\
**Category:** Ansible Project\
**Created:** [August 27, 2017, 2:50am UTC](https://forum.ansible.com/t/issues-with-task-not-working/25341 "2017-08-27T02:50:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frank\_Dias](https://avatars.discourse-cdn.com/v4/letter/f/eada6e/32.png) [@Frank\_Dias](https://forum.ansible.com/u/Frank_Dias)\
**Post date:** [August 27, 2017, 2:50am UTC](https://forum.ansible.com/t/issues-with-task-not-working/25341/1 "2017-08-27T02:50:42Z")

</div>

why does this not work?

this is my play;

- name: install PG HA  
hosts: dbs6  
gather\_facts: True  
any\_errors\_fatal: True  
vars:  
postgres\_ha\_cluster\_master\_host: [dbs03.prodea-int.net](http://dbs03.prodea-int.net)  
postgres\_ha\_cluster\_vip: 172.24.2.241  
postgres\_ha\_pg\_repl\_pass: Pr0d3aDdbsRep  
postgres\_ha\_cluster\_ha\_password: Pr0d3aOps  
postgres\_ha\_cluster\_ha\_password\_hash: ‘$6$random\_salt$oOZNTHqP.FhvKCx80X61rfbB3evBPVlnGYxcjJi82gNSLbJY3hNaMipUpNdVBGnFz1uy1UuwWZ0Mcmq/j04c2.’  
pre\_tasks:
- name: disable firewall  
service: name=iptables state=stopped enabled=no  
roles:
- postgres-ha6

in the role I have several task that i want performed on specific host and that host is define as variable

- name: init DB dir on master if necessary  
shell: ‘{{ postgres\_ha\_pg\_bindir }}/pg\_ctl initdb’  
become: yes  
become\_user: postgres  
args:  
creates: “{{ postgres\_ha\_pg\_data }}/PG\_VERSION”  
when: inventory\_hostname == postgres\_ha\_cluster\_master\_host

# run only on one node

---

<div class="post-metadata">

**Author:** ![benno\_joy](https://avatars.discourse-cdn.com/v4/letter/b/73ab20/32.png) [@benno\_joy](https://forum.ansible.com/u/benno_joy)\
**Post date:** [August 27, 2017, 8:11am UTC](https://forum.ansible.com/t/issues-with-task-not-working/25341/2 "2017-08-27T08:11:49Z")

</div>

would be helpful if you could run the playbook in verbose "-vvv" and  
paste an output so we know what is not working and why it is not  
working.

---

<div class="post-metadata">

**Author:** ![Frank\_Dias](https://avatars.discourse-cdn.com/v4/letter/f/eada6e/32.png) [@Frank\_Dias](https://forum.ansible.com/u/Frank_Dias)\
**Post date:** [August 27, 2017, 9:03pm UTC](https://forum.ansible.com/t/issues-with-task-not-working/25341/3 "2017-08-27T21:03:19Z")

</div>

I am work with

[https://github.com/YanChii/ansible-role-postgres-ha](https://github.com/YanChii/ansible-role-postgres-ha)

if I use centos 7 minimal install, it works mostly a few bugs.

but if I try with centos6 minimal install , need to add libselinux-python to installation.  
i am stuck with failures in the task [postgresql\_sync.yml](https://github.com/YanChii/ansible-role-postgres-ha/blob/master/tasks/postgresql_sync.yml) , from what I am seeing it installs the pkgs but does not execute task on host declared in postgres\_ha\_cluster\_master\_host variable.

I would not think that there would be this much behavioral change in the role between OS version.

currently our env is centos6 and plans are not set for when to go to centos7 as of yet
