1,760
edits
Changes
→Key Concepts when using Ansible
* Ad hoc commands - a simple one-off task:
** <u><b>shell commands</b></u>
*** ansible 192.168.99.153 remote_machine_id [-a 'date'*** ansible 192.168.99.153 i inventory] [-a 'df' *** ansible 192.168.99.153 -a 'iptables private-L key id_rsa] [-n u remote_user] -va 'date' -u root
* Ansible 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.99.153 remote_machine_id -m copy -a "src=/ops435/ansible.txt dest=/tmp/ansible.txt"
** <u><b>Package management</b></u>
*** ansible 192.168.99.153 remote_machine_id -m yum -a "name=epel-release 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 remote_machine_id [-i 192.168.99.153, inventory] setup_webserver.yaml** ansible-playbook remote_machine_id [-i inventory] firstrun.yaml
== Part 1: The Ansible package installed on matrix ==