Re: [ansible-project] Looping through a register variable

2024-05-23 Thread Dick Visser
Sent from Gmail Mobile On Thu, May 23, 2024 at 16:50 Todd Lewis wrote: > You want stdout_lines rather than stdout. The former is a list with > new-lines removed. The latter is a possibly very long string with the > complete output stream intact. > > - name: Append to all known_host files >

Re: [ansible-project] Looping through a register variable

2024-05-23 Thread Dimitri Yioulos
Yupper, that worked. And, I appreciate the explanation. As the Farber College motto states, "Learning is Good". On Thursday, May 23, 2024 at 11:30:33 AM UTC-4 Todd Lewis wrote: > Gah! Of course. known.stdout_lines is a list, so > > loop: > - '{{ known.stdout_lines }}' > > passes the whole list

Re: [ansible-project] Looping through a register variable

2024-05-23 Thread Todd Lewis
Gah! Of course. known.stdout_lines is a list, so loop: - '{{ known.stdout_lines }}' passes the whole list as a single item. So you need to not put the list in a list: loop: '{{ known.stdout_lines }}' should do the trick. — Todd On 5/23/24 11:17 AM, Dimitri Yioulos wrote: Todd, I made the

Re: [ansible-project] Looping through a register variable

2024-05-23 Thread Dimitri Yioulos
Todd, I made the change, but, the last play failed: *TASK [Append to all known_host files] *Thursday 23 May 2024 11:06:33 -0400 (0:00:01.629) 0:00:06.012 **Thu

Re: [ansible-project] Looping through a register variable

2024-05-23 Thread Todd Lewis
You want stdout_lines rather than stdout. The former is a list with new-lines removed. The latter is a possibly very long string with the complete output stream intact. - name: Append to all known_host files shell: cat /tmp/append >> {{ item }} loop: - '{{ known.stdout_l

[ansible-project] Looping through a register variable

2024-05-23 Thread Dimitri Yioulos
Good day, all. I hope I'm not wearing out my welcome with too many questions. In the following playbook, I first find any know_host file for any user on a particular system. I then copy a file with the list of additions to add to the known_hosts files. What I want to do is use the output of my

Re: [ansible-project] Create a variable based on a variable

2024-05-23 Thread Abhijeet Janwalkar
Not exactly based on the variables, but I use this to find the datacenter in the vCenter (in my case I have only one datacenter per vCenter so it works) - name: Gather information about all datacenters in vCenter community.vmware.vmware_datacenter_info: hostname: "{{ hostname }}" usern