The ansible command can also be used to run arbitrary commands on remote servers. In the following example, we will only run the df command on hosts matching 18.206.223.* for their public IP address (you will need to adapt this command to match your instance public IP, as returned in the ping command in the previous example):
$ ansible --private-key ~/.ssh/EffectiveDevOpsAWS.pem '18.206.223.*' \-a 'df -h'18.206.223.199 | SUCCESS | rc=0 >>Filesystem Size Used Avail Use% Mounted ondevtmpfs 484M 56K 484M 1% /devtmpfs 494M 0 494M 0% /dev/shm/dev/xvda1 7.8G 1.1G 6.6G 15% /
Now that we have a basic understanding of how Ansible works, we can start combining calls to different Ansible modules to put in place for automation. ...