Add basic docker_compose tests (#150)

* Add basic docker_compose tests.

* Add more constraints for Py 2.

* Try to install docker-compose from system packages.

* Another try.

* Some more tries.

* One more.

* Move task into block.

* Clean up constraints file.

* More adjustments.

* TEMP: add debug output
This commit is contained in:
Felix Fontein
2021-06-07 06:42:31 +02:00
committed by GitHub
parent 2bf67b5a2a
commit 4d0637e178
25 changed files with 270 additions and 43 deletions
@@ -0,0 +1,6 @@
---
skip_docker_compose: false
docker_compose_packages:
- docker-compose
docker_compose_pip_packages:
- docker-compose
@@ -0,0 +1,3 @@
dependencies:
- setup_docker
- setup_remote_constraints
@@ -0,0 +1,5 @@
---
- name: Install docker-compose as system package
apt:
name: "{{ docker_compose_packages }}"
state: present
@@ -0,0 +1,6 @@
---
- name: Install docker-compose as system package
dnf:
name: "{{ docker_compose_packages }}"
state: present
enablerepo: docker-ce-test
@@ -0,0 +1,5 @@
---
- name: Install docker-compose as system package
yum:
name: "{{ docker_compose_packages }}"
state: present
@@ -0,0 +1,5 @@
---
- name: Install docker-compose as system package
dnf:
name: "{{ docker_compose_packages }}"
state: present
@@ -0,0 +1,8 @@
---
- name: Install docker-compose as system package
community.general.zypper:
name: "{{ docker_compose_packages }}"
force: yes
disable_gpg_check: yes
update_cache: yes
notify: cleanup docker
@@ -0,0 +1,12 @@
---
####################################################################
# WARNING: These are designed specifically for Ansible tests #
# and should not be used as examples of how to write Ansible roles #
####################################################################
- set_fact:
has_docker_compose: false
- when: ansible_facts.distribution ~ ansible_facts.distribution_major_version not in ['CentOS6', 'RedHat6']
include_tasks:
file: setup.yml
@@ -0,0 +1,46 @@
---
- name: Include distribution specific variables
include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_major_version }}-py{{ ansible_python.version.major }}.yml"
- "{{ ansible_facts.os_family }}-{{ ansible_facts.distribution_major_version }}-py{{ ansible_python.version.major }}.yml"
- "{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_major_version }}.yml"
- "{{ ansible_facts.os_family }}-{{ ansible_facts.distribution_major_version }}.yml"
- "{{ ansible_facts.distribution }}-py{{ ansible_python.version.major }}.yml"
- "{{ ansible_facts.os_family }}-py{{ ansible_python.version.major }}.yml"
- "{{ ansible_facts.distribution }}.yml"
- "{{ ansible_facts.os_family }}.yml"
- default.yml
paths:
- "{{ role_path }}/vars"
- block:
- name: Include distribution specific tasks
include_tasks: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_major_version }}-py{{ ansible_python.version.major }}.yml"
- "{{ ansible_facts.os_family }}-{{ ansible_facts.distribution_major_version }}-py{{ ansible_python.version.major }}.yml"
- "{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_major_version }}.yml"
- "{{ ansible_facts.os_family }}-{{ ansible_facts.distribution_major_version }}.yml"
- "{{ ansible_facts.distribution }}-py{{ ansible_python.version.major }}.yml"
- "{{ ansible_facts.os_family }}-py{{ ansible_python.version.major }}.yml"
- "{{ ansible_facts.distribution }}.yml"
- "{{ ansible_facts.os_family }}.yml"
paths:
- "{{ role_path }}/tasks"
- name: Install docker-compose
pip:
state: present
name: "{{ docker_compose_pip_packages }}"
extra_args: "-c {{ remote_constraints }}"
- name: Declare docker-compose as existing
set_fact:
has_docker_compose: true
when: not skip_docker_compose
@@ -0,0 +1,2 @@
---
skip_docker_compose: true
@@ -0,0 +1,2 @@
---
skip_docker_compose: true
@@ -0,0 +1,2 @@
---
docker_compose_packages: []
@@ -0,0 +1,2 @@
---
skip_docker_compose: true
@@ -0,0 +1,2 @@
---
docker_compose_pip_packages: []
@@ -0,0 +1,2 @@
---
skip_docker_compose: true
@@ -0,0 +1,2 @@
---
skip_docker_compose: true
@@ -0,0 +1,2 @@
---
docker_compose_pip_packages: []
@@ -0,0 +1 @@
---