-
Notifications
You must be signed in to change notification settings - Fork 1
/
touchscreen.yml
124 lines (108 loc) · 3.77 KB
/
touchscreen.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
---
- name: Cosmo | Bootstrap connexion
hosts: planet_computers
gather_facts: false
tasks:
- name: Bootstrap connexion
import_tasks: tasks/bootstrap.yml
when: bootstrapped is undefined
- name: Mark cosmo as bootstrapped
set_fact:
bootstrapped: true
- name: Cosmo | Touchscreen
hosts: planet_computers
become: true
diff: true
handlers:
- include: handlers/handlers.yml
pre_tasks:
- name: Fail if the variable is missing
fail:
msg: "Mandatory variable is undefined"
when:
- cosmo is undefined
- cosmo.touchscreen is undefined
- cosmo.right_click is undefined
- name: Fail if the variable has a value not allowed
fail:
msg:
- "Touchscreen variable as an unallowed value: {{ cosmo.touchscreen }}"
- "Allowed value: relative, absolute"
when:
- cosmo.touchscreen != 'relative'
- cosmo.touchscreen != 'absolute'
- cosmo.right_click != true or cosmo.right_click != false
tasks:
- name: Cosmo | Touchscreen right click installation
block:
- name: Cosmo | Touchscreen right click - Add dependencies
apt:
name: "{{ touchscreen_rightclick_packages }}"
state: present
- name: Cosmo | Touchscreen right click - Pull repo
git:
repo: https://github.com/m600x/cosmo-rightclick.git
dest: "/home/{{ ansible_ssh_user }}/cosmo-rightclick"
clone: yes
update: yes
become_user: "{{ ansible_ssh_user }}"
- name: Cosmo | Touchscreen right click - Build binary
make:
chdir: "/home/{{ ansible_ssh_user }}/cosmo-rightclick"
target: all
become_user: "{{ ansible_ssh_user }}"
- name: Cosmo | Touchscreen right click - Move binary to /usr/local/bin/cosmo-rightclick
copy:
src: "/home/{{ ansible_ssh_user }}/cosmo-rightclick/out/cosmo-rightclick"
dest: "/usr/local/bin/cosmo-rightclick"
owner: root
group: root
mode: '0755'
remote_src: yes
- name: Cosmo | Touchscreen right click - Add cosmo-rightclick service
copy:
src: rightclick_service
dest: "/etc/systemd/system/rightclick.service"
owner: root
group: root
mode: '0755'
notify: Restart display-manager
- name: Cosmo | Touchscreen right click - Enable and start cosmo-rightclick service
systemd:
name: rightclick
enabled: yes
notify: Restart display-manager
when:
- cosmo.touchscreen != 'relative'
- cosmo.rightclick is true
- name: Cosmo | Touchscreen right click - Disable and stop cosmo-rightclick service
systemd:
name: rightclick
enabled: no
state: stopped
become: true
notify: Restart display-manager
ignore_errors: true
when: cosmo.rightclick is false
- name: Cosmo | Touchscreen relative installation
block:
- name: Cosmo | Touchscreen relative - Add dependencies
apt:
name: "{{ touchscreen_absolute_packages }}"
state: present
- name: Cosmo | Touchscreen relative - Add 50-mtrack.conf
copy:
src: "50-mtrack.conf"
dest: "/usr/share/X11/xorg.conf.d/50-mtrack.conf"
owner: "root"
group: "root"
mode: '0644'
notify: Restart display-manager
when: cosmo.touchscreen == 'relative'
- name: Cosmo | Touchscreen absolute - Ensure 50-mtrack.conf is absent
file:
path: "/usr/share/X11/xorg.conf.d/50-mtrack.conf"
state: absent
notify: Restart display-manager
when:
- cosmo.touchscreen == 'absolute'