move roles, files and templates dirs out of playbook dir into root dir
All checks were successful
/ Ansible Lint (push) Successful in 1m38s

Because of how Ansible local relative search paths work, the global
"files" and "templates" directories need to be next to the playbooks.
However its not intuitive to look into the "playbooks" directory to find
the files and templates for a host.
Therefore move them out of the "playbooks" directory into the root
directory and add symlinks so everything still works.

Similarly for local roles, they also need to be next to the playbooks.
So for a nicer structure, move the "roles" directory out into the root
directory as well and add a symlink so everything still works.

Also see:
https://docs.ansible.com/ansible/latest/playbook_guide/playbook_pathing.html#resolving-local-relative-paths
https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_reuse_roles.html#storing-and-finding-roles
This commit is contained in:
June 2024-12-02 03:34:55 +01:00
commit 5bb283d5e7
Signed by: june
SSH key fingerprint: SHA256:o9EAq4Y9N9K0pBQeBTqhSDrND5E7oB+60ZNx0U1yPe0
147 changed files with 3 additions and 0 deletions

View file

@ -0,0 +1 @@
foobazdmx_version: main

View file

@ -0,0 +1,6 @@
- name: Restart foobazdmx
become: true
ansible.builtin.systemd:
service: foobazdmx.service
state: restarted
daemon-reload: true

View file

@ -0,0 +1,16 @@
---
argument_specs:
main:
options:
foobazdmx_version:
description: git branch, tag, or commit to check out from the foobazdmx repo
type: str
default: main
foobazdmx_repo_url:
description: git repo to pull foobazdmx from
type: str
required: true
foobazdmx__art_net_host:
description: IP oder hostname of the Art-Net server
type: str
required: true

View file

@ -0,0 +1,8 @@
---
dependencies:
- role: distribution_check
vars:
distribution_check__distribution_support_spec:
- name: Debian
major_versions:
- "11"

View file

@ -0,0 +1,60 @@
- name: Ensure apt dependencies are installed
become: true
ansible.builtin.apt:
name:
- acl
- git
- python3
- python3-pip
- python3-setuptools
- name: Ensure python peotry is installed
become: true
ansible.builtin.pip:
name: poetry
- name: Ensure foobazdmx user exists
become: true
ansible.builtin.user:
name: foobazdmx
- name: Install foobazdmx
notify: Restart foobazdmx
block:
- name: Clone foobazdmx repository
become: true
ansible.builtin.git:
repo: "{{ foobazdmx_repo_url }}"
dest: /opt/foobazdmx
version: "{{ foobazdmx_version }}"
- name: Install python dependencies
become: true
become_user: foobazdmx
ansible.builtin.command:
cmd: poetry install
chdir: /opt/foobazdmx
changed_when: false
- name: Generate foobazdmx service file
become: true
ansible.builtin.template:
src: foobazdmx.service.j2
dest: /etc/systemd/system/foobazdmx.service
mode: "0755"
- name: Enable and start foobazdmx service
become: true
ansible.builtin.systemd:
service: foobazdmx.service
state: started
enabled: true
- name: Generate foobazdmx-shop service file
become: true
ansible.builtin.template:
src: foobazdmx-shop.service.j2
dest: /etc/systemd/system/foobazdmx-shop.service
mode: "0755"
- name: Enable and start foobazdmx-shop service
become: true
ansible.builtin.systemd:
service: foobazdmx-shop.service
state: started
enabled: true

View file

@ -0,0 +1,10 @@
[Unit]
Description=Foobaz-Shop DMX
[Service]
ExecStart=poetry run python foobaz.py -a {{ foobazdmx__art_net_host }} -l 8081 -r shop -u 2
WorkingDirectory=/opt/foobazdmx
User=foobazdmx
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,10 @@
[Unit]
Description=Foobaz DMX
[Service]
ExecStart=poetry run python foobaz.py -a {{ foobazdmx__art_net_host }} -r big
WorkingDirectory=/opt/foobazdmx
User=foobazdmx
[Install]
WantedBy=multi-user.target