Changes

Jump to: navigation, search

Ops535 ansible lab

9 bytes removed, 23:46, 28 January 2021
Key Concepts when using Ansible
* Ad hoc commands - a simple one-off task:
** <u><b>shell commands</b></u>
*** ansible 192.168.9949.153 3 -a 'date'*** ansible 192.168.9949.153 3 -a 'df' *** ansible 192.168.9949.153 3 -a 'iptables -L -n -v' -u root
* Built-in modules - code that performs a particular task such as copy a file, installing a package, etc:
** <u><b>copy module</b></u>
*** ansible 192.168.9949.153 3 -m copy -a "src=/ops435home/rchan/ops535/ansible.txt dest=/tmp/ansible.txt"
** <u><b>Package management</b></u>
*** ansible 192.168.9949.153 3 -m yum -a "name=epel-release bind state=latest"
* Playbooks - contains one or multiple plays, each play defines a set of repeatable tasks on one or more managed machines. Playbooks are written in YAML. Every play in the playbook is created with environment-specific parameters for the target machines:
** ansible-playbook -i 192.168.9949.1533, setup_webserver.yaml
** ansible-playbook firstrun.yaml
1,760
edits

Navigation menu