Remove fail: tasks
Assume that the operator knows what they are doing. These tasks are skipped for every service which bumps up the number of tasks and runtime. Change-Id: I73f38d6b9cc897537053d810d5cdd61ed74671fb
This commit is contained in:
parent
326d88a3d3
commit
492031108e
@ -142,62 +142,6 @@
|
|||||||
tags:
|
tags:
|
||||||
- systemd-service
|
- systemd-service
|
||||||
|
|
||||||
- name: Check ExecStarts
|
|
||||||
fail:
|
|
||||||
msg: >-
|
|
||||||
When the service type is "simple" only ONE command can be started. Check
|
|
||||||
The list of execstarts and limit it to a single command per service or
|
|
||||||
consider using the "oneshot" service type. Defined ExecStart commands
|
|
||||||
"{{ item.execstarts }}".
|
|
||||||
when:
|
|
||||||
- item.execstarts is not string
|
|
||||||
- item.execstarts | length > 1
|
|
||||||
- item.service_type | default(systemd_default_service_type) != 'oneshot'
|
|
||||||
with_items: "{{ systemd_services }}"
|
|
||||||
tags:
|
|
||||||
- systemd-service
|
|
||||||
|
|
||||||
- name: Check ExecStops
|
|
||||||
fail:
|
|
||||||
msg: >-
|
|
||||||
When the service type is "simple" only ONE command can be stopped. Check
|
|
||||||
The list of execstops and limit it to a single command per service or
|
|
||||||
consider using the "oneshot" service type. Defined ExecStop commands
|
|
||||||
"{{ item.execstops }}".
|
|
||||||
when:
|
|
||||||
- item.execstops is not string
|
|
||||||
- item.execstops | default([]) | length > 1
|
|
||||||
- item.service_type | default(systemd_default_service_type) != 'oneshot'
|
|
||||||
with_items: "{{ systemd_services }}"
|
|
||||||
tags:
|
|
||||||
- systemd-service
|
|
||||||
|
|
||||||
- name: Check ExecReloads
|
|
||||||
fail:
|
|
||||||
msg: >-
|
|
||||||
When the service type is "simple" only ONE command can be reloaded. Check
|
|
||||||
The list of execreloads and limit it to a single command per service or
|
|
||||||
consider using the "oneshot" service type. Defined ExecStop commands
|
|
||||||
"{{ item.execreloads }}".
|
|
||||||
when:
|
|
||||||
- item.execreloads is not string
|
|
||||||
- item.execreloads | default([]) | length > 1
|
|
||||||
- item.service_type | default(systemd_default_service_type) != 'oneshot'
|
|
||||||
with_items: "{{ systemd_services }}"
|
|
||||||
tags:
|
|
||||||
- systemd-service
|
|
||||||
|
|
||||||
- name: Check timers
|
|
||||||
fail:
|
|
||||||
msg: >-
|
|
||||||
When using systemd timers the "state" must be defined under the timer key.
|
|
||||||
when:
|
|
||||||
- item.timer is defined
|
|
||||||
- item.timer.state is undefined
|
|
||||||
with_items: "{{ systemd_services }}"
|
|
||||||
tags:
|
|
||||||
- systemd-service
|
|
||||||
|
|
||||||
- name: Place the systemd service
|
- name: Place the systemd service
|
||||||
config_template:
|
config_template:
|
||||||
src: "systemd-service.j2"
|
src: "systemd-service.j2"
|
||||||
|
@ -173,72 +173,6 @@
|
|||||||
tags:
|
tags:
|
||||||
- skip_ansible_lint
|
- skip_ansible_lint
|
||||||
|
|
||||||
- name: Test failure condition
|
|
||||||
block:
|
|
||||||
- name: Run the systemd service role
|
|
||||||
include_role:
|
|
||||||
name: systemd_service
|
|
||||||
vars:
|
|
||||||
systemd_services:
|
|
||||||
- service_name: "test simple service1"
|
|
||||||
execstarts:
|
|
||||||
- "/bin/bash -c 'while true; do sleep 2 && echo test simple service1; done'"
|
|
||||||
- "/bin/bash -c 'while true; do sleep 2 && echo test simple service2; done'"
|
|
||||||
rescue:
|
|
||||||
- name: Set negative service test pass fact
|
|
||||||
set_fact:
|
|
||||||
systemd_service_execstarts_test: true
|
|
||||||
|
|
||||||
- name: Test failure condition
|
|
||||||
block:
|
|
||||||
- name: Run the systemd service role
|
|
||||||
include_role:
|
|
||||||
name: systemd_service
|
|
||||||
vars:
|
|
||||||
systemd_services:
|
|
||||||
- service_name: "test simple service2"
|
|
||||||
execstarts: "/bin/bash -c 'while true; do sleep 2 && echo test simple service; done'"
|
|
||||||
execstops:
|
|
||||||
- /bin/true
|
|
||||||
- /bin/true
|
|
||||||
rescue:
|
|
||||||
- name: Set negative service test pass fact
|
|
||||||
set_fact:
|
|
||||||
systemd_service_execstops_test: true
|
|
||||||
|
|
||||||
- name: Test failure condition
|
|
||||||
block:
|
|
||||||
- name: Run the systemd service role
|
|
||||||
include_role:
|
|
||||||
name: systemd_service
|
|
||||||
vars:
|
|
||||||
systemd_services:
|
|
||||||
- service_name: "test simple service3"
|
|
||||||
execstarts: "/bin/true"
|
|
||||||
execreloads:
|
|
||||||
- /bin/true
|
|
||||||
- /bin/true
|
|
||||||
rescue:
|
|
||||||
- name: Set negative service test pass fact
|
|
||||||
set_fact:
|
|
||||||
systemd_service_execreloads_test: true
|
|
||||||
|
|
||||||
- name: Check negative service testing
|
|
||||||
fail:
|
|
||||||
msg: >-
|
|
||||||
Failed negative service testing. Results --
|
|
||||||
systemd_service_execstarts_test: {{ systemd_service_execstarts_test }},
|
|
||||||
systemd_service_execstops_test: {{ systemd_service_execstops_test }},
|
|
||||||
systemd_service_execreloads_test: {{ systemd_service_execreloads_test }}
|
|
||||||
when:
|
|
||||||
- (not systemd_service_execstarts_test | bool) or
|
|
||||||
(not systemd_service_execstops_test | bool) or
|
|
||||||
(not systemd_service_execreloads_test | bool)
|
|
||||||
|
|
||||||
- name: Notify tests passed
|
- name: Notify tests passed
|
||||||
debug:
|
debug:
|
||||||
msg: All tests have passed
|
msg: All tests have passed
|
||||||
vars:
|
|
||||||
systemd_service_execstarts_test: false
|
|
||||||
systemd_service_execstops_test: false
|
|
||||||
systemd_service_execreloads_test: false
|
|
||||||
|
Loading…
Reference in New Issue
Block a user