Skip to content

Commit 8d7d4c2

Browse files
committed
* Named all tasks to make ansible-lint happy
* Added check for installed software * Reworked all ansible_* facts to 'new' naming scheme ansible_facts['*']
1 parent afad2b2 commit 8d7d4c2

1 file changed

Lines changed: 32 additions & 24 deletions

File tree

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)