diff --git a/molecule/default/create.yml b/molecule/default/create.yml index a427a46..67a7107 100644 --- a/molecule/default/create.yml +++ b/molecule/default/create.yml @@ -47,6 +47,10 @@ loop_control: label: "{{ item.name }}" + - name: Show molecule inventory + ansible.builtin.debug: + msg: "{{ molecule_inventory }}" + - name: Dump molecule_inventory ansible.builtin.copy: content: | @@ -77,3 +81,30 @@ - name: Display uname info ansible.builtin.debug: msg: "{{ result.stdout }}" + + +# Prepare DinD +- name: Prepare DinD + hosts: molecule + gather_facts: true + tasks: + - name: Update apt + ansible.builtin.apt: + update_cache: yes + cache_valid_time: 600 + when: "ansible_facts.os_family == 'Debian'" + + - name: Install python dependencies + ansible.builtin.pip: + name: + - requests + - docker + - docker-compose + - ansible + + - name: Install docker + vars: + docker_service_manage: false + ansible.builtin.include_role: + name: "geerlingguy.docker" + diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index a2259e6..8e90c01 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -5,5 +5,18 @@ dependency: requirements-file: molecule/default/requirements.yml platforms: - name: molecule-ubuntu - image: ubuntu:18.04 + image: geerlingguy/docker-ubuntu1804-ansible:latest + privileged: true + pre_build_image: true + capabilities: + - SYS_ADMIN + tmpfs: + - /tmp + - /run + - /run/lock + volumes: + - '/sys/fs/cgroup:/sys/fs/cgroup:ro' + - '/var/run/docker.sock:/tmp/docker_mounted.sock' + command: 'lib/systemd/systemd' + stop_signal: 'RTMIN+3' diff --git a/molecule/default/requirements.yml b/molecule/default/requirements.yml index 84c1ae6..00d3702 100644 --- a/molecule/default/requirements.yml +++ b/molecule/default/requirements.yml @@ -1,2 +1,5 @@ collections: - - community.docker \ No newline at end of file + - community.docker + +roles: + - name: geerlingguy.docker \ No newline at end of file