From 1036d20858fd5fb60048ab72371c7afabb033296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Fri, 23 Feb 2018 15:27:53 +0100 Subject: [PATCH] Create a specific user to launch `lmgrd` --- CHANGELOG.md | 1 + README.md | 2 ++ defaults/main.yml | 3 +++ tasks/main.yml | 19 +++++++++++++------ 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab9ebd6..9433eda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,3 +5,4 @@ * Install FlexLM dependencies. * Copy `lmgrd` and `lmutil` binaries. * Ensure to have a symlink for `lmgrd` to it's last version. +* Create a specific user to launch `lmgrd`. diff --git a/README.md b/README.md index 4a9af55..fc82c65 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ A role to manage Flexlm daemon. * **flexlm__lmgrd_path** : The place to store `lmgrd` bin [default : `/usr/local/bin/lmgrd`]. * **flexlm__lmutil_source** : Source of the `lmutil` bin to send [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`]. ## Example Playbook @@ -37,6 +38,7 @@ A role to manage Flexlm daemon. This role will : * Copy the `lmgrd` and `lmutil` binaries to the node. +* Create a specific user to launch daemon. 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 0c4d055..bb765e9 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -12,3 +12,6 @@ flexlm__lmgrd_source: 'usr/local/bin/lmgrd' flexlm__lmgrd_path: '/usr/local/bin/lmgrd' flexlm__lmutil_source: 'usr/local/bin/lmutil' flexlm__lmutil_path: '/usr/local/bin/lmutil' + +# user +flexlm__user_name: 'flexlm' diff --git a/tasks/main.yml b/tasks/main.yml index e14f469..63552f6 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -13,29 +13,36 @@ # }}} +# user +- name: Create flexlm user + user: + name: '{{ flexlm__user_name }}' + createhome: False + system: True + # bin {{{ - name: Add lmgrd bin copy: src: '{{ flexlm__lmgrd_source + "." + flexlm__lmgrd_version }}' dest: '{{ flexlm__lmgrd_path + "." + flexlm__lmgrd_version }}' - owner: root - group: root + owner: '{{ flexlm__user_name }}' + group: '{{ flexlm__user_name }}' mode: 0755 - name: Link to the last version of lmgrd file: src: '{{ flexlm__lmgrd_path + "." + flexlm__lmgrd_version }}' dest: '{{ flexlm__lmgrd_path }}' - owner: root - group: root + owner: '{{ flexlm__user_name }}' + group: '{{ flexlm__user_name }}' state: link - name: Add lmutil bin copy: src: '{{ flexlm__lmutil_source }}' dest: '{{ flexlm__lmutil_path }}' - owner: root - group: root + owner: '{{ flexlm__user_name }}' + group: '{{ flexlm__user_name }}' mode: 0755 # }}}