[ansible-project] Re: Can I combine with_items and when?

2018-02-26 Thread Nico Sabbi
Il giorno lunedì 26 febbraio 2018 16:14:19 UTC, flowerysong ha scritto: > > > > > You'll note that this error is from the 'debug' task, which has neither a > loop nor a 'when' clause. `item` is undefined because `item` has not been > defined for that task. > > If you were attempting to apply

Re: [ansible-project] Can I combine with_items and when?

2018-02-26 Thread Nico Sabbi
] But as noted by floweryoursong... Il giorno lunedì 26 febbraio 2018 15:38:58 UTC, Kai Stian Olstad ha scritto: > > On Monday, 26 February 2018 15.39.09 CET Nico Sabbi wrote: > > HI, > > can I combine when: and with_items clauses as in this example? > > > >

[ansible-project] Can I combine with_items and when?

2018-02-26 Thread Nico Sabbi
HI, can I combine when: and with_items clauses as in this example? become: true become_user: root tasks: - block: - debug: msg: "riga {{item}}" - user: name: "{{ item.split(':')[0] }}" home: "{{ item.split(':')[1] }}" when: item

Re: [ansible-project] Can someone show a working example of how to iterate over the rows of a csv file?

2018-02-22 Thread Nico Sabbi
Sorry, but it's not clear at all how debug iterates over the rows. Running a simple debug doesn't help. For example, if I had a playbook like this (that of course doesn't work), how should I fix it to iterate over every single row and print the value of the 3 columns? --- - hosts: db

[ansible-project] Can someone show a working example of how to iterate over the rows of a csv file?

2018-02-21 Thread Nico Sabbi
HI, I find Ansible docs *really* frustrating. Never a full example that is not trivial or misleading. Please, can someone provide a working example of a play to iterate over the rows of a csvfile? Thanks. -- You received this message because you are subscribed to the Google Groups

[ansible-project] Re: What's the safest way to do grep-like searches in files?

2018-02-13 Thread Nico Sabbi
s precise. > > On Tuesday, February 13, 2018 at 10:45:57 AM UTC-6, Nico Sabbi wrote: >> >> HI, >> I need to do a grep-like search in a file without using shell commands >> and in a check_mode compatible way. >> I just need to check the presence of a given string a

Re: [ansible-project] What's the safest way to do grep-like searches in files?

2018-02-13 Thread Nico Sabbi
: > path: /etc/myfile > register: myfile > > - set_fact: > contains_cmdline: "{{ myfile.contents|b64decode|search("^CMDLINE") }}" > > On Tue, Feb 13, 2018 at 10:45 AM, Nico Sabbi <nico@gmail.com > > wrote: > >>

[ansible-project] What's the safest way to do grep-like searches in files?

2018-02-13 Thread Nico Sabbi
HI, I need to do a grep-like search in a file without using shell commands and in a check_mode compatible way. I just need to check the presence of a given string a in a file without doing overwrites of any kind. I implemented something with lineinfile but I'm very annoyed by the need to