2018-02-23 11:19:33 +01:00
|
|
|
---
|
2018-02-27 14:05:07 +01:00
|
|
|
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
|
|
|
|
#
|
2018-02-23 11:19:33 +01:00
|
|
|
# tasks file for flexlm
|
|
|
|
|
2018-02-27 14:05:07 +01:00
|
|
|
# Manage required system packages [[[1
|
|
|
|
- name: Ensure required packages are in there desired state
|
2018-02-23 11:19:33 +01:00
|
|
|
package:
|
|
|
|
name: '{{ item }}'
|
2018-02-27 14:05:07 +01:00
|
|
|
state: '{{ "present" if (flexlm__deploy_state == "present") else "absent" }}'
|
2018-02-23 11:19:33 +01:00
|
|
|
install_recommends: False
|
|
|
|
with_flattened:
|
2018-02-27 14:05:07 +01:00
|
|
|
- '{{ flexlm__required_packages }}'
|
2019-02-26 14:00:11 +01:00
|
|
|
register: flexlm_pkg_result
|
|
|
|
until: flexlm_pkg_result is success
|
2018-02-23 11:19:33 +01:00
|
|
|
|
2018-02-23 15:27:53 +01:00
|
|
|
# user
|
|
|
|
- name: Create flexlm user
|
|
|
|
user:
|
|
|
|
name: '{{ flexlm__user_name }}'
|
|
|
|
createhome: False
|
|
|
|
system: True
|
|
|
|
|
2018-02-28 15:04:06 +01:00
|
|
|
# Create a symlink for /tmp [[[1
|
|
|
|
- name: Symlink /usr/tmp
|
|
|
|
file:
|
|
|
|
src: /tmp
|
|
|
|
dest: /usr/tmp
|
|
|
|
state: link
|
|
|
|
|
2018-02-27 15:47:08 +01:00
|
|
|
# lmgrd and lmutil binaries [[[1
|
2018-02-23 14:32:08 +01:00
|
|
|
- name: Add lmgrd bin
|
|
|
|
copy:
|
|
|
|
src: '{{ flexlm__lmgrd_source + "." + flexlm__lmgrd_version }}'
|
|
|
|
dest: '{{ flexlm__lmgrd_path + "." + flexlm__lmgrd_version }}'
|
2018-02-23 15:27:53 +01:00
|
|
|
owner: '{{ flexlm__user_name }}'
|
|
|
|
group: '{{ flexlm__user_name }}'
|
2018-02-23 14:32:08 +01:00
|
|
|
mode: 0755
|
|
|
|
|
2018-02-23 14:36:52 +01:00
|
|
|
- name: Link to the last version of lmgrd
|
|
|
|
file:
|
|
|
|
src: '{{ flexlm__lmgrd_path + "." + flexlm__lmgrd_version }}'
|
|
|
|
dest: '{{ flexlm__lmgrd_path }}'
|
2018-02-23 15:27:53 +01:00
|
|
|
owner: '{{ flexlm__user_name }}'
|
|
|
|
group: '{{ flexlm__user_name }}'
|
2018-02-23 14:36:52 +01:00
|
|
|
state: link
|
|
|
|
|
2018-02-23 14:32:08 +01:00
|
|
|
- name: Add lmutil bin
|
|
|
|
copy:
|
|
|
|
src: '{{ flexlm__lmutil_source }}'
|
|
|
|
dest: '{{ flexlm__lmutil_path }}'
|
2018-02-23 15:27:53 +01:00
|
|
|
owner: '{{ flexlm__user_name }}'
|
|
|
|
group: '{{ flexlm__user_name }}'
|
2018-02-23 14:32:08 +01:00
|
|
|
mode: 0755
|
|
|
|
|
2018-02-27 15:47:08 +01:00
|
|
|
# VENDOR and licence [[[1
|
2018-02-27 08:32:20 +01:00
|
|
|
- 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())
|
2018-02-27 12:05:11 +01:00
|
|
|
notify: ['restart flexlm services']
|
2018-02-27 08:32:20 +01:00
|
|
|
|
2018-02-27 09:36:44 +01:00
|
|
|
- name: Add licence file
|
|
|
|
copy:
|
2018-08-06 15:23:31 +02:00
|
|
|
src: '{{ (item.lic_src | dirname) + "/" }}' # Need a final "/"
|
2018-02-27 09:36:44 +01:00
|
|
|
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())
|
2018-02-27 12:05:11 +01:00
|
|
|
notify: ['restart flexlm services']
|
2018-02-27 09:36:44 +01:00
|
|
|
|
2018-02-27 15:47:08 +01:00
|
|
|
# Manage services [[[1
|
2018-02-23 15:56:31 +01:00
|
|
|
|
2018-02-27 12:05:11 +01:00
|
|
|
- name: Add systemd unit
|
2018-02-23 15:56:31 +01:00
|
|
|
template:
|
|
|
|
src: '{{ flexlm__service_unit_content }}'
|
2018-02-27 12:05:11 +01:00
|
|
|
dest: '{{ "/etc/systemd/system/flexlm-" + item.name + ".service" }}'
|
2018-02-23 15:56:31 +01:00
|
|
|
owner: 'root'
|
|
|
|
group: 'root'
|
|
|
|
mode: '0644'
|
2018-02-27 15:47:08 +01:00
|
|
|
register: flexlm__register_service
|
2018-02-27 12:05:11 +01:00
|
|
|
with_flattened:
|
|
|
|
- '{{ flexlm__licences }}'
|
2018-02-27 15:47:08 +01:00
|
|
|
when: ( (flexlm__deploy_state == "present") and
|
2018-02-27 12:05:11 +01:00
|
|
|
( item.service | d(True) ))
|
2018-02-23 16:22:47 +01:00
|
|
|
|
2019-02-26 14:05:37 +01:00
|
|
|
- name: Force systemd to reread configs
|
|
|
|
systemd:
|
|
|
|
daemon_reload: True
|
2018-02-27 12:05:11 +01:00
|
|
|
notify: ['restart flexlm services']
|
2018-02-27 15:47:08 +01:00
|
|
|
when: ( flexlm__register_service|changed )
|
2018-02-23 16:22:47 +01:00
|
|
|
|
2018-02-28 10:58:25 +01:00
|
|
|
- name: Manage flexlm services
|
|
|
|
service:
|
|
|
|
name: '{{ "flexlm-" + item.name }}'
|
|
|
|
state: '{{ "started" if (flexlm__deploy_state == "present" and (item.service | d(True) | bool)) else "stopped" }}'
|
|
|
|
enabled: '{{ item.service | d(True) | bool }}'
|
|
|
|
with_flattened:
|
|
|
|
- '{{ flexlm__licences }}'
|