--- - name: Prepare hosts: localhost connection: local pre_tasks: - name: "Create MySQL Container" docker_container: name: "{{ item.name }}-db" image: mysql:8.0 state: started recreate: true networks: - name: zabbix env: MYSQL_ROOT_PASSWORD: changeme no_log: true with_items: "{{ molecule_yml.platforms }}" when: - '"mysql" in item.groups' - name: "Create postgresql Container" docker_container: name: "{{ item.name }}-db" image: postgres:13 state: started recreate: true networks: - name: zabbix env: POSTGRES_PASSWORD: changeme no_log: true with_items: "{{ molecule_yml.platforms }}" when: - '"pgsql" in item.groups' - name: Prepare hosts: all tasks: - name: "Set short version name" ansible.builtin.set_fact: zabbix_python_prefix: "python{% if ansible_python_version is version('3', '>=') %}3{% endif %}" - name: "Create group for imaginary host" add_host: name: imaginary-host groups: - mysql - postgresql changed_when: false - name: "Installing packages on CentOS" ansible.builtin.yum: name: - net-tools - which - sudo state: present register: installation_dependencies until: installation_dependencies is succeeded when: - ansible_os_family == 'RedHat' - name: Check if warn parameter can be used for shell module ansible.builtin.set_fact: produce_warn: False when: ansible_version.full is version("2.14", "<") - name: "Apt update" ansible.builtin.shell: "apt-get update && echo exit 0 > /usr/sbin/policy-rc.d" args: warn: "{{ produce_warn | default(omit) }}" register: installation_dependencies until: installation_dependencies is succeeded when: - ansible_os_family != 'RedHat' - name: "Installing packages on NON-CentOS" ansible.builtin.apt: name: - net-tools - apt-utils - "{{ zabbix_python_prefix }}-pip" - gpg-agent - sudo - doc-base update_cache: true state: present register: installation_dependencies until: installation_dependencies is succeeded when: - ansible_os_family != 'RedHat' - name: "Configure SUDO." ansible.builtin.lineinfile: dest: /etc/sudoers line: "Defaults !requiretty" state: present