From b4b3631f29524a0808fd1b672c2fa28ad3f70c38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Tue, 27 Feb 2018 08:32:20 +0100 Subject: [PATCH] Add a way to provide vendor daemon for licences --- CHANGELOG.md | 5 +++++ README.md | 23 ++++++++++++++++++++--- defaults/main.yml | 8 ++++++++ tasks/main.yml | 14 ++++++++++++++ 4 files changed, 47 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b23983..d1e10c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ +## v1.x + +### Features +* Add a way to provide vendor daemon for a licence. + ## v1.0 ### Features diff --git a/README.md b/README.md index ea2dcf8..11c2cb5 100644 --- a/README.md +++ b/README.md @@ -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__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__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`]. @@ -36,7 +37,7 @@ A role to manage Flexlm daemon. * Manage Flexlm with defaults vars : -``` yml +``` yaml - hosts: serverXYZ roles: - role: ipr-cnrs.flexlm @@ -44,21 +45,37 @@ A role to manage Flexlm daemon. * Manage Flexlm to provide Intel Fortran : -``` yml +``` yaml - hosts: intel-lm - croles: + roles: - role: ipr-cnrs.flexlm flexlm__service_working_directory: '/opt/intel/bin' flexlm__licence_file: '/opt/intel/etc/license.lic' flexlm__service_description: 'Licence Manager for Intel Fortran' ``` +* Manage Flexlm to provide Matlab Licence and vendor daemon : + +```yaml +- hosts: matlab-lm + roles: + - role: ipr-cnrs.flexlm + flexlm__service_working_directory: '/opt/matlab/bin' + flexlm__licence_file: '/opt/matlab/etc/license.lic' + flexlm__service_description: 'Licence Manager for Matlab' + flexlm__licences: + - name: matlab + bin_path: '/opt/matlab/bin' + bin_src: '{{ inventory_dir + "/../resources/service/matlab-lm/bin/" }}' +``` + ## Configuration This role will : * Copy the `lmgrd` and `lmutil` binaries to the client. * 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. 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 877d538..93ffbda 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -19,6 +19,14 @@ flexlm__user_name: 'flexlm' # licence flexlm__licence_file: '/opt/flexlm/VENDOR/licence.lic' +# Lists to manage vendor daemon. +# flexlm_licences: +# - name: matlab +# description: 'flexlm Licence Manager for Matlab' +# bin_path: '/opt/matlab/bin' +# bin_src: '{{ inventory_dir + "/../resources/service/matlab-lm/bin/" }}' +flexlm__licences: [] + # service flexlm__service_manage: True flexlm__service_enabled: True diff --git a/tasks/main.yml b/tasks/main.yml index f08329a..da724b7 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -47,6 +47,20 @@ # }}} +# VENDOR {{{ +- name: Add VENDOR DAEMON + copy: + src: '{{ item.bin_src }}' + dest: '{{ item.bin_path | d("/opt/" + item.name + "/bin") }}' + owner: '{{ flexlm__user_name }}' + group: '{{ flexlm__user_name }}' + mode: 0754 + with_flattened: + - '{{ flexlm__licences }}' + when: (item.bin_src|d()) + +# }}} + # service {{{ - name: SERVICE '{{ flexlm__service_name }}' systemd unit