Glossary

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
task
role

Tower
Red Hat Ansible Tower
    Extend Ansible Automation.

    Centralize and control your Ansible
    infrastructure with a visual dashboard,
    role-based access control, job scheduling,
    and graphical inventory management with
    Red Hat Ansible Tower.

    Tower's REST API and UI make it easy to
    embed and extend Tower into existing
    tooling and processes; further extending
    the capability and reach of Ansible
    Automation.

Galaxy
Ansible Galaxy
    Refers to the Galaxy website where users
    can share roles, and to a command line
    tool for installing, creating and managing
    roles.

Ansible
Engine
Ansible Engine
    [redhat product]
    [IT automation tool]

    The simplest way to automate your IT
    infrastructure.

    Ansible is an automation solution that
    acts as a resource provisioner,
    configuration management tool, application
    release automation, and can provision and
    manage entire application and
    infrastructure environments.

    Can configure systems, deploy software,
    and orchestrate more advanced IT tasks
    such as continuous deployments or zero
    downtime rolling updates.

    Open-source software provisioning,
    configuration management, and application-
    deployment tool.

    It runs on many Unix-like systems, and can
    configure both Unix-like systems as well
    as Microsoft Windows.

    The simplest way to automate apps and IT
    infrastructure.

    Application Deployment + Configuration
    Management + Continuous Delivery.

playbook
    [#ansible]

    A configuration for deployment and
    orchestration, that allows you to describe
    a set of tasks to be run on remote
    machines.

    We will need to write a YAML file
    describing the tasks of our deploy.

Ecosystem

  • components
    • engine
    • tower
    • galaxy
    • vault

Engine

1
egr ansible engine
Provisioning
Create, update, and destroy VMs in a private datacenter hypervisor or instances in a public cloud. Also, manage resources, including virtual disks, network interfaces, load balancers, images, and more for these objects.
Configuration Management
Keep systems standard across your entire IT, cloud, and application infrastructure. After a host is provisioned, define the state based on groups and roles, which contain repeatable tasks and deliver templates to maintain the desired end state of your deployed environments.
Application Release Automation
Release fast, release often.

Once configured, deploy applications with ease and simplicity using the same Playbook language.

Ansible modules can be used to configure states and work with common Application stacks, such as JBoss or Django apps (to name a few), leveraging their APIs to deploy built content from various CI platforms.

Workflow Automation
Easily build entire workflows to deploy nearly anything from infrastructure to applications to networks. Always know what the running state of your environments are, and enable the tracking of multiple baselines and versions– all from simple playbooks.

Works with the technologies you use today With over 1200 enterprise integrations, Ansible automation can automate the tools, technologies, and infrastructure that youโ€™re using today. And weโ€™re adding more modules, more support, and more flexibility with every release.

Upgrade Ansible

Requirements

1
2
3
4
5
Ansible works on any machine that can run
Python 2 or 3, except for Windows.

Use the Linux subsystem or something else if
you are running Windows.

Mac

1
pip install --user ansible

Ubuntu

1
2
3
4
sudo apt update
sudo apt install software-properties-common
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt install ansible

Config files

  • /etc/ansible/hosts
  • $HOME/.ansible.cfg
1
2
3
# https://docs.ansible.com/ansible/latest/user_guide/connection_details.html#host-key-checking
[defaults]
host_key_checking = False

Passwords

You can set ansible_password but it’s recommended to set up the public key.

Run some tasks

  • Run a set of tasks (roles)
    • geerlingguy.php-versions
    • geerlingguy.php
1
2
3
4
5
6
7
8
9
- hosts: wordpress
  vars:
    php_version: '7.3'
    php_versions_install_recommends: false
  roles:
    - role: geerlingguy.repo-remi
      when: ansible_os_family == 'RedHat'
    - geerlingguy.php-versions
    - geerlingguy.php

Using Ansible Galaxy

1
2
3
ansible-galaxy install geerlingguy.repo-remi
ansible-galaxy install geerlingguy.php-versions
ansible-galaxy install geerlingguy.php

Upgrading PHP with ansible

1
ansible-playbook upgrade-php.yml

Installing roles

1
ansible-galaxy search vim

Search for an elasticsearch role for ubuntu

1
2
ansible-galaxy search elasticsearch --platforms Ubuntu
ansible-galaxy role search elasticsearch --platforms Ubuntu

Search for and install role

1
ansible-galaxy role search elasticsearch --platforms Ubuntu | fzf +s | ew | s field 1 | xa ansible-galaxy install

List installed roles

1
ansible-galaxy list
# /home/shane/.ansible/roles
- 0x0i.elasticsearch, v0.1.0

Determine where roles are installed

1
ansible-galaxy install --roles-path ~/ansible-roles 0x0i.elasticsearch
- downloading role 'elasticsearch', owned by 0x0i
- downloading role from https://github.com/0x0I/ansible-role-elasticsearch/archive/v0.1.0.tar.gz
- extracting 0x0i.elasticsearch to /home/shane/ansible-roles/0x0i.elasticsearch
- 0x0i.elasticsearch (v0.1.0) was installed successfully