Introduction to Ansible¶
What is Ansible?¶
To quote the Ansible Community Documentation,
Quote
Ansible provides open-source automation that reduces complexity and runs everywhere. Using Ansible lets you automate virtually any task. Here are some common use cases for Ansible:
- Eliminate repetition and simplify workflows
- Manage and maintain system configuration
- Continuously deploy complex software
- Perform zero-downtime rolling updates
Ansible uses simple, human-readable scripts called playbooks to automate your tasks. You declare the desired state of a local or remote system in your playbook. Ansible ensures that the system remains in that state.
As automation technology, Ansible is designed around the following principles:
- Agent-less architecture
- Simplicity
- Scalability and flexibility
- Idempotence and predictability
And it does exactly that. You configure what you want to be done, and Ansible does it.
If you made it right, reruns don't break anything, but may correct unintentional drifts.
Installing Ansible¶
To install the Ansible tool, use the following command:
-
Ubuntu / Debian
-
Fedora / Red Hat
-
Arch-based
Installing collections¶
To install the extra collections/modules needed for this stack, use the following command:
Common commands¶
Create, edit and view a vault: ansible-vault {create/edit/view} secrets.yml
Run the playbook: ansible-playbook -i inventory.ini play.yml --ask-vault-pass