What is provisioning?
Automatic configuration of a server.
What criteria should a good provisioning script respect?
What is the purpose of a provisioning script?
Where do we use a provisiong script?
On local VMs and remote servers hosting our applications.
What is Ansible? Are there alternatives?
Ansible is software that automates software provisioning, configuration management, and application deployment. Basically: write code to configure servers. Existing alternatives: Puppet, Chef, Bash scripts…
Why Ansible does not require any additional software to be installed on client computers?
Because Ansible communicates over normal SSH channels in order to retrieve information from remote machines, issue commands, and copy files.
Which computers can be administered through Ansible?
Any computer (server) that has an SSH port exposed can be brought under Ansible’s configuration umbrella, regardless of what stage it is at in its life cycle.
How does Ansible work?
Ansible works by configuring client machines from an computer with Ansible components installed and configured.
How does Ansible interact?
Ansible can interact with clients through either command line tools or through its configuration scripts called Playbooks.
How are written Ansible modules and configuration files?
What is the best way to install Ansible on Ubuntu 16.04?
How does Ansible keep track of all the servers?
Through a hosts file (in /etc/ansible/hosts) that need to be set up before computers can communicate.
How to configure the hosts file so that Ansible can communicate with the servers via ssh?
Write in etc/ansible/hosts:
[group_name]
[alias] ansible_host=[server_IP] ansible_port=[port_number] ansible_user=[user]
For Ansible > 2.2: add ansible_python_interpreter=/usr/bin/python3
Optionally: use group specific variables by creating the group_vars directory in etc/ansible and then creating files with the format:
etc/ansible/group_vars/[group_name]
How to make sure that Ansible has a connection to its hosts?
What are Ansible playbooks?
What is the difference between a standard YAML file and an Ansible YAML file?
YAML allows multiple “documents” to exist in one file, each seperated by —, but Ansible only wants one per file, present at the top of the file.
What are the characteristics of YAML files?
What are Ansible plays?
YAML items at the left-most level. Plays are groups of tasks performed on a certain set of hosts to allow them to fulfill the function you assign them.
Basic format:
tasks:
What is the structure of an Ansible task?
[ansible_module]
[ansible_module]
…
Simple description of the apt module.
apt: pkg=[package] state=[state] update_cache=[true/false]
Simple description of the notify module.
The notify item can contain a list of references to handlers, which can perform certain functions when called from within a task.
Format:
notify:
What are Ansible handlers?
How to run an Ansible playbook?
How to check whether an Ansible action was successful or not?
command
register: [var]
ignore_errors: True
command
when: [var] | success
- name: …
command
when: [var] | failed