ansible-infra/ansible_collections/nullified/infrastructure/roles/deluge/tasks/gather_facts.yml

28 lines
1.2 KiB
YAML

---
- name: find systemd unit directory
become: true
ansible.builtin.command: pkg-config systemd --variable=systemdsystemunitdir
changed_when: false
register: systemd_unit_directory_cmd
- name: find systemd version
become: true
ansible.builtin.shell: >
systemctl --version | awk '{if($1=="systemd" && $2~"^[0-9]+$"){print $2}}'
changed_when: false
register: systemd_version_cmd
- name: set facts
ansible.builtin.set_fact:
systemd_unit_directory: "{{ systemd_unit_directory_cmd.stdout }}"
systemd_version: "{{ systemd_version_cmd.stdout | int }}"
deluge_web_password_salt: "{{ deluge_web_password_salt | default(lookup('ansible.builtin.password', '/dev/null', chars=['ascii_letters', 'digits'], length=40), true) }}"
- name: compute sha1 digest
ansible.builtin.shell: >
echo -n "${DELUGED_PASSWD_SALT}${DELUGED_PASSWD}" | openssl dgst -sha1 -r | cut -d ' ' -f 1
register: deluge_pwd_sha1
changed_when: false
environment:
DELUGED_PASSWD: '{{ deluge_web_password }}'
DELUGED_PASSWD_SALT: '{{ deluge_web_password_salt }}'
- name: set facts
ansible.builtin.set_fact:
deluge_web_password_hash: "{{ deluge_pwd_sha1.stdout }}"