Cause if a service is started|stopped manually, it can't come back in
the desired state.
This commit is contained in:
Jeremy Gardais 2018-02-28 10:58:25 +01:00
parent bff4d7a11f
commit d498ca502a
2 changed files with 9 additions and 1 deletions

View File

@ -3,7 +3,7 @@
- name: restart flexlm services - name: restart flexlm services
service: service:
name: '{{ "flexlm-" + item.name }}' name: '{{ "flexlm-" + item.name }}'
state: '{{ "restarted" if (flexlm__deploy_state == "present" and (item.service | d(True)) else "stopped" }}' state: '{{ "restarted" if (flexlm__deploy_state == "present" and (item.service | d(True) | bool) else "stopped" }}'
enabled: '{{ item.service | d(True) | bool }}' enabled: '{{ item.service | d(True) | bool }}'
with_flattened: with_flattened:
- '{{ flexlm__licences }}' - '{{ flexlm__licences }}'

View File

@ -99,3 +99,11 @@
notify: ['restart flexlm services'] notify: ['restart flexlm services']
when: ( flexlm__register_service|changed ) when: ( flexlm__register_service|changed )
- name: Manage flexlm services
service:
name: '{{ "flexlm-" + item.name }}'
state: '{{ "started" if (flexlm__deploy_state == "present" and (item.service | d(True) | bool)) else "stopped" }}'
enabled: '{{ item.service | d(True) | bool }}'
with_flattened:
- '{{ flexlm__licences }}'