-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathprerequis.yml
24 lines (19 loc) · 941 Bytes
/
prerequis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# ansible-playbook -i ./inventory/preprod/ ./prerequit.yml
---
# Installe python et python-apt pour le bon fonctionnement d'Ansible
- hosts: all
remote_user: root
gather_facts: false # on ne collecte pas les facts car il faut python 2 d'installé sur les serveurs distants
tasks:
# to be able to remove ansible-lint warning on non-needed changes/tasks (only install python-apt when required):
- name: "check whether python-apt is installed or not"
raw: "dpkg -l 'python-apt' | grep '^ii'"
register: is_python_apt_installed
changed_when: False
failed_when: False
#- name: "debug"
# debug: var=is_python_apt_installed
# install python-apt when required:
- name: "install python-apt"
raw: apt-get -y install python python-apt # une commande raw, exécutée directement en shell sur le serveur distant via ssh
when: is_python_apt_installed.stdout.find('python-apt') == -1