Skip to content

Commit b60f97d

Browse files
authored
Merge pull request #26 from Thulium-Drake/master
Multiple fixes
2 parents 9a97854 + 8b1f623 commit b60f97d

11 files changed

Lines changed: 74 additions & 61 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
molecule/default/tests/__pycache__/
2+
*.swp
3+
*.pyc

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [unreleased]
99

10+
- Rewrite to fix style issues, fix some tasks to be a bit more 'ansible-y'
11+
- Fixed file permissions warning
12+
- Made role compatible with 'new' ansible_facts[...] notation of facts
13+
- Made template correctly translate true/false to yes/no
14+
1015
### Changed
1116

1217
## [1.8] - 2022-02-07

handlers/main.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
11
---
22
# handlers file for thinlinc-server
33
- name: restart vsmagent
4-
service: name=vsmagent state=restarted
4+
service:
5+
name: vsmagent
6+
state: restarted
57

68
- name: restart vsmserver
7-
service: name=vsmserver state=restarted
9+
service:
10+
name: vsmserver
11+
state: restarted
812

913
- name: restart tlwebadm
10-
service: name=tlwebadm state=restarted
14+
service:
15+
name: tlwebadm
16+
state: restarted
1117

1218
- name: restart tlwebaccess
13-
service: name=tlwebaccess state=restarted
19+
service:
20+
name: tlwebaccess
21+
state: restarted
1422

1523
- name: run tl-setup
1624
command: /opt/thinlinc/sbin/tl-setup -a "/root/thinlinc-setup.answers"

meta/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
galaxy_info:
33
author: Karl Mikaelsson
4-
description: your description
4+
description: Thinlinc Server
55
company: Cendio AB
66
license: GPLv3
77

@@ -13,6 +13,7 @@ galaxy_info:
1313
- name: EL
1414
versions:
1515
- 7
16+
- 8
1617
- name: SLES
1718
versions:
1819
- 12

tasks/check_installed_deb.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

tasks/check_installed_rpm.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

tasks/copy_usr_etc_pam_sshd.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
register: etc_pam_sshd
77

88
- block:
9-
109
- name: Check /usr/etc/pam.d/sshd
1110
stat:
1211
path: /usr/etc/pam.d/sshd
@@ -16,6 +15,9 @@
1615
copy:
1716
src: /usr/etc/pam.d/sshd
1817
dest: /etc/pam.d/sshd
18+
owner: root
19+
group: root
20+
mode: '0644'
1921
remote_src: true
2022
when: usr_etc_pam_sshd.stat.exists == true
2123

tasks/install-thinlinc-rhel.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
---
22
- name: Install ThinLinc Software
3-
yum: name="{{ thinlinc_packages }}" state=present disable_gpg_check=true
3+
yum:
4+
name: "{{ thinlinc_packages }}"
5+
state: present
6+
disable_gpg_check: true
47
notify: run tl-setup

tasks/install-thinlinc-suse.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
---
22
- name: Install ThinLinc Software
3-
zypper: name="{{ thinlinc_packages }}" state=present disable_gpg_check=True
3+
zypper:
4+
name: "{{ thinlinc_packages }}"
5+
state: present
6+
disable_gpg_check: true
47
notify: run tl-setup

tasks/main.yml

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,81 @@
11
---
2-
32
- name: Installing pre-requisites
43
package:
54
name: unzip
65
state: present
6+
update_cache: true
77

8-
- name: Checking for installed ThinLinc packages
9-
block:
10-
- include_tasks: "check_installed_rpm.yml"
11-
when: ansible_os_family in ["RedHat", "Suse"]
12-
- include_tasks: "check_installed_deb.yml"
13-
when: ansible_os_family in ["Debian", "Ubuntu", "Linuxmint"]
8+
- name: Collect installed packages
9+
package_facts:
1410

1511
- name: Installing ThinLinc packages
1612
block:
1713
- name: Unpacking ThinLinc server bundle
1814
unarchive:
1915
src: "{{ thinlinc_server_bundle }}"
2016
dest: /root
21-
- include_vars: "packages-rpm-{{ ansible_architecture }}.yml"
22-
when: ansible_os_family in ["RedHat", "Suse"]
23-
- include_vars: "packages-deb-{{ ansible_architecture }}.yml"
24-
when: ansible_os_family in ["Debian", "Ubuntu", "Linuxmint"]
25-
- include_tasks: "install-thinlinc-rhel.yml"
26-
when: ansible_os_family == "RedHat"
27-
- include_tasks: "install-thinlinc-suse.yml"
28-
when: ansible_os_family == "Suse"
29-
- include_tasks: "install-thinlinc-debian.yml"
30-
when: ansible_os_family in ["Debian", "Ubuntu", "Linuxmint"]
31-
when: thinlinc_packages_installed.rc == 1
17+
creates: "{{ pkgdir }}"
18+
- name: Load vars for {{ ansible_facts['architecture'] }} RPMs
19+
include_vars: "packages-rpm-{{ ansible_facts['architecture'] }}.yml"
20+
when: ansible_facts['os_family'] in ["RedHat", "Suse"]
21+
- name: Load vars for {{ ansible_facts['architecture'] }} DEBs
22+
include_vars: "packages-deb-{{ ansible_facts['architecture'] }}.yml"
23+
when: ansible_facts['os_family'] in ["Debian", "Ubuntu", "Linuxmint"]
24+
- name: Run tasks for RHEL-like
25+
include_tasks: "install-thinlinc-rhel.yml"
26+
when: ansible_facts['os_family'] == "RedHat"
27+
- name: Run tasks for SUSE-like
28+
include_tasks: "install-thinlinc-suse.yml"
29+
when: ansible_facts['os_family'] == "Suse"
30+
- name: Run tasks for Debian-like
31+
include_tasks: "install-thinlinc-debian.yml"
32+
when: ansible_facts['os_family'] in ["Debian", "Ubuntu", "Linuxmint"]
33+
when: >
34+
ansible_facts['packages']['thinlinc-vsm'][0]['version'] is not defined or
35+
ansible_facts['packages']['thinlinc-vsm'][0]['version'] != thinlinc_version
3236
3337
# Workaround for OpenSUSE Tumbleweed usr merge
3438
# See https://www.cendio.com/bugzilla/show_bug.cgi?id=7829
3539
- name: Copy /usr/etc/pam.d/sshd
3640
include_tasks: "copy_usr_etc_pam_sshd.yml"
41+
when: ansible_facts['os_family'] == "Suse"
3742

3843
- name: Copy in tlsetup.answers
3944
template:
4045
src: thinlinc-setup.answers.j2
4146
dest: /root/thinlinc-setup.answers
47+
owner: root
48+
group: root
49+
mode: '0644'
4250
notify: run tl-setup
4351

44-
# Force tl-setup to run here, if required
45-
- meta: flush_handlers
52+
- name: Force tl-setup to run if required
53+
meta: flush_handlers
4654

4755
- name: Configure /vsmagent/agent_hostname
4856
tlconfig:
4957
param: /vsmagent/agent_hostname
50-
value: "{{ thinlinc_agent_hostname or ansible_fqdn }}"
58+
value: "{{ thinlinc_agent_hostname | default(ansible_facts['fqdn']) }}"
5159
notify: restart vsmagent
5260
when: "'thinlinc_agents' in group_names"
5361

5462
- name: Configure /vsmagent/master_hostname
5563
tlconfig:
5664
param: /vsmagent/master_hostname
57-
value: "{{ groups['thinlinc_masters'][0] or 'localhost' }}"
65+
value: "{{ groups['thinlinc_masters'][0] | default('localhost') }}"
5866
notify: restart vsmagent
5967
when: "'thinlinc_agents' in group_names"
6068

6169
- name: Configure /vsmagent/allowed_clients
6270
tlconfig:
6371
param: /vsmagent/allowed_clients
64-
value: "{{ ' '.join(groups['thinlinc_masters']) or 'localhost' }}"
72+
value: "{{ groups['thinlinc_masters'] | default(['localhost']) | join(' ') }}"
6573
notify: restart vsmagent
6674
when: "'thinlinc_agents' in group_names"
6775

6876
- name: Configure list of agent servers
6977
tlconfig:
7078
param: /vsmserver/subclusters/Default/agents
71-
value: "{{ ' '.join(groups['thinlinc_agents']) or 'localhost' }}"
79+
value: "{{ groups['thinlinc_agents'] | default(['localhost']) | join(' ') }}"
7280
notify: restart vsmserver
7381
when: "'thinlinc_masters' in group_names"

0 commit comments

Comments
 (0)