github.com/weaveworks/common@v0.0.0-20230728070032-dd9e68f319d5/tools/config_management/library/setup_ansible_dependencies.yml (about) 1 --- 2 ################################################################################ 3 # Install Ansible's dependencies: python and lsb_release, required respectively 4 # to run Ansible modules and gather Ansible facts. 5 # 6 # See also: 7 # - http://docs.ansible.com/ansible/intro_installation.html#managed-node-requirements 8 # - http://docs.ansible.com/ansible/setup_module.html 9 ################################################################################ 10 11 - name: check if python is installed (as required by ansible modules) 12 raw: test -e /usr/bin/python 13 register: is_python_installed 14 failed_when: is_python_installed.rc not in [0, 1] 15 changed_when: false # never mutates state. 16 17 - name: install python if missing (as required by ansible modules) 18 when: is_python_installed|failed # skip otherwise 19 raw: (test -e /usr/bin/apt-get && apt-get update && apt-get install -y python-minimal) || (test -e /usr/bin/yum && yum update && yum install -y python) 20 changed_when: is_python_installed.rc == 1 21 22 - name: check if lsb_release is installed (as required for ansible facts) 23 raw: test -e /usr/bin/lsb_release 24 register: is_lsb_release_installed 25 failed_when: is_lsb_release_installed.rc not in [0, 1] 26 changed_when: false # never mutates state. 27 28 - name: install lsb_release if missing (as required for ansible facts) 29 when: is_lsb_release_installed|failed # skip otherwise 30 raw: (test -e /usr/bin/apt-get && apt-get install -y lsb_release) || (test -e /usr/bin/yum && yum install -y redhat-lsb-core) 31 changed_when: is_lsb_release_installed.rc == 1 32 33 - setup: # gather 'facts', i.e. compensates for 'gather_facts: false' in calling playbook.