2021-07-12 20:38:50 +00:00
|
|
|
---
|
|
|
|
- block:
|
|
|
|
- name: Create group '{{ pve_sd_group }}'
|
|
|
|
group:
|
|
|
|
name: "{{ pve_sd_group }}"
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Create user '{{ pve_sd_user }}'
|
|
|
|
user:
|
2021-07-29 19:49:47 +00:00
|
|
|
comment: "{{ pve_sd_user_comment }}"
|
2021-07-12 20:38:50 +00:00
|
|
|
name: "{{ pve_sd_user }}"
|
|
|
|
group: "{{ pve_sd_group }}"
|
|
|
|
groups: "{{ pve_sd_extra_groups | join(',') }}"
|
|
|
|
|
|
|
|
- name: Upgrade python dependencies
|
|
|
|
pip:
|
|
|
|
name: "{{ item }}"
|
|
|
|
virtualenv: "{{ pve_sd_virtualenv }}"
|
|
|
|
virtualenv_command: "{{ pve_sd_virtualenv_command }}"
|
|
|
|
extra_args: --upgrade
|
2021-07-25 13:27:44 +00:00
|
|
|
umask: "{{ pve_sd_virtualenv_umask | default(omit) }}"
|
2021-07-12 20:38:50 +00:00
|
|
|
loop:
|
|
|
|
- pip
|
|
|
|
- setuptools
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
pip:
|
|
|
|
name: "{{ item }}"
|
|
|
|
virtualenv: "{{ pve_sd_virtualenv }}"
|
|
|
|
virtualenv_command: "{{ pve_sd_virtualenv_command }}"
|
2021-07-25 13:27:44 +00:00
|
|
|
umask: "{{ pve_sd_virtualenv_umask | default(omit) }}"
|
2021-07-12 20:38:50 +00:00
|
|
|
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 }}"
|
2021-07-25 13:27:44 +00:00
|
|
|
umask: "{{ pve_sd_virtualenv_umask | default(omit) }}"
|
2021-07-12 20:38:50 +00:00
|
|
|
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
|