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

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