Erste Schritte mit Ansible

Ad-Hoc Commands

Links: Introduction To Ad-Hoc Command

Datei kopieren:

ansible tester -m copy -a "src=/srv/ansible/apache2/block-url.conf dest=/etc/apache2/site-enabled/block-url.conf"

Package tmux installieren, updaten, löschen:

ansible tester -m apt -a "name=tmux state=latest"
ansible tester -m yum -a "name=tmux state=latest"
ansible tester -m yum -a "name=acme-1.5 state=present"
ansible tester -m apt -a "name=tmux state=absent"

Shell-Befehl ausführen:

ansible tester -m shell -a "echo 0"
ansible tester -a "echo 0"

User & Groups

ansible tester -m user -a "name=tester password=<crypted password here> uid=1080"
ansible tester -m user -a "name=foo state=absent"

Managing Services

ansible webservers -m service -a "name=httpd state=started"
ansible webservers -m service -a "name=httpd state=restarted"
ansible webservers -m service -a "name=httpd state=stopped"