# service fails to notice postgresql has started on FreeBSD

**URL:** <https://forum.ansible.com/t/service-fails-to-notice-postgresql-has-started-on-freebsd/14239>\
**Category:** Ansible Project\
**Created:** [December 30, 2013, 9:16pm UTC](https://forum.ansible.com/t/service-fails-to-notice-postgresql-has-started-on-freebsd/14239 "2013-12-30T21:16:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dan\_Langille](https://avatars.discourse-cdn.com/v4/letter/d/41988e/32.png) [@Dan\_Langille](https://forum.ansible.com/u/Dan_Langille)\
**Post date:** [December 30, 2013, 9:16pm UTC](https://forum.ansible.com/t/service-fails-to-notice-postgresql-has-started-on-freebsd/14239/1 "2013-12-30T21:16:26Z")

</div>

I have this in a playbook:

- name: start  
service: name=postgresql enabled=yes state=started  
tags: postgresql-server

When I run it I see:

# ansible-playbook jail-postgresql.yml --tags=postgresql-server

PLAY [jail\_postgresql] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

GATHERING FACTS \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [zuul\_postgresql]

TASK: [postgresql-server | install postgresql-server] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [zuul\_postgresql]

TASK: [postgresql-server | run initdb] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
skipping: [zuul\_postgresql]

TASK: [postgresql-server | start] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

And there it stops… and waits.

Looking on the client in question, I see output from ps:

root 63256 0.0 0.0 14536 2160 1 I+J 9:09PM 0:00.00 /bin/sh -c echo SUDO-SUCCESS-nqdtbpiymcuiebgpkzzhuwufzhpwgvxr; /usr/local/bin/python /usr/home/dan/.ansible/tmp/ansible-1388437795.93-17849266519  
root 63257 0.0 0.2 75560 13360 1 I+J 9:09PM 0:00.05 /usr/local/bin/python /usr/home/dan/.ansible/tmp/ansible-1388437795.93-178492665191228/service /usr/home/dan/.ansible/tmp/ansible-1388437795.9

I have confirmed that the server has started:

# ps auwx | grep pgsql

pgsql 63288 0.0 0.2 179900 19736 ?? IsJ 9:09PM 0:00.00 postgres: checkpointer process (postgres)  
pgsql 63289 0.0 0.2 179900 19736 ?? SsJ 9:09PM 0:00.01 postgres: writer process (postgres)  
pgsql 63290 0.0 0.2 179900 19736 ?? SsJ 9:09PM 0:00.00 postgres: wal writer process (postgres)  
root 63480 0.0 0.0 16312 1916 0 S+J 9:14PM 0:00.00 grep pgsql  
pgsql 63286 0.0 0.2 179900 19676 1 SJ 9:09PM 0:00.01 /usr/local/bin/postgres -D /usr/local/pgsql/data

If I issue this command on the client: service postgresql stop

The playbook finishes running and I see this additional output:

changed: [zuul\_postgresql]

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
zuul\_postgresql : ok=3 changed=1 unreachable=0 failed=0

It seems to me that the service isn’t notice that postgresql has started, but when the service stops, it assumes everything has completed and reports success.

---

<div class="post-metadata">

**Author:** ![tannerjc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tannerjc/32/985_2.png) [@tannerjc](https://forum.ansible.com/u/tannerjc)\
**Post date:** [January 2, 2014, 8:08pm UTC](https://forum.ansible.com/t/service-fails-to-notice-postgresql-has-started-on-freebsd/14239/2 "2014-01-02T20:08:17Z")

</div>

What version of freebsd and ansible are you using?
