mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-07-27 00:05:44 +02:00
Update to 2021-12-01 19:13
This commit is contained in:
62
roles/unmaintained/matrix_mxisd/tasks/main.yml
Normal file
62
roles/unmaintained/matrix_mxisd/tasks/main.yml
Normal file
@@ -0,0 +1,62 @@
|
||||
---
|
||||
|
||||
- name: Install needed packages
|
||||
yum:
|
||||
name:
|
||||
- java-1.8.0-openjdk-devel
|
||||
- git
|
||||
state: latest
|
||||
|
||||
- name: Create mxisd user account
|
||||
user: name={{ mxisd_user }} home={{ mxisd_root_dir }} shell=/bin/bash state=present
|
||||
|
||||
- name: Create needed directories
|
||||
file: path={{ mxisd_root_dir }}/{{ item.dir }} state=directory mode={{ item.mode }} group={{ mxisd_user }}
|
||||
with_items:
|
||||
- { dir: /, mode: 750 }
|
||||
- { dir: etc, mode: 770 }
|
||||
- { dir: db, mode: 770 }
|
||||
|
||||
- name: Clone mxisd repo
|
||||
git:
|
||||
depth: 1
|
||||
repo: "{{ mxisd_git_uri }}"
|
||||
dest: "{{ mxisd_root_dir }}/app"
|
||||
version: "{{ mxisd_version }}"
|
||||
become_user: "{{ mxisd_user }}"
|
||||
register: mxisd_git
|
||||
become: True
|
||||
|
||||
- name: Setup proxy settings for gradle
|
||||
template: src=gradle.properties.j2 dest={{ mxisd_root_dir }}/app/gradle.properties
|
||||
|
||||
- name: Check if the jar already exists
|
||||
stat: path={{ mxisd_root_dir }}/app/build/libs/app.jar
|
||||
register: mxisd_jar
|
||||
|
||||
- name: Build mxisd
|
||||
command: ./gradlew --no-daemon build
|
||||
args:
|
||||
chdir: "{{ mxisd_root_dir }}/app"
|
||||
become: True
|
||||
become_user: "{{ mxisd_user }}"
|
||||
when: mxisd_git.changed or not mxisd_jar.stat.exists
|
||||
notify: restart mxisd
|
||||
|
||||
- name: Handle mxisd port
|
||||
iptables_raw:
|
||||
name=mxisd_port
|
||||
state={{ (mxisd_src_ip is defined and mxisd_src_ip | length > 0) | ternary('present','absent') }}
|
||||
rules="-A INPUT -m state --state NEW -p tcp --dport {{ mxisd_port }} -s {{ mxisd_src_ip | join(',') }} -j ACCEPT"
|
||||
when: iptables_manage | default(True)
|
||||
|
||||
- name: Deploy service config
|
||||
template: src=mxisd.yaml.j2 dest={{ mxisd_root_dir }}/etc/mxisd.yaml group={{ mxisd_user }} mode=640
|
||||
notify: restart mxisd
|
||||
|
||||
- name: Deploy systemd unit
|
||||
template: src=matrix-mxisd.service.j2 dest=/etc/systemd/system/matrix-mxisd.service
|
||||
notify: reload systemd
|
||||
|
||||
- name: Start and enable the service
|
||||
service: name=matrix-mxisd state=started enabled=yes
|
Reference in New Issue
Block a user