Your last "when:" is wrong.

    when: 'not i_am_master' 

A quoted when condition that contains no jinja mustaches is just a string, 
which is always true. You want

    when: not i_am_master 


On Thursday, October 13, 2022 at 5:19:26 AM UTC-4 [email protected] wrote:

> The last task below does not complete.
> - - -
>
> - name: Enable/Disable servers
> ansible.builtin.service:
> name: '{{ ena_item }}'
> enabled: '{{ i_am_master }}' 
> loop_control:
> loop_var: ena_item
> loop:
> - mailman
> - uwsgi
> - nginx
>
> - name: Start uwsgi if i_am_master
> ansible.builtin.service:
> name: uwsgi
> state: started
> when: i_am_master
>
> - name: Stop servers if not if i_am_master
> ansible.builtin.service:
> name: '{{ ena_item }}'
> state: stopped 
> loop_control:
> loop_var: ena_item
> loop:
> - mailman
> - uwsgi
> - nginx
> when: 'not i_am_master'
>
> - - -
>
> How can I debug this?
> What may be the reason?
>
> OS is FreeBSD 13.1
>
> Axel
> ---
> PGP-Key: CDE74120 ☀ computing @ chaos claudius
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/01e1234c-1f5a-4488-8c5e-b5655a9a92a9n%40googlegroups.com.

Reply via email to