103 lines
2.8 KiB
YAML
103 lines
2.8 KiB
YAML
---
|
|
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
|
|
#
|
|
# tasks file for flexlm
|
|
|
|
# Manage required system packages [[[1
|
|
- name: Ensure required packages are in there desired state
|
|
package:
|
|
name: '{{ item }}'
|
|
state: '{{ "present" if (flexlm__deploy_state == "present") else "absent" }}'
|
|
install_recommends: False
|
|
with_flattened:
|
|
- '{{ flexlm__required_packages }}'
|
|
register: flexlm_pkg_result
|
|
until: flexlm_pkg_result is success
|
|
|
|
# user
|
|
- name: Create flexlm user
|
|
user:
|
|
name: '{{ flexlm__user_name }}'
|
|
createhome: False
|
|
system: True
|
|
|
|
# Create a symlink for /tmp [[[1
|
|
- name: Symlink /usr/tmp
|
|
file:
|
|
src: /tmp
|
|
dest: /usr/tmp
|
|
state: link
|
|
|
|
# lmgrd and lmutil binaries [[[1
|
|
- name: Add lmgrd bin
|
|
copy:
|
|
src: '{{ flexlm__lmgrd_source + "." + flexlm__lmgrd_version }}'
|
|
dest: '{{ flexlm__lmgrd_path + "." + flexlm__lmgrd_version }}'
|
|
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: '{{ flexlm__user_name }}'
|
|
group: '{{ flexlm__user_name }}'
|
|
state: link
|
|
|
|
- name: Add lmutil bin
|
|
copy:
|
|
src: '{{ flexlm__lmutil_source }}'
|
|
dest: '{{ flexlm__lmutil_path }}'
|
|
owner: '{{ flexlm__user_name }}'
|
|
group: '{{ flexlm__user_name }}'
|
|
mode: 0755
|
|
|
|
# VENDOR and licence [[[1
|
|
- 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())
|
|
notify: ['restart flexlm services']
|
|
|
|
- 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())
|
|
notify: ['restart flexlm services']
|
|
|
|
# Manage services [[[1
|
|
|
|
- name: Add systemd unit
|
|
template:
|
|
src: '{{ flexlm__service_unit_content }}'
|
|
dest: '{{ "/etc/systemd/system/flexlm-" + item.name + ".service" }}'
|
|
owner: 'root'
|
|
group: 'root'
|
|
mode: '0644'
|
|
with_flattened:
|
|
- '{{ flexlm__licences }}'
|
|
when: ( (flexlm__deploy_state == "present") and
|
|
( item.service | d(True) ))
|
|
notify: ['systemd daemon reload', 'restart flexlm services']
|
|
|
|
- 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 }}'
|