Allow skipping of service management

This commit is contained in:
jwhb 2022-04-07 11:01:19 +02:00
parent 9b819a6c51
commit 83e2c066c1
4 changed files with 5 additions and 1 deletions

View File

@ -21,11 +21,12 @@ The `docker_edition` should be either `ce` (Community Edition) or `ee` (Enterpri
You can control whether the package is installed, uninstalled, or at the latest version by setting `docker_package_state` to `present`, `absent`, or `latest`, respectively. Note that the Docker daemon will be automatically restarted if the Docker package is updated. This is a side effect of flushing all handlers (running any of the handlers that have been notified by this and any other role up to this point in the play). You can control whether the package is installed, uninstalled, or at the latest version by setting `docker_package_state` to `present`, `absent`, or `latest`, respectively. Note that the Docker daemon will be automatically restarted if the Docker package is updated. This is a side effect of flushing all handlers (running any of the handlers that have been notified by this and any other role up to this point in the play).
docker_service_manage: true
docker_service_state: started docker_service_state: started
docker_service_enabled: true docker_service_enabled: true
docker_restart_handler_state: restarted docker_restart_handler_state: restarted
Variables to control the state of the `docker` service, and whether it should start on boot. If you're installing Docker inside a Docker container without systemd or sysvinit, you should set these to `stopped` and set the enabled variable to `no`. Variables to control the state of the `docker` service, and whether it should start on boot. If you're installing Docker inside a Docker container without systemd or sysvinit, you should set `docker_service_manage` to `false`.
docker_install_compose: true docker_install_compose: true
docker_compose_version: "1.26.0" docker_compose_version: "1.26.0"

View File

@ -5,6 +5,7 @@ docker_package: "docker-{{ docker_edition }}"
docker_package_state: present docker_package_state: present
# Service options. # Service options.
docker_service_manage: true
docker_service_state: started docker_service_state: started
docker_service_enabled: true docker_service_enabled: true
docker_restart_handler_state: restarted docker_restart_handler_state: restarted

View File

@ -2,3 +2,4 @@
- name: restart docker - name: restart docker
service: "name=docker state={{ docker_restart_handler_state }}" service: "name=docker state={{ docker_restart_handler_state }}"
ignore_errors: "{{ ansible_check_mode }}" ignore_errors: "{{ ansible_check_mode }}"
when: docker_service_manage | bool

View File

@ -43,6 +43,7 @@
state: "{{ docker_service_state }}" state: "{{ docker_service_state }}"
enabled: "{{ docker_service_enabled }}" enabled: "{{ docker_service_enabled }}"
ignore_errors: "{{ ansible_check_mode }}" ignore_errors: "{{ ansible_check_mode }}"
when: docker_service_manage | bool
- name: Ensure handlers are notified now to avoid firewall conflicts. - name: Ensure handlers are notified now to avoid firewall conflicts.
meta: flush_handlers meta: flush_handlers