diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index 206c2c5..510b494 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -1,7 +1,7 @@ # run compose task? core_docker_compose: false -# the docker compose service's name +# the docker compose service's name (cosmetic) core_docker_compose_name: "Docker Compose" # create directories @@ -10,7 +10,7 @@ core_docker_compose_mkdir: false core_docker_compose_dirs_mode: '0750' # copy templates -core_docker_compose_cp_files: false +core_docker_compose_cp_templates: false # chown templates with this value core_docker_compose_templates_mode: '0650' @@ -19,4 +19,12 @@ core_docker_compose_mode: '0650' # docker-compose.yml template source core_docker_compose_file: - src: docker-compose.yml.j2 \ No newline at end of file + src: docker-compose.yml.j2 + +# compose users +core_docker_compose_dirs_user: "{{ core_docker_compose_user }}" +core_docker_compose_dirs_group: "{{ core_docker_compose_group }}" +core_docker_compose_template_user: "{{ core_docker_compose_user }}" +core_docker_compose_template_group: "{{ core_docker_compose_group }}" +core_docker_compose_compose_user: "{{ core_docker_compose_user }}" +core_docker_compose_compose_group: "{{ core_docker_compose_group }}" diff --git a/roles/docker/tasks/core-compose.yml b/roles/docker/tasks/core-compose.yml index ab181d0..7c2da32 100644 --- a/roles/docker/tasks/core-compose.yml +++ b/roles/docker/tasks/core-compose.yml @@ -4,8 +4,8 @@ ansible.builtin.file: path: '{{ core_docker_compose_dirs_loop }}' state: directory - owner: '{{ core_docker_compose_user }}' - group: '{{ core_docker_compose_group }}' + owner: '{{ core_docker_compose_dirs_user }}' + group: '{{ core_docker_compose_dirs_group }}' mode: "{{ core_docker_compose_dirs_mode }}" loop: '{{ core_docker_compose_dirs }}' loop_control: @@ -16,13 +16,13 @@ ansible.builtin.template: src: '{{ core_docker_compose_template_loop.src }}' dest: '{{ core_docker_compose_template_loop.dest }}' - owner: '{{ core_docker_compose_user }}' - group: '{{ core_docker_compose_group }}' + owner: '{{ core_docker_compose_template_user }}' + group: '{{ core_docker_compose_template_group }}' mode: '{{ core_docker_compose_templates_mode }}' loop: '{{ core_docker_compose_templates }}' loop_control: loop_var: '{{ core_docker_compose_template_loop }}' - when: core_docker_compose_cp_files + when: core_docker_compose_cp_templates - name: "Create docker-compose.yml for {{ core_docker_compose_name }}" ansible.builtin.template: