Installation sur Ubuntu/Debian
# Methode recommandee : via apt
sudo apt update
sudo apt install -y ansible
# OU via pip (derniere version)
sudo apt install -y python3-pip
pip3 install ansible
# Verifier l'installation
ansible --version
Installation sur CentOS/RHEL
# Activer le depot EPEL
sudo yum install -y epel-release
sudo yum install -y ansible
# OU via pip
pip3 install ansible
Fichier de configuration ansible.cfg
Ansible cherche sa configuration dans cet ordre :
ANSIBLE_CONFIG(variable d'environnement)./ansible.cfg(repertoire courant)~/.ansible.cfg(repertoire home)/etc/ansible/ansible.cfg(global)
# ansible.cfg minimal
[defaults]
inventory = ./inventory
remote_user = deploy
host_key_checking = False
[privilege_escalation]
become = True
become_method = sudo
become_user = root
Bonne pratique : Placez toujours un fichier ansible.cfg a la racine de votre projet Ansible.