From 2b531de4787f94e2acd4d2aa07d79aaf8013ff6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Tue, 27 Feb 2018 09:36:44 +0100 Subject: [PATCH] Add possibility to deserve licence file to the host --- CHANGELOG.md | 2 +- README.md | 5 ++++- defaults/main.yml | 4 +++- tasks/main.yml | 13 ++++++++++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1e10c1..71e6513 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## v1.x ### Features -* Add a way to provide vendor daemon for a licence. +* Add a way to provide vendor daemon binaries and licence file. ## v1.0 diff --git a/README.md b/README.md index 11c2cb5..ff30a57 100644 --- a/README.md +++ b/README.md @@ -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__user_name** : Username used to launch `lmgrd` [default : `flexlm`]. * **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_enabled** : If Licence Manager service should be enable at startup [default : `True`]. * **flexlm__service_name** : Service name [default : `flexlm`]. @@ -67,6 +67,8 @@ A role to manage Flexlm daemon. - name: matlab bin_path: '/opt/matlab/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 @@ -76,6 +78,7 @@ This role will : * Create a specific user to launch daemon. * Set up a systemd service. [Thanks to Kalebo instructions][kalebo instruction flexlm systemd]. * 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**. diff --git a/defaults/main.yml b/defaults/main.yml index 93ffbda..39df3c3 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -19,12 +19,14 @@ flexlm__user_name: 'flexlm' # licence flexlm__licence_file: '/opt/flexlm/VENDOR/licence.lic' -# Lists to manage vendor daemon. +# Lists to manage vendor daemon and licence files. # flexlm_licences: # - name: matlab # description: 'flexlm Licence Manager for Matlab' # bin_path: '/opt/matlab/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: [] # service diff --git a/tasks/main.yml b/tasks/main.yml index da724b7..ae6c328 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -47,7 +47,7 @@ # }}} -# VENDOR {{{ +# VENDOR and licence {{{ - name: Add VENDOR DAEMON copy: src: '{{ item.bin_src }}' @@ -59,6 +59,17 @@ - '{{ flexlm__licences }}' 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 {{{