ansible -m ping first_servers
ansible -m setup first_servers
Использование модуля shell
ansible all -m shell -a «uptime »
ansible all -m shell -a «ls /etc»
Использование модуля command, не работают перенаправления i/o и переменные окружения
ansible all -m command -a «ls /etc |grep hosts »
не отработает
ansible all -m shell -a «ls /etc |grep hosts »
Копирование файла на машины, -b = sudo
ansible all -m copy -a «src=~/test.txt dest=/home/test.txt mode=755» -b
Модуль file
ansible all -m file -a «path=/home/test.txt state=absent» -b
Модуль get_url
ansible all -m get_url -a «url=http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz dest=/usr/src/» -b