From 3b0a72edfcdd8b9ab5110bd12f3ccbfa96f48e62 Mon Sep 17 00:00:00 2001 From: Teodoro Cook Date: Wed, 8 Nov 2023 10:51:46 -0600 Subject: [PATCH] Split service task into separate file (#6) --- meta/main.yml | 4 +--- molecule/7x/molecule.yml | 2 +- molecule/8x/molecule.yml | 2 +- tasks/main.yml | 12 +++++++----- tasks/service.yml | 6 ++++++ 5 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 tasks/service.yml diff --git a/meta/main.yml b/meta/main.yml index 2d8abf4..dace1be 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -17,6 +17,4 @@ galaxy_info: - all galaxy_tags: ['heartbeat'] -dependencies: - - name: nephelaiio.elastic_repo - when: heartbeat_repo_manage +dependencies: [] diff --git a/molecule/7x/molecule.yml b/molecule/7x/molecule.yml index 6e87c11..f695e23 100644 --- a/molecule/7x/molecule.yml +++ b/molecule/7x/molecule.yml @@ -4,7 +4,7 @@ dependency: driver: name: docker platforms: - - name: instance + - name: heartbeat-7x image: "geerlingguy/docker-${MOLECULE_DOCKER_IMAGE:-ubuntu2004}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} cgroupns_mode: host diff --git a/molecule/8x/molecule.yml b/molecule/8x/molecule.yml index f446e4f..f78b3ea 100644 --- a/molecule/8x/molecule.yml +++ b/molecule/8x/molecule.yml @@ -4,7 +4,7 @@ dependency: driver: name: docker platforms: - - name: instance + - name: heartbeat-8x image: "geerlingguy/docker-${MOLECULE_DOCKER_IMAGE:-ubuntu2004}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} cgroupns_mode: host diff --git a/tasks/main.yml b/tasks/main.yml index be47b03..3f71b0b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,4 +1,9 @@ --- +- name: Configure elastic repository + ansible.builtin.include_role: + name: nephelaiio.elastic_repo + when: heartbeat_repo_manage + - name: Collect package facts ansible.builtin.package_facts: manager: auto @@ -75,8 +80,5 @@ notify: heartbeat_restart when: heartbeat_conf_manage - - name: Manage heartbeat services - ansible.builtin.service: - name: "{{ heartbeat_service_name }}" - state: "{{ heartbeat_service_status }}" - enabled: "{{ heartbeat_service_enabled }}" + - name: Include service tasks + ansible.builtin.include_tasks: service.yml diff --git a/tasks/service.yml b/tasks/service.yml new file mode 100644 index 0000000..4fc1d04 --- /dev/null +++ b/tasks/service.yml @@ -0,0 +1,6 @@ +--- +- name: Manage heartbeat services + ansible.builtin.service: + name: "{{ heartbeat_service_name }}" + state: "{{ heartbeat_service_status }}" + enabled: "{{ heartbeat_service_enabled }}"