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

39 lines
1.1 KiB
YAML
Raw Permalink Normal View History

2023-04-28 00:32:36 +02:00
---
2023-04-29 20:48:33 +02:00
- name: "Setup the test machine"
hosts: "sonarqube"
2023-04-28 00:32:36 +02:00
tasks:
2023-04-29 20:48:33 +02:00
- name: "Check if /var/run/docker.sock already exists"
2023-04-28 00:32:36 +02:00
ansible.builtin.stat:
path: "/var/run/docker.sock"
2023-04-29 20:48:33 +02:00
register: "docker_sock_stat"
2023-04-28 00:32:36 +02:00
2023-04-29 20:48:33 +02:00
- name: "Create docker.sock"
2023-04-29 20:51:04 +02:00
ansible.builtin.raw: "touch /var/run/docker.sock"
2023-04-28 00:32:36 +02:00
become: true
changed_when: false
2023-04-29 20:48:33 +02:00
when: "not docker_sock_stat.stat.exists"
2023-04-28 00:32:36 +02:00
2023-04-29 20:48:33 +02:00
- name: "Move docker.sock from tmp"
2023-04-28 00:32:36 +02:00
ansible.builtin.raw: >
mount --move /tmp/docker_mounted.sock /var/run/docker.sock
become: true
changed_when: false
2023-04-29 20:48:33 +02:00
when: "not docker_sock_stat.stat.exists"
2023-04-28 00:32:36 +02:00
2023-04-29 20:48:33 +02:00
- name: "Update apt cache."
2023-04-29 20:51:04 +02:00
ansible.builtin.apt: "update_cache=yes cache_valid_time=600"
2023-04-29 20:48:33 +02:00
when: "ansible_os_family == 'Debian'"
2023-04-28 00:32:36 +02:00
2023-04-29 20:48:33 +02:00
- name: "Install python requests"
2023-04-28 00:32:36 +02:00
ansible.builtin.pip:
name:
2023-04-29 20:48:33 +02:00
- "requests"
- "docker"
- "docker-compose"
2023-04-28 00:32:36 +02:00
2023-04-29 20:48:33 +02:00
- name: "Install docker"
2023-04-28 00:32:36 +02:00
vars:
docker_service_manage: false
ansible.builtin.include_role:
2023-04-29 20:48:33 +02:00
name: "geerlingguy.docker"