Update server installation for Traccar and LetsEncrypt.
This commit is contained in:
parent
8879789148
commit
c4817f0dd7
|
@ -5,3 +5,4 @@
|
|||
- searx_server
|
||||
- matrix_server
|
||||
- media_server
|
||||
- traccar_server
|
|
@ -1,8 +1,29 @@
|
|||
- name: Basic package installs
|
||||
- name: 'Basics: Package installs'
|
||||
tags:
|
||||
- install
|
||||
- basics
|
||||
yum:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
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
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
server_packages:
|
||||
- git
|
||||
- haproxy
|
||||
- letsencrypt
|
||||
- lsof
|
||||
- net-tools
|
||||
- psmisc
|
||||
- rsync
|
||||
- screen
|
||||
- telnet
|
||||
- unzip
|
||||
- vim
|
||||
|
|
9
.ansible/roles/matrix_server/tasks/main.yaml
Normal file
9
.ansible/roles/matrix_server/tasks/main.yaml
Normal file
|
@ -0,0 +1,9 @@
|
|||
- name: Synapse package
|
||||
tags:
|
||||
- install
|
||||
- matrix
|
||||
- synapse
|
||||
package:
|
||||
name: matrix-synapse
|
||||
state: latest
|
||||
become: yes
|
8
.ansible/roles/searx_server/tasks/main.yaml
Normal file
8
.ansible/roles/searx_server/tasks/main.yaml
Normal file
|
@ -0,0 +1,8 @@
|
|||
- name: 'Searx: package'
|
||||
tags:
|
||||
- install
|
||||
- searx
|
||||
package:
|
||||
name: searx
|
||||
state: latest
|
||||
become: yes
|
37
.ansible/roles/traccar_server/tasks/install.yaml
Normal file
37
.ansible/roles/traccar_server/tasks/install.yaml
Normal 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
|
47
.ansible/roles/traccar_server/tasks/main.yaml
Normal file
47
.ansible/roles/traccar_server/tasks/main.yaml
Normal 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
|
2
.ansible/roles/traccar_server/vars/main.yaml
Normal file
2
.ansible/roles/traccar_server/vars/main.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
traccar_tmppath: '/srv/tmp/traccar'
|
||||
traccar_owner: 'scott'
|
Loading…
Reference in a new issue