From 045a897307f95ccb7bdad28c30f78136eee4339d Mon Sep 17 00:00:00 2001 From: Teodoro Cook Date: Tue, 12 Dec 2023 16:07:53 -0600 Subject: [PATCH] Split user/logging tasks to separate task files (#22) * Split user/logging tasks to separate task files * Remove root package install from makefile --- Makefile | 2 +- tasks/logging.yml | 10 ++++++++++ tasks/main.yml | 29 +++++------------------------ tasks/users.yml | 12 ++++++++++++ 4 files changed, 28 insertions(+), 25 deletions(-) create mode 100644 tasks/logging.yml create mode 100644 tasks/users.yml diff --git a/Makefile b/Makefile index 002ae06..3636edf 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ test: lint poetry: @type poetry >/dev/null || pip3 install poetry - @poetry install + @poetry install --no-root lint: poetry poetry run yamllint . diff --git a/tasks/logging.yml b/tasks/logging.yml new file mode 100644 index 0000000..fc9896e --- /dev/null +++ b/tasks/logging.yml @@ -0,0 +1,10 @@ +--- +- name: Configure logging + ansible.builtin.copy: + dest: "{{ docker_log_conf_file }}" + content: "{{ docker_log_conf | to_nice_json(indent=2) }}" + group: root + owner: root + mode: 0644 + notify: restart docker service + when: docker_log_conf_manage diff --git a/tasks/main.yml b/tasks/main.yml index fb42340..a45e49c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -132,27 +132,8 @@ - name: Include service tasks ansible.builtin.include_tasks: service.yml - - name: Configure logging - ansible.builtin.copy: - dest: "{{ docker_log_conf_file }}" - content: "{{ docker_log_conf | to_nice_json(indent=2) }}" - group: root - owner: root - mode: 0644 - notify: restart docker service - when: docker_log_conf_manage - tags: configure - - - name: Manage docker groups - ansible.builtin.group: - name: "{{ docker_group }}" - when: docker_group_manage - tags: configure - - - name: Manage docker users - ansible.builtin.user: - append: true - groups: "{{ docker_group }}" - name: "{{ docker_user }}" - when: docker_user_manage - tags: configure +- name: Include logging tasks + ansible.builtin.include_tasks: logging.yml + +- name: Include user tasks + ansible.builtin.include_tasks: users.yml diff --git a/tasks/users.yml b/tasks/users.yml new file mode 100644 index 0000000..a86b6ea --- /dev/null +++ b/tasks/users.yml @@ -0,0 +1,12 @@ +--- +- name: Manage docker groups + ansible.builtin.group: + name: "{{ docker_group }}" + when: docker_group_manage + +- name: Manage docker users + ansible.builtin.user: + append: true + groups: "{{ docker_group }}" + name: "{{ docker_user }}" + when: docker_user_manage