Aller au contenu principal

Les nouveautés d'Ansible 4.0

· 4 minutes de lecture
Stéphane ROBERT
Consultant DevOps

Après la version 3.0, qui a marqué le changement de packaging d'Ansible, voici la version 4.0. Comme annoncé, elle est basée sur Ansible-base 2.11 et contient toute une série de mises à jour sur les collections incluses. Vous pouvez retrouver la liste complète ici :

CHANGELOG-v4

Si on parcourt la liste des changements, on remarque que beaucoup de ménage a été fait dans les modules. Donc faites attention lors de la migration, car certains de vos rôles ou playbooks risquent de ne plus fonctionner !

Ansible-test a beaucoup évolué et supporte beaucoup plus de systèmes d'exploitation qu'auparavant (RHEL 8.3, MacOS 11.1, ...)

Comment Installer Ansible 4.0.0

Attention si vous avez déjà installé ansible avec pip, il faudra la désinstaller en premier. De plus, python 3.8 est requis sur le node controller d'Ansible.

*Upgrading directly from ansible-2.10, ansible-3, or ansible-base-2.10 to ansible-4*
*or greater with pip is known to cause problems.  Please uninstall the old version ... *

Comment procéder ?

pip3 uninstall ansible
pip3 install ansible
Collecting ansible==4.0.0
  Downloading ansible-4.0.0.tar.gz (33.3 MB)
     |████████████████████████████████| 33.3 MB 5.3 MB/s
Collecting ansible-core<2.12,>=2.11.0
  Downloading ansible-core-2.11.0.tar.gz (5.8 MB)
     |████████████████████████████████| 5.8 MB 27.3 MB/s
Collecting PyYAML
  Downloading PyYAML-5.4.1-cp38-cp38-manylinux1_x86_64.whl (662 kB)
     |████████████████████████████████| 662 kB 3.2 MB/s
Collecting cryptography
  Downloading cryptography-3.4.7-cp36-abi3-manylinux2014_x86_64.whl (3.2 MB)
     |████████████████████████████████| 3.2 MB 3.4 MB/s
Collecting jinja2
  Downloading Jinja2-3.0.1-py3-none-any.whl (133 kB)
     |████████████████████████████████| 133 kB 4.6 MB/s
Collecting packaging
  Downloading packaging-20.9-py2.py3-none-any.whl (40 kB)
     |████████████████████████████████| 40 kB 3.5 MB/s
Collecting resolvelib<0.6.0,>=0.5.3
  Downloading resolvelib-0.5.4-py2.py3-none-any.whl (12 kB)
Collecting cffi>=1.12
  Downloading cffi-1.14.5-cp38-cp38-manylinux1_x86_64.whl (411 kB)
     |████████████████████████████████| 411 kB 3.9 MB/s
Collecting MarkupSafe>=2.0
  Downloading MarkupSafe-2.0.1-cp38-cp38-manylinux2010_x86_64.whl (30 kB)
Collecting pyparsing>=2.0.2
  Downloading pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
     |████████████████████████████████| 67 kB 3.7 MB/s
Collecting pycparser
  Downloading pycparser-2.20-py2.py3-none-any.whl (112 kB)
     |████████████████████████████████| 112 kB 5.6 MB/s
Building wheels for collected packages: ansible, ansible-core
  Building wheel for ansible (setup.py) ... done
  Created wheel for ansible: filename=ansible-4.0.0-py3-none-any.whl size=54846321 sha256=2b9edcb60252103bce1ff3421cf82ffa5498fd99b7fb2f60801593c30a349716
  Stored in directory: /root/.cache/pip/wheels/38/b0/6a/98e4da2701736a44647d463f1fa8b37d1c4598957cfc1ccd01
  Building wheel for ansible-core (setup.py) ... done
  Created wheel for ansible-core: filename=ansible_core-2.11.0-py3-none-any.whl size=1949171 sha256=21f1a6e19149010476a2d8d219ddebb45acaa7a663dc954fc85a6b162bce3d10
  Stored in directory: /root/.cache/pip/wheels/48/df/48/094515609ba2d4f4cdd8702b0fbe162286d4c2cc95342b653c
Successfully built ansible ansible-core
Installing collected packages: PyYAML, pycparser, cffi, cryptography, MarkupSafe, jinja2, pyparsing, packaging, resolvelib, ansible-core, ansible
Successfully installed MarkupSafe-2.0.1 PyYAML-5.4.1 ansible-4.0.0 ansible-core-2.11.0 cffi-1.14.5 cryptography-3.4.7 jinja2-3.0.1 packaging-20.9 pycparser-2.20 pyparsing-2.4.7 resolvelib-0.5.4

Quels sont les modules disponibles ?

Il suffit de lancer la commande ansible-galaxy pour lister les collections installés par défaut :

ansible-galaxy collection list

# /usr/local/lib/python3.8/dist-packages/ansible_collections
Collection                    Version
----------------------------- -------
amazon.aws                    1.5.0
ansible.netcommon             2.0.2
ansible.posix                 1.2.0
ansible.utils                 2.1.0
ansible.windows               1.5.0
arista.eos                    2.1.1
awx.awx                       19.0.0
azure.azcollection            1.5.0
check_point.mgmt              2.0.0
chocolatey.chocolatey         1.1.0
cisco.aci                     2.0.0
cisco.asa                     2.0.1
cisco.intersight              1.0.15
cisco.ios                     2.0.1
cisco.iosxr                   2.1.0
cisco.meraki                  2.2.1
cisco.mso                     1.1.0
cisco.nso                     1.0.3
cisco.nxos                    2.2.0
cisco.ucs                     1.6.0
cloudscale_ch.cloud           2.1.0
community.aws                 1.5.0
community.azure               1.0.0
community.crypto              1.6.2
community.digitalocean        1.1.1
community.docker              1.5.0
community.fortios             1.0.0
community.general             3.0.2
community.google              1.0.0
community.grafana             1.2.1
community.hashi_vault         1.1.3
community.hrobot              1.1.1
community.kubernetes          1.2.1
community.kubevirt            1.0.0
community.libvirt             1.0.1
community.mongodb             1.2.1
community.mysql               2.1.0
community.network             3.0.0
community.okd                 1.1.2
community.postgresql          1.2.0
community.proxysql            1.0.0
community.rabbitmq            1.0.3
community.routeros            1.1.0
community.skydive             1.0.0
community.sops                1.0.6
community.vmware              1.9.0
community.windows             1.3.0
community.zabbix              1.3.0
containers.podman             1.5.0
cyberark.conjur               1.1.0
cyberark.pas                  1.0.6
dellemc.enterprise_sonic      1.0.3
dellemc.openmanage            3.3.0
dellemc.os10                  1.1.1
dellemc.os6                   1.0.7
dellemc.os9                   1.0.4
f5networks.f5_modules         1.9.0
fortinet.fortimanager         2.0.2
fortinet.fortios              2.0.1
frr.frr                       1.0.3
gluster.gluster               1.0.1
google.cloud                  1.0.2
hetzner.hcloud                1.4.3
hpe.nimble                    1.1.3
ibm.qradar                    1.0.3
infinidat.infinibox           1.2.4
inspur.sm                     1.1.4
junipernetworks.junos         2.1.0
kubernetes.core               1.2.1
mellanox.onyx                 1.0.0
netapp.aws                    21.2.0
netapp.azure                  21.5.0
netapp.cloudmanager           21.5.1
netapp.elementsw              21.3.0
netapp.ontap                  21.5.0
netapp.um_info                21.5.0
netapp_eseries.santricity     1.2.7
netbox.netbox                 3.0.0
ngine_io.cloudstack           2.1.0
ngine_io.exoscale             1.0.0
ngine_io.vultr                1.1.0
openstack.cloud               1.4.0
openvswitch.openvswitch       2.0.0
ovirt.ovirt                   1.4.2
purestorage.flasharray        1.8.0
purestorage.flashblade        1.6.0
sensu.sensu_go                1.9.4
servicenow.servicenow         1.0.5
splunk.es                     1.0.2
t_systems_mms.icinga_director 1.16.0
theforeman.foreman            2.0.1
vyos.vyos                     2.2.0
wti.remote                    1.0.1
ansible --version
ansible [core 2.11.0]
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0]
  jinja version = 3.0.1
  libyaml = True

Si vous voulez plus de tutorials Ansible je vous renvoie sur le billet de l'introduction à ansible