docker_systemd_service/tasks/install.yml
Bertrand Lanson cbde72a17f
Some checks failed
test / Retrieve Credentials (pull_request) Successful in 2s
development / Check commit compliance (push) Successful in 4s
pull-requests-open / Check commit compliance (pull_request) Successful in 5s
test / end_to_end_role (default, debian11) (pull_request) Failing after 30s
test / end_to_end_role (default, debian12) (pull_request) Failing after 31s
test / end_to_end_role (default, ubuntu2004) (pull_request) Failing after 30s
test / end_to_end_role (default, ubuntu2204) (pull_request) Failing after 56s
test / end_to_end_role (with_custom_flags, debian11) (pull_request) Failing after 56s
test / end_to_end_role (default, ubuntu2404) (pull_request) Failing after 56s
test / end_to_end_role (with_custom_flags, debian12) (pull_request) Failing after 30s
test / end_to_end_role (with_custom_flags, ubuntu2004) (pull_request) Failing after 30s
test / end_to_end_role (with_custom_flags, ubuntu2204) (pull_request) Failing after 30s
test / end_to_end_role (with_custom_flags, ubuntu2404) (pull_request) Failing after 30s
fix: typo in install.yml file
2024-11-09 11:08:56 +01:00

46 lines
1.7 KiB
YAML

---
# task/install file for docker_systemd_service
- name: "Docker systemd service | Create ENV file(s) for docker service(s)"
ansible.builtin.template:
src: env.j2
dest: "{{ docker_systemd_service_sysconf_dir }}/{{ docker_systemd_service_container_name }}"
owner: root
group: root
mode: '0600'
register: _docker_systemd_service_env_file
- name: "Docker systemd service | Pull docker image(s)"
community.docker.docker_image:
name: "{{ docker_systemd_service_image }}"
force_source: "{{ docker_systemd_service_container_pull_force_source | bool }}"
source: pull
register: _docker_systemd_service_image_pull
when: docker_systemd_service_container_pull_image
- name: "Docker systemd service | Create unit file(s) for service(s)"
ansible.builtin.template:
src: unit.j2
dest: "/etc/systemd/system/{{ docker_systemd_service_name }}.service"
owner: root
group: root
mode: '0644'
register: _docker_systemd_service_unit_file
- name: "Docker systemd service | Set reload-check & restart-check variable"
ansible.builtin.set_fact:
_docker_systemd_service_need_daemon_reload: >-
{{ _docker_systemd_service_unit_file.changed | bool }}
_docker_systemd_service_need_restart: true
when: _docker_systemd_service_env_file.changed or
_docker_systemd_service_unit_file.changed or
docker_systemd_service_container_pull_image.changed
- name: "Docker systemd service | Enable and start service(s)"
ansible.builtin.systemd:
name: '{{ docker_systemd_service_name }}.service'
daemon_reload: true
enabled: "{{ docker_systemd_service_enabled }}"
masked: "{{ docker_systemd_service_masked }}"
state: "{{ docker_systemd_service_state }}"
register: _enable_and_start