Ansible
- Refer Here for Ansible official page
- Ansible is majorly used in DevOps to deploy applications into servers across various environments.
- Ansible in CI/CD pipeline is called by some engine (Jenkins => Ansible, AzureDevOps => Ansible …)
- Configuration Management types
- pull based CM
- Nodes communicate with CM Server to deploy configuration
- For this to happen, We need to
- install agent software on node and configure it to connect to the server.
- Examples:
- Chef
- Puppet
- push based CM:
- CM Server communicates with Nodes to deploy configuration
- For this to happen we need details such as
- ip address of node
- credentials
- Examples:
- Ansible
- Salt
- pull based CM
Declarative vs Procedural
- Understanding Declarative vs Procedural
- In Declarative programming, we define what we want (desired state).
- The job of the tool is to ensure desired state is met every time during execution.
- Idempotance: The result of execution of CM Script is same when we execute it once or multiple times
- Configuration Drift: Difference between desired state and actual state.
Ansible Architecture
- Overview
-
Components
- Ansible control node: This is where ansible is installed
- Nodes: This is where we want o perform deployments
- Inventory: list of nodes and their information
- Playbook: What has to be done on the node
-
Workflow
- We develop playook and specify inventory and execute the playbook on ansible control node
- Now ansible tries to establish connection to node
- Now the ansible playbook is executed with the help of python on node.