Skip to content
Snippets Groups Projects
Verified Commit 035f1901 authored by Chris Croome's avatar Chris Croome
Browse files

Fix usage example and ensure that systemd_unit is defined

parent 3210084e
No related branches found
No related tags found
No related merge requests found
Pipeline #26851 passed
...@@ -165,7 +165,7 @@ conf: ...@@ -165,7 +165,7 @@ conf:
Network: Network:
Address: Address:
- 192.168.0.2/24 - 192.168.0.2/24
- 192.168.0.3/24 - 192.168.0.3/24
``` ```
The list items are are converted into duplicated keys: The list items are are converted into duplicated keys:
...@@ -230,8 +230,12 @@ This role can be included in another role along these lines (this has been based ...@@ -230,8 +230,12 @@ This role can be included in another role along these lines (this has been based
ansible.builtin.include_role: ansible.builtin.include_role:
name: systemd name: systemd
tasks_from: unit_present.yml tasks_from: unit_present.yml
loop: "{{ docker_systemd_units }}"
loop_control:
loop_var: systemd_unit
label: "{{ systemd_unit.name }}"
vars: vars:
systemd_units: docker_systemd_units:
- name: docker-compose - name: docker-compose
state: enabled state: enabled
files: files:
......
...@@ -94,7 +94,7 @@ argument_specs: ...@@ -94,7 +94,7 @@ argument_specs:
options: options:
systemd_unit: systemd_unit:
type: dict type: dict
required: false required: true
description: A single systemd unit. description: A single systemd unit.
options: options:
files: files:
......
...@@ -20,6 +20,11 @@ ...@@ -20,6 +20,11 @@
var: systemd_unit var: systemd_unit
verbosity: 2 verbosity: 2
- name: The systemd_unit variable needs to be defined
ansible.builtin.assert:
that:
- systemd_unit is defined
- name: Include the package install tasks when defined - name: Include the package install tasks when defined
ansible.builtin.include_tasks: pkg_present.yml ansible.builtin.include_tasks: pkg_present.yml
loop: "{{ systemd_unit.pkgs }}" loop: "{{ systemd_unit.pkgs }}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment