Add possibility to deserve licence file to the host

This commit is contained in:
Jeremy Gardais 2018-02-27 09:36:44 +01:00
parent b4b3631f29
commit 2b531de478
4 changed files with 20 additions and 4 deletions

View File

@ -2,7 +2,7 @@
## v1.x ## v1.x
### Features ### Features
* Add a way to provide vendor daemon for a licence. * Add a way to provide vendor daemon binaries and licence file.
## v1.0 ## v1.0

View File

@ -24,7 +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__licence_file**: Licence file to deserve [default: `/opt/flexlm/VENDOR/licence.lic`]. * **flexlm__licence_file**: Licence file to deserve [default: `/opt/flexlm/VENDOR/licence.lic`].
* **flexlm__licences**: Lists to manage vendor daemon files [default: `[]`]. * **flexlm__licences**: Lists to manage vendor daemon and licence files [default: `[]`].
* **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_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`].
@ -67,6 +67,8 @@ A role to manage Flexlm daemon.
- name: matlab - name: matlab
bin_path: '/opt/matlab/bin' bin_path: '/opt/matlab/bin'
bin_src: '{{ inventory_dir + "/../resources/service/matlab-lm/bin/" }}' bin_src: '{{ inventory_dir + "/../resources/service/matlab-lm/bin/" }}'
lic_path: '/opt/matlab/etc/licence.lic' # need to be a file
lic_src: '{{ inventory_dir + "/../resources/host/matlab-lm.domain/etc/licence.lic" }}' # need to be a file
``` ```
## Configuration ## Configuration
@ -76,6 +78,7 @@ This role will:
* Create a specific user to launch daemon. * Create a specific user to launch daemon.
* Set up a systemd service. [Thanks to Kalebo instructions][kalebo instruction flexlm systemd]. * Set up a systemd service. [Thanks to Kalebo instructions][kalebo instruction flexlm systemd].
* Copy vendor daemon binaries to the host if specified. * Copy vendor daemon binaries to the host if specified.
* Copy licence file to the host if specified.
The `lmgrd` and `lmutil` binaries comes from [Mathworks][mathworks download url] in version **flexlm__lmgrd_version**. The `lmgrd` and `lmutil` binaries comes from [Mathworks][mathworks download url] in version **flexlm__lmgrd_version**.

View File

@ -19,12 +19,14 @@ flexlm__user_name: 'flexlm'
# licence # licence
flexlm__licence_file: '/opt/flexlm/VENDOR/licence.lic' flexlm__licence_file: '/opt/flexlm/VENDOR/licence.lic'
# Lists to manage vendor daemon. # Lists to manage vendor daemon and licence files.
# flexlm_licences: # flexlm_licences:
# - name: matlab # - name: matlab
# description: 'flexlm Licence Manager for Matlab' # description: 'flexlm Licence Manager for Matlab'
# bin_path: '/opt/matlab/bin' # bin_path: '/opt/matlab/bin'
# bin_src: '{{ inventory_dir + "/../resources/service/matlab-lm/bin/" }}' # bin_src: '{{ inventory_dir + "/../resources/service/matlab-lm/bin/" }}'
# lic_path: '/opt/matlab/etc/licence.lic'
# lic_src: '{{ inventory_dir + "/../resources/hosts/matlab-lm/opt/matlab/etc/licence.lic" }}'
flexlm__licences: [] flexlm__licences: []
# service # service

View File

@ -47,7 +47,7 @@
# }}} # }}}
# VENDOR {{{ # VENDOR and licence {{{
- name: Add VENDOR DAEMON - name: Add VENDOR DAEMON
copy: copy:
src: '{{ item.bin_src }}' src: '{{ item.bin_src }}'
@ -59,6 +59,17 @@
- '{{ flexlm__licences }}' - '{{ flexlm__licences }}'
when: (item.bin_src|d()) when: (item.bin_src|d())
- name: Add licence file
copy:
src: '{{ (item.lic_src | dirname) + "/" }}' # Need a final "/"
dest: '{{ (item.lic_path | d("/opt/" + item.name + "/etc/licence.lic")) | dirname }}'
owner: '{{ flexlm__user_name }}'
group: '{{ flexlm__user_name }}'
mode: 0640
with_flattened:
- '{{ flexlm__licences }}'
when: (item.lic_src|d())
# }}} # }}}
# service {{{ # service {{{