ansible-role-mumble/tasks/mumble_web.yml

103 lines
2.4 KiB
YAML
Raw Normal View History

- name: Install NodeJS
import_role:
name: geerlingguy.nodejs
tags: nodejs
- name: Install git package
package:
name: git
state: present
tags: mumble_web_install
2020-05-21 22:15:33 +02:00
- name: Install websockify
package:
2020-05-21 22:15:33 +02:00
name: websockify
state: present
notify: reload mumble-web
tags: mumble_web_install
- name: Create mumble-web system user
user:
name: "{{ mumble_web_owner }}"
2021-03-28 10:48:06 +02:00
home: "{{ mumble_web_home_dir }}"
2020-05-21 22:15:33 +02:00
groups:
2021-03-28 10:48:06 +02:00
- www-data
2020-05-21 22:15:33 +02:00
shell: /sbin/nologin
password: '*'
state: present
system: yes
append: yes
2021-03-28 10:48:06 +02:00
tags: mumble_web_install
2020-05-21 22:15:33 +02:00
- name: Change mumble-web home directory's permissions
file:
2021-03-28 10:48:06 +02:00
path: "{{ mumble_web_home_dir }}"
2020-05-21 22:15:33 +02:00
owner: "{{ mumble_web_owner }}"
group: "{{ mumble_web_group }}"
mode: "755"
state: directory
tags: mumble_web_install
- name: Clone mumble-web git repository
git:
repo: https://github.com/Johni0702/mumble-web.git
2021-03-28 10:48:06 +02:00
dest: "{{ mumble_web_code_dir }}"
2020-05-21 22:15:33 +02:00
version: "{{ mumble_web_version }}"
register: mumble_web_cloned
become_user: "{{ mumble_web_owner }}"
tags: mumble_web_install
- name: Check if mumble-web dist directory exists
stat:
2021-03-28 10:48:06 +02:00
path: "{{ mumble_web_dist_dir }}"
register: _mumble_web_dist
2021-03-28 10:48:06 +02:00
tags:
- mumble_web_install
- mumble_web_build
2020-05-21 22:15:33 +02:00
- name: Build mumble-web from sources
2021-03-28 10:48:06 +02:00
command: npm clean-install {{ mumble_web_dist_dir | quote }}
2020-05-21 22:15:33 +02:00
args:
2021-03-28 10:48:06 +02:00
chdir: "{{ mumble_web_code_dir }}"
2020-05-21 22:15:33 +02:00
register: _mumble_web_installed
become_user: "{{ mumble_web_owner }}"
when: mumble_web_cloned is changed or not _mumble_web_dist.stat.exists
2021-03-28 10:48:06 +02:00
tags:
- mumble_web_install
- mumble_web_build
2020-05-21 22:15:33 +02:00
- name: Copy mumble-web config file
template:
2021-03-26 23:48:36 +01:00
src: mumble-web/config.js.j2
2021-03-28 10:48:06 +02:00
dest: "{{ mumble_web_dist_dir }}/config.local.js"
2020-05-21 22:15:33 +02:00
owner: "{{ mumble_web_owner }}"
group: "{{ mumble_web_group }}"
mode: "644"
2021-03-28 10:48:06 +02:00
tags:
- mumble_web_install
- mumble_web_config
2020-05-21 22:15:33 +02:00
- name: Copy mumble-web systemd service
template:
2021-03-26 23:48:36 +01:00
src: mumble-web/mumble-web.service.j2
2020-05-21 22:15:33 +02:00
dest: /etc/systemd/system/mumble-web.service
owner: root
group: root
mode: "644"
notify:
- reload systemd
- reload mumble-web
2021-03-28 10:48:06 +02:00
tags:
- mumble_web_install
- mumble_web_config
2020-05-21 22:15:33 +02:00
- name: Start mumble-web service
service:
name: mumble-web
state: started
enabled: yes
register: mumble_web_started
tags: mumble_web_run
- name: Trigger mumble-web handlers
meta: flush_handlers