You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
2.5 KiB
YAML

---
- name: Create required read only directories
file:
state: directory
path: "{{ item }}"
owner: "{{ system_user }}"
group: "{{ system_user }}"
mode: "u=rx,g=rx,o="
loop:
- "{{ configuration_directory }}"
- "{{ installation_directory }}"
- "{{ data_directory }}"
- name: Create required data directories
file:
state: directory
path: "{{ item }}"
owner: "{{ system_user }}"
group: "{{ system_user }}"
mode: "u=rwx,g=rx,o="
loop:
- "{{ files_directory }}"
- "{{ meta_directory }}"
# - "{{ socket_directory }}"
- name: Install auto update script for linx
template:
src: "update.sh"
dest: "{{ update_script_path }}"
owner: root
group: root
mode: "u=rwx,g=rx,o=r"
- name: Download linx
command: "{{ update_script_path }}"
args:
chdir: "{{ installation_directory }}"
creates: "{{ binary_path }}"
notify:
- restart linx
- name: Configure linx
template:
src: "config.ini"
dest: "{{ configuration_file }}"
owner: "{{ system_user }}"
group: "{{ system_user }}"
mode: "u=r,g=r,o="
notify:
- restart linx
# TODO Move to helper script
# TODO Implement proper change detection / renew hash on auth_code change
# TODO Set mode of resulting file correctly
- name: Create auth code file
file:
state: touch
path: "{{ auth_codes_file }}"
owner: "{{ system_user }}"
group: "{{ system_user }}"
mode: "u=rw,g=,o="
- name: Register auth code for uploading to linx
become_user: "{{ system_user }}"
shell: >-
echo {{ auth_code | quote }}
| {{ installation_directory | quote }}/linx-genkey
| grep --only-matching --perl-regexp '(?<=\s)[^\s]+='
> {{ auth_codes_file | quote }}
args:
chdir: "{{ user_directory }}"
# creates: "{{ auth_codes_file }}"
notify:
- restart linx
- name: Install helper script for uploading
template:
src: "upload.sh"
dest: "{{ user_directory }}/upload.sh"
owner: root
group: "{{ system_user }}"
mode: "u=rwx,g=rx,o="
validate: "{{ global_validate_shell_script }}"
- name: Register service for linx
template:
src: "linx.service"
dest: "{{ global_systemd_configuration_directory }}/{{ service_name }}"
owner: root
group: root
mode: "u=rw,g=r,o="
notify:
- reload systemd
- restart linx
- name: Enable auto update of linx
cron:
hour: 2
minute: 0
job: "{{ update_script_path }}"
name: "update linx for {{ domain }}"
state: present