Provisioning Flashcards
What is provisioning?
Automatic configuration of a server.
What criteria should a good provisioning script respect?
- Work from the first try.
- Work when launched several times.
- Be easy to understand, so be simple.
What is the purpose of a provisioning script?
- Configure servers faster.
- Avoid human errors.
- Have a maintanable and reusable 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?
- Modules can be written in any language and communicate in standard JSON.
- Configuration files are mainly written in the YAML data serialization format due to its expressive nature and its similarity to popular markup languages.
What is the best way to install Ansible on Ubuntu 16.04?
- $ sudo apt-add-repository ppa:ansible/ansible
- $ sudo apt-get update
- $ sudo apt-get install ansible
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?
- One host: $ ansible -m ping [server_alias]
- Multiple hosts: $ ansible -m ping [server_alias]:[server_alias]
- Group of hosts: $ ansible -m ping [group_name]
- All hosts: $ ansible -m ping all
What are Ansible playbooks?
- Ansible playbooks are a way to send commands to remote computers in a scripted way. That is, you can configure entire complex environments by passing a script to one or more systems.
- Ansible playbooks are written in the YAML data serialization format.
- Each playbook contains one or more plays, which map hosts to a certain function. Ansible does this through something called tasks, which are basically module calls.