--- - name: check user privilege include_role: name: utils/check-sudoer-privilege - name: ansible version set_fact: supported_ansible_version: "2.11.12" minimal_mem: "{{ 1 if lookup('env','IGNORE_ALL_CHECKS') == 'true' or enable_lbagent else 6 }}" minimal_cpu: "{{ 1 if lookup('env','IGNORE_ALL_CHECKS') == 'true' or enable_lbagent else 4 }}" - name: debug debug: msg: "minimal_mem: {{minimal_mem}} minimal_cpu: {{minimal_cpu}}" - block: - name: test ansible version expecting {{ supported_ansible_version }}, got {{ ansible_version.full }} fail: msg: "Expected ansible version: {{supported_ansible_version}}. Current ansible version is {{ ansible_version.full }}. Please uninstall the old ansible `yum remove -y ansible` or `pip uninstall ansible`, and install the latest ansible as root: `yum install -y python3-pip; python3 -m pip install --upgrade pip setuptools wheel; python3 -m pip install --upgrade ansible`" - meta: end_play when: ansible_version.full is version(supported_ansible_version, '<') - block: - name: print hostname msg fail: msg: "Host name can not contain 'localhost'!" - meta: end_play when: ansible_hostname | regex_search('^localhost', ignorecase=True) - block: - name: set fact if ignore resource check set_fact: ignore_check: "{{ lookup('env', 'IGNORE_ALL_CHECKS') | default('false') | lower}}" - name: Check Minimum Hardware Requirements assert: that: - ansible_processor_vcpus >= minimal_cpu | int - (ansible_memtotal_mb / 1024 +0.5) | round(1) | int >= minimal_mem | int msg: | cpu: got {{ ansible_processor_vcpus }} (req: {{minimal_cpu}} cores) mem: got {{(ansible_memtotal_mb / 1024 +0.5) | round(1) | int}}GB (req: {{minimal_mem}}GB) you may export IGNORE_ALL_CHECKS=true in test environment to ignore resource check. when: - ignore_check != True - name: check if os/ver is supported include_tasks: os.yml - name: Get SELinux status shell: | setenforce 0 getenforce become: yes register: selinux_status failed_when: false args: executable: /bin/bash - name: Warning for SELinux fail: msg: "Please disable selinux and reboot the OS before deploying centos. " when: - selinux_status.stdout == 'Enforcing'