Ansible

1 DevOps

7

, . , , . , Vagrant, Ansible . , , .


Ansible ?

, , Python. Ansible , . . Ansible :

  1. , . , Ansible Vagrant.
  2. .
  3. , , , , copy shell. , , Ansible .
  4. , .
  5. .
  6. Apache, .
  7. , 6 , .
  8. , .
  9. Ansible .
, ( ) :    GUI Ansible
Ansible ?

Ansible . , . , .


Ansible?

, :

  • jinja2
  • yaml

, , , Linux . , Linux Ansible Ubuntu . , Ansible. , . , Ansible , , . Vagrant.


Vagrant Linux ?

. , Vagrant. , :

  • Virtualbox.
  • , Virtualbox , 1 Ruby. Linux, , Debian Ubuntu, , . Ubuntu Debian, Ruby .
  • 1 Vagrant 1.1+. .

. , , : vagrant up. . Root . , . SSH, . , . :

  Ansible

inventory. , , .

host0.example.org ansible_ssh_host=192.168.33.10 ansible_ssh_user=root
host1.example.org ansible_ssh_host=192.168.33.11 ansible_ssh_user=root
host2.example.org ansible_ssh_host=192.168.33.12 ansible_ssh_user=root

, ansible_ssh_host IP . , .

, , . :

ansible -m ping all -i step-01/hosts

Ansible ping. , , :

 host0.example.org | success >> {
    "changed": false,
    "ping": "pong"
}

host1.example.org | success >> {
    "changed": false,
    "ping": "pong"
}

host2.example.org | success >> {
    "changed": false,
    "ping": "pong"
}

, - . . , .


, ?

, , ansible. , , .


, ?

. , , , .

ansible -i step-02/hosts -m shell -a 'uname -a' host0.example.org

, :

host1.example.org | success | rc=0 >>
DISTRIB_RELEASE=12.04

host2.example.org | success | rc=0 >>
DISTRIB_RELEASE=12.04

host0.example.org | success | rc=0 >>
DISTRIB_RELEASE=12.04

, . , , setup. , . :

"ansible_facts": {
    "ansible_all_ipv4_addresses": [
        "192.168.0.60"
    ],
    "ansible_all_ipv6_addresses": [],
    "ansible_architecture": "x86_64",
    "ansible_bios_date": "01/01/2007",
    "ansible_bios_version": "Bochs"
    },
    ---snip---
    "ansible_virtualization_role": "guest",
    "ansible_virtualization_type": "kvm"
},
"changed": false,
"verbose_override": true

, , .


Ansible

Ansible :

  • Cloud , Amazon, Azure , Docker, Openstack ;
  • Command ;
  • Monitoring .

, . , , Ansible Linux Windows Mac OS. Ansible Debian Ubuntu. DevOps!


50% Merion Academy