ad-hoc demo
-
hostsinventory file$ pico hosts [local] 127.0.0.1 -
pingdemo$ ansible local -i hosts -m ping -
ansible.cfgfile$ pico ansible.cfg [defaults] hostfile=hosts remote_user=hqlgree2 -
do not need
-i$ ansible local -m ping $ ansible local -m command -a uptime # command is the default module $ ansible local -a uptime -
command contain space double quote it
$ ansible local -a "tail /var/log/dmesg" -
sudoas root use-sflag$ ansible local -s -a "tail /var/log/syslog" -
install
nginxon ubuntu$ ansible ubuntubox -s -m apt -a name=nginx # if fails $ ansible ubuntubox -s -m apt -a "name=nginx update_cache=yes"