ansible-role-arrs/molecule/default/prepare.yml

39 lines
1.0 KiB
YAML
Raw Permalink Normal View History

2022-09-27 12:32:48 +02:00
---
- name: Setup the test machine
hosts: instance-arrs
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
2022-12-11 22:25:04 +01:00
ansible.builtin.raw: touch /var/run/docker.sock
2022-09-27 12:32:48 +02:00
become: true
changed_when: false
when: not docker_sock_stat.stat.exists
- name: Move docker.sock from tmp
2022-12-11 22:39:17 +01:00
ansible.builtin.raw: >
mount --move /tmp/docker_mounted.sock /var/run/docker.sock
2022-09-27 12:32:48 +02:00
become: true
changed_when: false
when: not docker_sock_stat.stat.exists
2022-12-11 22:39:17 +01:00
2022-09-27 12:32:48 +02:00
- name: Update apt cache.
2022-12-11 22:25:04 +01:00
ansible.builtin.apt: update_cache=yes cache_valid_time=600
2022-09-27 12:32:48 +02:00
when: ansible_os_family == 'Debian'
2022-12-11 22:25:04 +01:00
2022-09-27 12:32:48 +02:00
- name: Install python requests
2022-12-11 22:25:04 +01:00
ansible.builtin.pip:
2022-12-11 22:39:17 +01:00
name:
2022-09-27 12:32:48 +02:00
- requests
- docker
- docker-compose
2022-12-11 22:25:04 +01:00
2022-09-27 12:32:48 +02:00
- name: Install docker
vars:
docker_service_manage: false
2022-12-11 22:25:04 +01:00
ansible.builtin.include_role:
2022-09-27 12:32:48 +02:00
name: geerlingguy.docker