From 5829f66490947e54879d84daff236731f058c2c1 Mon Sep 17 00:00:00 2001 From: Laur Ivan Date: Thu, 22 Sep 2022 11:22:20 +0200 Subject: [PATCH] Specific image name for testing. --- molecule/default/destroy.yml | 2 +- molecule/default/molecule.yml | 2 +- molecule/default/prepare.yml | 11 ++++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/molecule/default/destroy.yml b/molecule/default/destroy.yml index b408e02..fa31644 100644 --- a/molecule/default/destroy.yml +++ b/molecule/default/destroy.yml @@ -8,7 +8,7 @@ # Developer must implement. - name: Remove the docker image community.docker.docker_container: - name: instance + name: instance-plausible state: absent # Mandatory configuration for Molecule to function. diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index e3697e9..99488f6 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -10,7 +10,7 @@ dependency: driver: name: docker platforms: - - name: instance + - name: instance-plausible image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml index cf724d9..5bdc7c1 100644 --- a/molecule/default/prepare.yml +++ b/molecule/default/prepare.yml @@ -1,15 +1,24 @@ --- - name: Setup the test machine - hosts: instance + hosts: instance-plausible tasks: + - name: Check if /var/run/docker.sock already exists + ansible.builtin.stat: + path: "/var/run/docker.sock" + register: docker_sock_stat + - name: Create docker.sock raw: touch /var/run/docker.sock become: true changed_when: false + when: not docker_sock_stat.stat.exists + - name: Move docker.sock from tmp raw: mount --move /tmp/docker_mounted.sock /var/run/docker.sock become: true changed_when: false + when: not docker_sock_stat.stat.exists + - name: Update apt cache. apt: update_cache=yes cache_valid_time=600 when: ansible_os_family == 'Debian'