feat: install and librepages/librepages with new db and unix user

This commit is contained in:
Aravinth Manivannan 2022-12-30 05:18:05 +05:30
parent 6cddd76963
commit 7f308e343c
Signed by: realaravinth
GPG Key ID: AD9F0F08E855ED88
1 changed files with 82 additions and 0 deletions

82
debian/ansible/install-librepages.yml vendored Normal file
View File

@ -0,0 +1,82 @@
---
- 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