You are on page 1of 12

Ansible Training Course

Introduction to Ansible
What is IaC ?

Infrastructure as Code (IaC) uses a high-


level descriptive coding language to
automate the provisioning of IT
infrastructure.
-IBM
What’s Ansible ?
• Ansible is an open source IT Configuration
Management, deployment, and orchestration
tool.

• Ansible has modules for Provisioning


containers, virtualization, cloud vendors.

• Ansible lets you control and configure remote


nodes from a single machine.
4
Running modules
Ad’hoc commands
• Ad hoc commands are commands which can be run
individually to perform quick functions.
• These ad-hoc commands are not used for configuration
management and deployment, because these commands are
of one time usage.
• To find out if all the hosts are up and running, use the
following ad’hoc command that uses the ping module of
Ansible

6
Playbooks
database.yml

# ansible-playbook database.yml
7
Variables
• There are few places where you can define variables in an
Ansible playbook.

 In the inventory file

 In the playbook

9
Lists
• Every element(member) of list should be written in a
new line with same indentation starting with “- “ (-
and space).

10
Facts
• Facts are information derived from speaking with your
remote systems. You can find a complete set under
the ansible_facts variable.

• Disabling Facts

11
Ansible Vault
• To create a new encrypted data file, run the
following command:

• Ywill be prompted for a password, then the


tool will launch “vi” editor.
• To run a playbook where data is encrypted
with vault, add the option :

12

You might also like