Infrastructure-as-Code/debian/ansible/install-librepages-forms.yml

82 lines
2.2 KiB
YAML

---
- name: Install LibrePages Componenets
hosts: debainbasic
remote_user: root
tasks:
- name: Ensure all VMs are reachable
ansible.builtin.ping:
- name: Create /tmp/librepages/forms
ansible.builtin.file:
path: /tmp/librepages/forms
state: directory
recurse: true
- name: Create /etc/librepages/forms
ansible.builtin.file:
path: /etc/librepages/forms
state: directory
recurse: true
- name: Get librepages/forms
get_url:
url: https://dl.librepages.org/librepages/forms/master/forms-master-linux-amd64.tar.gz
dest:
/tmp/librepages/forms
# master branch build checksum keeps changing
# checksum: sha256:2478f65d0736e45e45c8c7deb420b73b7b020ed6eae4ec73724cbf974f4df50c
- name: Extract downloaded librepages/forms
command: >-
tar -xzvf /tmp/librepages/forms/forms-master-linux-amd64.tar.gz
--directory /tmp/librepages/forms
- name: Install librepages/forms binary
command: >-
cp -f
/tmp/librepages/forms/forms-master-linux-amd64/forms
/usr/bin/
- name: Copy configuration file
command: >-
cp -f
/tmp/librepages/forms/forms-master-linux-amd64/config/config.toml
/etc/librepages/forms/
- name: Copy systemd file
command: >-
cp -f
/tmp/librepages/forms/forms-master-linux-amd64/contrib/librepages-forms.service
/etc/systemd/system/
- name: "Create librepages/forms database"
postgresql_db:
state: present
name: "librepages-forms"
become: yes
become_user: postgres
- name: "Create db user"
postgresql_user:
state: present
name: "librepages-forms"
password: "supercomplicatedpassword"
become: yes
become_user: postgres
- name: "Grant db user access to app db"
postgresql_privs:
type: database
database: "librepages-forms"
roles: "librepages-forms"
grant_option: no
privs: all
become: yes
become_user: postgres
- name: Added a librepages account
ansible.builtin.user:
name: librepages-forms
shell: /bin/nologin