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

test fis unit state

parent f4125daf
No related branches found
No related tags found
No related merge requests found
Pipeline #33587 failed
...@@ -119,17 +119,26 @@ ...@@ -119,17 +119,26 @@
( (systemd_service_facts | community.general.json_query(systemd_service_jpq)).status == "enabled" ) or ( (systemd_service_facts | community.general.json_query(systemd_service_jpq)).status == "enabled" ) or
( (systemd_service_facts | community.general.json_query(systemd_service_jpq)).state == "running" ) ( (systemd_service_facts | community.general.json_query(systemd_service_jpq)).state == "running" )
- name: Unit enabled and started - name: Systemd unit enabled
ansible.builtin.systemd: ansible.builtin.systemd:
name: "{{ systemd_unit.name }}" name: "{{ systemd_unit.name }}"
enabled: true enabled: true
vars:
systemd_service_jpq: 'ansible_facts.services.["{{ systemd_unit.name }}.service"]|[0]'
when: >-
( ( systemd_unit.state is not defined ) or
( systemd_unit.state == "enabled" ) ) and
( ( (systemd_service_facts | community.general.json_query(systemd_service_jpq)).status != "enabled" )
- name: Systemd unit started
ansible.builtin.systemd:
name: "{{ systemd_unit.name }}"
state: started state: started
vars: vars:
systemd_service_jpq: 'ansible_facts.services.["{{ systemd_unit.name }}.service"]|[0]' systemd_service_jpq: 'ansible_facts.services.["{{ systemd_unit.name }}.service"]|[0]'
when: >- when: >-
( ( systemd_unit.state is not defined ) or ( ( systemd_unit.state is not defined ) or
( systemd_unit.state == "enabled" ) ) and ( systemd_unit.state == "enabled" ) ) and
( ( (systemd_service_facts | community.general.json_query(systemd_service_jpq)).status != "enabled" ) or
( (systemd_service_facts | community.general.json_query(systemd_service_jpq)).state != "running" ) ) ( (systemd_service_facts | community.general.json_query(systemd_service_jpq)).state != "running" ) )
- name: Systemd unit restarted - name: Systemd unit restarted
......
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