setup lyon-transports

This commit is contained in:
Gabriel Augendre 2024-10-09 19:51:11 +02:00
commit b64e1b7a5b
6 changed files with 71 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
vault.pass
.idea

3
.mise.toml Normal file
View file

@ -0,0 +1,3 @@
[env]
ANSIBLE_INVENTORY = "{{config_root}}/inventory.ini"
ANSIBLE_VAULT_PASSWORD_FILE = "{{config_root}}/vault.pass"

5
Makefile Normal file
View file

@ -0,0 +1,5 @@
dry-run:
ansible-playbook playbook.yaml --check --diff
run:
ansible-playbook playbook.yaml

2
inventory.ini Normal file
View file

@ -0,0 +1,2 @@
[servers]
192.168.0.6:38303 ansible_python_interpreter=auto_silent

46
playbook.yaml Normal file
View file

@ -0,0 +1,46 @@
- name: lyon-transports
hosts: servers
tasks:
- name: write lyon-transports unit file
become: true
template:
src: templates/lyon-transports.service.j2
dest: /etc/systemd/system/lyon-transports.service
notify:
- daemon-reload
- restart lyon-transports
- name: ensure lyon-transports is running
become: true
service:
name: lyon-transports
state: started
enabled: true
handlers:
- name: daemon-reload
become: true
systemd:
daemon_reload: true
- name: restart lyon-transports
become: true
service:
name: lyon-transports
state: restarted
vars:
lyon_transports_password: !vault |
$ANSIBLE_VAULT;1.1;AES256
35356364616633356164376433623139333165626433303437666266613762643239373730616131
6463316639393663396462383461306330636531663166380a623166666631303361346333323363
62656138313133323637356363313564323634616363333237336338633365333236363637396432
3566303038333234650a343861366331346532666532666363323863326461313639303238623039
64326435353962616464666663613763316662326432363334383363336539356639323632623132
63306638663038326364626132616161616665393132316163616638646539346466313562346330
396162653537663634316439386636393534
lyon_transports_username: !vault |
$ANSIBLE_VAULT;1.1;AES256
35646462383237353130323736613632336664643633396163363561396562623963313664383666
6239376430316663303836656230396636626533323361320a353637666362646364636431653862
39613062303438356436613733396164646662333938353433313135356531373139323939653335
3730663430656439640a613532326434343438656330363964303766363666393962393065663938
30643033303263346538353564333535656437336639336461363261623435656131

View file

@ -0,0 +1,13 @@
[Unit]
Description=Lyon transports API
After=network.target
[Service]
ExecStart=/mnt/data/lyon-transports/lyon-transports-linux-amd64 --host 0.0.0.0 -u {{ lyon_transports_username }} -p {{ lyon_transports_password }} --cors-allowed-origin https://display.augendre.info
Type=simple
Restart=always
User=gaugendre
Group=gaugendre
[Install]
WantedBy=default.target