Reputation: 675
I have the below playbook to display du for a list of ec2 hosts. However, with this, the output displays du and the corresponding public ip address. How can I modify this to display the output alongwith private IP address for the corresponding ec2 instances?
---
- hosts: ec2_hosts
tasks:
- name: "display disk utilization"
command: df -h /home
register: show
- debug: var=show.stdout_lines
...
Upvotes: 0
Views: 296
Reputation: 537
Somewhat crude way is just modify your command
:
command: df -h /home && ip a
A bit cleaner would be when you specify the name of the interface of interest:
command: df -h /home && ip a show eth1
And the most readable would be to add one more task:
- name: Display interface configuration
command: ip a show eth1
register: ifc
Upvotes: 1