2

When I execute an ansible ad-hoc command, output from each host is consolidated and not able to see all of them. I could not find any options to explicitly instruct ansible.

Currently this is what happens even with -f 1 option

$ ansible all -a hostname -i inventory.yaml -f 1
172.16.1.5 172.16.1.6 172.16.1.7 | CHANGED | rc=0 >>
node1

Instead I would like to see the output of hostname command from each hosts in the inventory on new lines.

Inventory file:

all:
 hosts:
    172.16.1.5 
    172.16.1.6 
    172.16.1.7
2
  • Are you quite sure that all three hosts don't have the name node1? Jun 18, 2020 at 16:16
  • @MichaelHampton they all have different names (node1, node2, none3). The issue was with the missing : on the host entry
    – Logu
    Jun 18, 2020 at 18:18

2 Answers 2

2

On the inventory, I was missing the colon at the end of the host/IP and newer versions expects it.

all:
 hosts:
    172.16.1.5: 
    172.16.1.6: 
    172.16.1.7: 
   
0

You can simply put "-v" at the end

ansible all -a hostname -i inventory.yaml -f 1 -v

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.