Ensure to enable the service and reload list of systemd units

This commit is contained in:
Jeremy Gardais 2018-02-23 16:22:47 +01:00
parent 34cd661087
commit 9bd0dee48b
4 changed files with 22 additions and 1 deletions

View File

@ -24,6 +24,7 @@ A role to manage Flexlm daemon.
* **flexlm__lmutil_path**: The place to store `lmutil` bin [default: `/usr/local/bin/lmutil`]. * **flexlm__lmutil_path**: The place to store `lmutil` bin [default: `/usr/local/bin/lmutil`].
* **flexlm__user_name**: Username used to launch `lmgrd` [default: `flexlm`]. * **flexlm__user_name**: Username used to launch `lmgrd` [default: `flexlm`].
* **flexlm__service_manage**: If Licence Manager service should be managed with this role [default: `True`]. * **flexlm__service_manage**: If Licence Manager service should be managed with this role [default: `True`].
* **flexlm__service_enabled**: If Licence Manager service should be enable at startup [default: `True`].
* **flexlm__service_name**: Service name [default: `flexlm`]. * **flexlm__service_name**: Service name [default: `flexlm`].
* **flexlm__service_description**: Description of the systemd unit [default: `flexlm Licence Manager`]. * **flexlm__service_description**: Description of the systemd unit [default: `flexlm Licence Manager`].
* **flexlm__service_working_directory**: Working directory of the systemd unit [default: `/opt/flexlm/VENDOR`]. * **flexlm__service_working_directory**: Working directory of the systemd unit [default: `/opt/flexlm/VENDOR`].

View File

@ -18,6 +18,7 @@ flexlm__user_name: 'flexlm'
# service # service
flexlm__service_manage: True flexlm__service_manage: True
flexlm__service_enabled: True
flexlm__service_name: 'flexlm' flexlm__service_name: 'flexlm'
flexlm__service_description: 'flexlm Licence Manager' flexlm__service_description: 'flexlm Licence Manager'
flexlm__service_working_directory: '/opt/flexlm/VENDOR' flexlm__service_working_directory: '/opt/flexlm/VENDOR'

5
handlers/main.yml Normal file
View File

@ -0,0 +1,5 @@
---
# handlers file for flexlm
- name: restart flexlm service
service: name={{ flexlm__service_name }} state=restarted
when: flexlm__service_manage

View File

@ -49,7 +49,7 @@
# service {{{ # service {{{
- name: '{{ flexlm__service_name }} systemd service unit' - name: SERVICE '{{ flexlm__service_name }}' systemd unit
template: template:
src: '{{ flexlm__service_unit_content }}' src: '{{ flexlm__service_unit_content }}'
dest: '{{ flexlm__service_unit_path }}' dest: '{{ flexlm__service_unit_path }}'
@ -57,6 +57,20 @@
group: 'root' group: 'root'
mode: '0644' mode: '0644'
register: flexlm__register_systemd_service register: flexlm__register_systemd_service
notify: ['restart flexlm service']
when: flexlm__service_manage
- name: Reload systemd daemons
command: systemctl daemon-reload
notify: ['restart flexlm service']
when: (flexlm__service_manage and
flexlm__register_systemd_service|changed)
- name: SERVICE manage '{{ flexlm__service_name }}'
service:
name: '{{ flexlm__service_name }}'
state: started
enabled: '{{ flexlm__service_enabled }}'
when: flexlm__service_manage when: flexlm__service_manage
# }}} # }}}