xoxys.pve_sd/tasks/setup.yml
Robert Kaussow 83cadc0e32
Some checks failed
continuous-integration/drone/push Build is failing
feat: add option to configure token auth (#2)
Reviewed-on: #2
Co-authored-by: Robert Kaussow <mail@thegeeklab.de>
Co-committed-by: Robert Kaussow <mail@thegeeklab.de>
2024-01-24 10:10:43 +01:00

91 lines
2.6 KiB
YAML

---
- block:
- name: Create group '{{ pve_sd_system_group }}'
group:
name: "{{ pve_sd_system_group }}"
state: present
- name: Create user '{{ pve_sd_system_user }}'
user:
comment: "{{ pve_sd_system_user_comment }}"
name: "{{ pve_sd_system_user }}"
group: "{{ pve_sd_system_group }}"
groups: "{{ pve_sd_system_extra_groups | join(',') }}"
- name: Upgrade python dependencies
pip:
name: "{{ item }}"
virtualenv: "{{ pve_sd_virtualenv }}"
virtualenv_command: "{{ pve_sd_virtualenv_command }}"
extra_args: --upgrade
umask: "{{ pve_sd_virtualenv_umask | default(omit) }}"
loop:
- pip
- setuptools
- name: Install dependencies
pip:
name: "{{ item }}"
virtualenv: "{{ pve_sd_virtualenv }}"
virtualenv_command: "{{ pve_sd_virtualenv_command }}"
umask: "{{ pve_sd_virtualenv_umask | default(omit) }}"
environment:
TMPDIR: /opt/python3/tmp
loop: "{{ pve_sd_packages_extra }}"
- name: Install PVE SD
pip:
name: "{{ item }}"
virtualenv: "{{ pve_sd_virtualenv }}"
virtualenv_command: "{{ pve_sd_virtualenv_command }}"
umask: "{{ pve_sd_virtualenv_umask | default(omit) }}"
loop: "{{ __pve_sd_packages }}"
- name: Make PVE SD binaries executable
file:
name: "{{ pve_sd_virtualenv }}/bin/{{ item }}"
mode: 0755
loop: "{{ __pve_sd_binaries }}"
- name: Deploy PVE SD bin wrappers
template:
src: usr/local/bin/pve-sd-wrapper.j2
dest: "/usr/local/bin/{{ item }}"
owner: root
group: root
mode: 0755
loop: "{{ __pve_sd_binaries }}"
become: True
become_user: root
- block:
- name: Write environment file
template:
src: etc/sysconfig/pve_sd.j2
dest: /etc/sysconfig/pve_sd
mode: 0600
notify: __pve_sd_restart
- name: Write timer file
template:
src: etc/systemd/system/pve_sd.timer.j2
dest: /etc/systemd/system/pve_sd.timer
mode: 0644
notify: __pve_sd_restart
- name: Write service file
template:
src: etc/systemd/system/pve_sd.service.j2
dest: /etc/systemd/system/pve_sd.service
mode: 0644
notify: __pve_sd_restart
- name: Ensure PVE SD timer is up and running
service:
name: pve_sd.timer
daemon_reload: yes
enabled: yes
state: "{{ pve_sd_service_stopped | ternary('stopped', 'started', 'started') }}"
become: True
become_user: root