Update server installation for Traccar and LetsEncrypt.

This commit is contained in:
Scott Wallace 2019-05-27 12:56:29 +01:00
parent 8879789148
commit c4817f0dd7
8 changed files with 130 additions and 2 deletions

View file

@ -5,3 +5,4 @@
- searx_server - searx_server
- matrix_server - matrix_server
- media_server - media_server
- traccar_server

View file

@ -1,8 +1,29 @@
- name: Basic package installs - name: 'Basics: Package installs'
tags: tags:
- install - install
- basics
yum: yum:
name: "{{ item }}" name: "{{ item }}"
state: latest state: latest
loop: "{{ server_packages }}" loop: "{{ server_packages }}"
become: true become: yes
- name: 'Basics: Directories'
tags:
- basics
file:
path: "{{ item }}"
state: directory
loop:
- /srv
- /srv/app
- /srv/tmp
become: yes
- name: 'Basics: Temp dir perms'
tags:
- basics
file:
path: '/srv/tmp'
mode: '1777'
become: yes

View file

@ -1,9 +1,12 @@
server_packages: server_packages:
- git - git
- haproxy - haproxy
- letsencrypt
- lsof - lsof
- net-tools - net-tools
- psmisc - psmisc
- rsync - rsync
- screen
- telnet - telnet
- unzip
- vim - vim

View file

@ -0,0 +1,9 @@
- name: Synapse package
tags:
- install
- matrix
- synapse
package:
name: matrix-synapse
state: latest
become: yes

View file

@ -0,0 +1,8 @@
- name: 'Searx: package'
tags:
- install
- searx
package:
name: searx
state: latest
become: yes

View file

@ -0,0 +1,37 @@
- name: 'Traccar: Temporary file'
tempfile:
state: file
suffix: '.zip'
register: traccarzip
- name: 'Traccar: Download'
get_url:
url: https://github.com/traccar/traccar/releases/download/v4.5/traccar-linux-64-4.5.zip
dest: "{{ traccarzip.path }}"
force: true
register: fetchurl
- name: 'Traccar: Install dir'
file:
path: "{{ traccar_tmppath }}"
state: directory
become: yes
- name: 'Traccar: Unzip'
unarchive:
src: "{{ traccarzip.path }}"
dest: "{{ traccar_tmppath }}"
remote_src: yes
become: yes
- name: 'Traccar: Remove temporary file'
file:
path: "{{ traccarzip.path }}"
state: absent
- name: 'Traccar: Run installer'
tags:
- install
- traccar
command: "{{ traccar_tmppath}}/traccar.run"
become: yes

View file

@ -0,0 +1,47 @@
- name: 'Traccar: Check installed'
tags:
- install
- traccar
stat:
path: "/opt/traccar/traccar.run"
register: traccar_app
- name: 'Traccar: Install'
tags:
- install
- traccar
include_tasks:
file: install.yaml
apply:
tags:
- always
when: not traccar_app.stat.exists
- name: 'Traccar: Fix perms'
tags:
- install
- traccar
file:
path: "/opt/traccar"
owner: "{{ traccar_owner }}"
group: "{{ traccar_owner }}"
recurse: yes
become: yes
- name: 'Traccar: Tidy installer'
tags:
- install
- traccar
file:
path: "{{ traccar_tmppath }}"
state: absent
become: yes
- name: 'Traccar: Service running'
tags:
- traccar
systemd:
name: traccar
state: started
enabled: yes
become: yes

View file

@ -0,0 +1,2 @@
traccar_tmppath: '/srv/tmp/traccar'
traccar_owner: 'scott'