2019-05-28 22:46:03 +01:00
|
|
|
- name: 'Traccar'
|
2019-05-27 12:56:29 +01:00
|
|
|
tags:
|
|
|
|
- install
|
|
|
|
- traccar
|
2019-05-28 22:46:03 +01:00
|
|
|
block:
|
|
|
|
- name: 'Traccar: Check installed'
|
|
|
|
stat:
|
|
|
|
path: "/opt/traccar/traccar.run"
|
|
|
|
register: traccar_app
|
2019-05-27 12:56:29 +01:00
|
|
|
|
2019-05-28 22:46:03 +01:00
|
|
|
- name: 'Traccar: Install'
|
|
|
|
include_tasks:
|
|
|
|
file: install.yaml
|
|
|
|
apply:
|
|
|
|
tags:
|
|
|
|
- always
|
|
|
|
when: not traccar_app.stat.exists
|
2019-05-27 12:56:29 +01:00
|
|
|
|
2019-05-28 22:46:03 +01:00
|
|
|
- name: 'Traccar: Tidy installer'
|
|
|
|
file:
|
|
|
|
path: "{{ traccar_tmppath }}"
|
|
|
|
state: absent
|
|
|
|
become: yes
|
2019-05-27 12:56:29 +01:00
|
|
|
|
2019-05-28 22:46:03 +01:00
|
|
|
- name: 'Traccar: Add group'
|
|
|
|
group:
|
|
|
|
name: "{{ traccar_owner }}"
|
|
|
|
become: yes
|
2019-05-27 12:56:29 +01:00
|
|
|
|
2019-05-28 22:46:03 +01:00
|
|
|
- name: 'Traccar: Add user'
|
|
|
|
user:
|
|
|
|
name: "{{ traccar_owner }}"
|
|
|
|
group: "{{ traccar_owner }}"
|
|
|
|
become: yes
|
|
|
|
|
|
|
|
- name: 'Traccar: Fix perms'
|
|
|
|
file:
|
|
|
|
path: '/opt/traccar'
|
|
|
|
owner: "{{ traccar_owner }}"
|
|
|
|
group: "{{ traccar_owner }}"
|
|
|
|
recurse: yes
|
|
|
|
become: yes
|
|
|
|
|
|
|
|
- name: 'Traccar: systemd override'
|
|
|
|
block:
|
|
|
|
- name: 'Traccar: systemd override directory'
|
|
|
|
file:
|
|
|
|
path: '/etc/systemd/system/traccar.service.d'
|
|
|
|
state: directory
|
|
|
|
force: yes
|
|
|
|
- name: 'Traccar: systemd override file'
|
|
|
|
copy:
|
|
|
|
dest: '/etc/systemd/system/traccar.service.d/override.conf'
|
|
|
|
content: "[Service]\nUser={{ traccar_owner }}\nGroup={{ traccar_owner }}\n"
|
|
|
|
become: yes
|
|
|
|
|
|
|
|
- name: 'Traccar: Service running'
|
|
|
|
systemd:
|
|
|
|
name: traccar
|
|
|
|
state: started
|
|
|
|
daemon_reload: yes
|
|
|
|
enabled: yes
|
|
|
|
become: yes
|