Lab 3 - Solution¶
Mandatory¶
Try out ansible-doc¶
- print out all available modules
- check the docu of the module
command - check the docu of the modules
yumandapt
ansible-doc -l
ansible-doc command
ansible-doc yum
ansible-doc apt
Ping all hosts¶
- Run the ansible module “ping” on all hosts in your inventory
- Run the ansible module “ping” only on
web1.<firstname>.lab
ansible -m ping all
ansible -m ping web1.firstname.lab
Run the command modul¶
- Run
uname -aon all servers viacommandmodule - Run
whoamion all servers viacommandmodule - Run
cat /etc/redhat-releaseonly onweb2.<firstname>.lab - Run
cat /etc/redhat-releaseonly onweb1.<firstname>.lab
ansible -a "uname -a" all
# should be root
ansible -a "whoami" all
ansible -a "cat /etc/redhat-release" web2.pascal.lab
# will fail! it's a Debian OS
ansible -a "cat /etc/redhat-release" web1.pascal.lab