Not all services being stopped

Hi

An extract from a playbook:

  • name: Stop 389 services
    action: service name=dirsrv-admin state=stopped
    action: service name=dirsrv state=stopped

The log:
TASK: [Stop 389 services] *********

ok: [auth01.example.com] => service name=dirsrv state=stopped

PLAY RECAP **********************

auth01.example.com : ok= 2 changed= 1 unreachable= 0 failed= 0

For some reason dirsrv-admin does not get stopped.

doing it manually:
ansible auth01.example.com -m service -a “name=dirsrv-admin state=stopped”
does work, so not sure why it fails in the playbook. Thoughts?

Regards

I noticed something like this.

If you change:

   - name: Stop 389 services
     action: service name=dirsrv-admin state=stopped
     action: service name=dirsrv state=stopped

to

   - name: Stop 389-admin services
     action: service name=dirsrv-admin state=stopped
   - name: stop dirsrv
     action: service name=dirsrv state=stopped

I bet it starts working. I think the 'accept to action statements w/o a
name' is just taking the last action statement.

I've not had a chance to look at the code yet to figure out why but I
noticed it yesterday in testing a playbook.

-sv

Actually, I think your syntax is wrong.

  • name:
    action:
  • action:
  • action:

Is (technically) correct, but you’re specifying the same hash key twice, which is only one action. There is no way to specify one name for more than one action.

Damm, I will fix my syntax. Would have been nice.

Regards