github.com/weaveworks/common@v0.0.0-20230728070032-dd9e68f319d5/tools/config_management/roles/setup-ansible/pre_tasks/main.yml (about)

     1  ---
     2  # Set machine up to be able to run ansible playbooks.
     3  
     4  - name: check if python is installed (as required by ansible modules)
     5    raw: test -e /usr/bin/python
     6    register: is_python_installed
     7    failed_when: is_python_installed.rc not in [0, 1]
     8    changed_when: false  # never mutates state.
     9  
    10  - name: install python if missing (as required by ansible modules)
    11    when: is_python_installed|failed  # skip otherwise
    12    raw: (test -e /usr/bin/apt-get && apt-get install -y python-minimal) || (test -e /usr/bin/yum && yum install -y python)
    13    changed_when: is_python_installed.rc == 1
    14  
    15  - name: check if lsb_release is installed (as required for ansible facts)
    16    raw: test -e /usr/bin/lsb_release
    17    register: is_lsb_release_installed
    18    failed_when: is_lsb_release_installed.rc not in [0, 1]
    19    changed_when: false  # never mutates state.
    20  
    21  - name: install lsb_release if missing (as required for ansible facts)
    22    when: is_lsb_release_installed|failed  # skip otherwise
    23    raw: (test -e /usr/bin/apt-get && apt-get install -y lsb_release) || (test -e /usr/bin/yum && yum install -y lsb_release)
    24    changed_when: is_lsb_release_installed.rc == 1
    25  
    26  - setup:  # gather 'facts', i.e. compensates for the above 'gather_facts: false'.