mirror of
https://github.com/ansible-collections/community.docker.git
synced 2025-12-17 04:18:42 +00:00
CI: improve Docker setup (#550)
* Cache has already been updated a few lines before.
* When skipping Docker cleanup, create flag to avoid the expensive part of the setup (including package manager cache update) to be run again.
(cherry picked from commit 134d32cae6)
This commit is contained in:
parent
40bef226c0
commit
e7aa5dcdec
@ -31,7 +31,6 @@
|
||||
apt:
|
||||
name: '{{ docker_packages if needs_docker_daemon else docker_cli_packages }}'
|
||||
state: present
|
||||
update_cache: true
|
||||
|
||||
always:
|
||||
- name: Restore /usr/sbin/policy-rc.d (if needed)
|
||||
|
||||
@ -10,6 +10,13 @@
|
||||
- name: Detect whether we are running inside a container
|
||||
current_container_facts:
|
||||
|
||||
- name: Look for marker whether Docker was already set up
|
||||
stat:
|
||||
path: /root/community.docker-docker-is-set-up
|
||||
register: docker_setup_marker
|
||||
|
||||
- when: not docker_setup_marker.stat.exists
|
||||
block:
|
||||
- name: Determine whether Docker Daemon needs to be installed
|
||||
set_fact:
|
||||
needs_docker_daemon: '{{ not ansible_module_running_in_container }}'
|
||||
@ -39,6 +46,18 @@
|
||||
paths:
|
||||
- "{{ role_path }}/tasks"
|
||||
|
||||
- name: Make sure that docker is running
|
||||
service:
|
||||
name: docker
|
||||
state: started
|
||||
when: not ansible_module_running_in_container
|
||||
|
||||
- name: Set marker that Docker was already set up
|
||||
file:
|
||||
path: /root/community.docker-docker-is-set-up
|
||||
state: touch
|
||||
when: docker_skip_cleanup
|
||||
|
||||
# Detect docker API version
|
||||
- name: Check Docker API version
|
||||
command: "docker version -f {% raw %}'{{(index .Server.Components 0).Details.ApiVersion}}'{% endraw %}"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user