We install ansible on a control node, which then uses SSH to communicate with managed hosts (devices we want to automate)
Python 2(version 2.7) or Python3(verssn 3.5 or higher)installed.
Windows is not supported for control node.
For communication between managed host and control node SSH is required.
Python 2(version 2.7) or Python3(verssn 3.5 or higher)installed.
sudo dnf install ansible
sudo yum install ansible
sudo apt update
sudo apt install software-properties-common
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt install ansible
This is a simple playbook for Apache web server. In this playbook three modules are used
- yum
- copy
- service
These modules are used for Installing httpd,copying file to the correct location and starting the service of httpd respectively.
This Playbook contains Multiple plays ,it's an extension of the previous playbook in this playbook First play will update the Apache and firewalld package to it's latest version . In the second play the web server is being tested .
Modules Used :
- yum
- copy
- service
- firewalld
- uri
In this playbook we are using variables in place of directly using name of the packages ,services and rules.
variables are defined using vars keyword. To call a variable anywhere in the playbook we have to use {{variable-name}}.
- vars: variable_name: value
In this playbook we are managing secrets by using Ansible Vault which is included with Ansible , can be used to encrypt and decrypt any structured data file used by Ansible and make secure our playbook, inventory variables or variable files etc.
ansible-vault create filename
ansible-vault view filename
ansible-vault edit filename
ansible-vault encrypt filename
ansible-vault decrypt filename
ansible-vault rekey filename