I was abl to get my first node changed but the other 2 had this added

image: gralog/graylog:4.2.5
#image: graylog/graylog4.2.5
image: graylog/graylog4.2.8

On Wed, May 4, 2022 at 7:09 PM Tony Wong <[email protected]> wrote:

> Got it, thanks!
>
> On Wed, May 4, 2022 at 3:13 PM Vladimir Botka <[email protected]> wrote:
>
>> See the complete example below
>>
>> shell> cat docker-compose
>> image: graylog/graylog4.2.5
>>
>>
>> shell> cat pb.yml
>> ---
>> - hosts: localhost
>>   vars:
>>     versions:
>>       4.2.5: false
>>       4.2.8: true
>>   tasks:
>>     - lineinfile:
>>         path: docker-compose
>>         regex: '^\s*#*\s*image: graylog/graylog{{ item.key }}\s*$'
>>         line: '{{ hash }}image: graylog/graylog{{ item.key }}'
>>       loop: "{{ versions|dict2items }}"
>>       vars:
>>         hash: "{{ item.value|ternary('', '#') }}"
>>
>>
>> shell> ansible-playbook pb.yml
>>
>> PLAY [localhost]
>> ***************************************************************
>>
>> TASK [lineinfile]
>> ***************************************************************
>> changed: [localhost] => (item={'key': '4.2.5', 'value': False})
>> changed: [localhost] => (item={'key': '4.2.8', 'value': True})
>>
>> PLAY RECAP
>> ***************************************************************
>> localhost: ok=1    changed=1    unreachable=0
>> failed=0    skipped=0    rescued=0    ignored=0
>>
>>
>> shell> cat docker-compose
>> #image: graylog/graylog4.2.5
>> image: graylog/graylog4.2.8
>>
>>
>> --
>> Vladimir Botka
>>
>

-- 
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/CALmkhkqEMuwWVCCLULXakkRj%2BD8Dd2wdtPz-xTb38pGSH%3DJ00A%40mail.gmail.com.

Reply via email to