Skip to content

Commit

Permalink
Merge pull request #176 from konstruktoid/issue175
Browse files Browse the repository at this point in the history
Extend docker compose tasks and verification
  • Loading branch information
konstruktoid authored Jul 7, 2023
2 parents efed463 + 082260f commit b92c25d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 13 deletions.
14 changes: 7 additions & 7 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,24 @@ provisioner:
docker_user: bullseyeuser
docker_user_bashrc: false
docker_compose: false
arctic:
almalinux8:
docker_add_alias: false
docker_allow_ping: false
docker_allow_privileged_ports: true
docker_rootful: false
docker_rootful_enabled: false
docker_user: dockeruser
docker_user_bashrc: true
docker_compose: true
emeraldroot:
docker_compose: false
almalinux9:
docker_add_alias: false
docker_allow_ping: false
docker_allow_privileged_ports: false
docker_rootful: true
docker_rootful_enabled: true
docker_rootful_enabled: false
docker_user: dockeruser
docker_user_bashrc: false
docker_compose: false
docker_compose: true
focal:
docker_add_alias: true
docker_allow_ping: false
Expand Down Expand Up @@ -102,7 +102,7 @@ platforms:
instance_raw_config_args:
- 'vbguest.auto_update = false'
memory: 1024
- name: arctic
- name: almalinux8
box: "almalinux/8"
config_options:
vm.boot_timeout: 600
Expand All @@ -111,7 +111,7 @@ platforms:
instance_raw_config_args:
- 'vbguest.auto_update = false'
memory: 1024
- name: emeraldroot
- name: almalinux9
box: "almalinux/9"
config_options:
vm.boot_timeout: 600
Expand Down
24 changes: 23 additions & 1 deletion molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,36 @@
failed_when: not bash_comp_docker.stat.exists

- name: Docker-compose verification
when: docker_compose
block:
- name: Stat Docker user .bash_completion.d/docker-compose
become: true
ansible.builtin.stat:
path: "{{ docker_user_info.home }}/.bash_completion.d/docker-compose"
register: bash_comp_docker_compose
failed_when: not bash_comp_docker_compose.stat.exists
when: docker_compose and docker_user_bashrc

- name: Verify Docker compose plugin is installed
become: true
become_user: "{{ docker_user }}"
ansible.builtin.command:
cmd: docker compose version
register: docker_compose_plugin
changed_when: false
failed_when: docker_compose_plugin.rc != 0
when: docker_rootful and docker_compose

- name: Verify that docker-compose is installed
become: true
become_user: "{{ docker_user }}"
environment:
PATH: "{{ docker_user_info.home }}/bin:{{ docker_user_info.home }}/.local/bin"
ansible.builtin.command:
cmd: docker-compose version
register: docker_compose_version
changed_when: false
failed_when: docker_compose_version.rc != 0
when: not docker_rootful and docker_compose

- name: Container verification block
environment:
Expand Down
17 changes: 12 additions & 5 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,20 @@
ansible.builtin.include_tasks: docker_install_rootless.yml
when: not docker_rootful

- name: Ensure that docker-compose python pip package is installed
ansible.builtin.pip:
name: docker-compose
executable: pip3
- name: Install docker compose
become: true
become_user: "{{ docker_user }}"
when: docker_compose and ansible_os_family == "Debian"
when: docker_compose
block:
- name: Install setuptools-rust due to dependencies
ansible.builtin.pip:
name: setuptools-rust
executable: pip3

- name: Install the Docker compose python pip package
ansible.builtin.pip:
name: docker-compose
executable: pip3

- name: Add user sudo alias
vars:
Expand Down

0 comments on commit b92c25d

Please sign in to comment.