up vote0down votefavorite
|
I have a silly playbook which just runs a command to get the list of vhost in every host on webserver group. As all vhost are located in /var/www is easy to get the list of webs.
The problem is the way of Ansible returns the info. For example:<br>ok: [host1] => {<br> "var": {<br> "out.stdout_lines": [<br> "",<br> "host1.com"<br> ]<br> }<br>}<br>ok: [host2] => {<br> "var": {<br> "out.stdout_lines": [<br> "",<br> "host2.com"<br> ]<br> }<br>}<br><br>
Do you know an easy way to just get the name of the vhosts? Using grep awk or something like that?
|
Maybe Ansible ad-hoc is something too use
ansible webservers -a "ls /var/www" | egrep -v ">>|^$"