summaryrefslogtreecommitdiffstats
path: root/pad/tasks
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2022-10-12 20:28:41 -0400
committerSacha Chua <sacha@sachachua.com>2022-10-12 20:28:41 -0400
commit28d2d8a0da8b624d0a256ac492afe7605fa8d260 (patch)
tree13966a255ea5659c0d8749799007e4c6b0e0e52d /pad/tasks
parentb0d8ea0d60bcf4626b84d20e99ea2fe93353b825 (diff)
downloademacsconf-ansible-28d2d8a0da8b624d0a256ac492afe7605fa8d260.tar.xz
emacsconf-ansible-28d2d8a0da8b624d0a256ac492afe7605fa8d260.zip
Be able to deploy pad to live0
Diffstat (limited to '')
-rw-r--r--pad/tasks/main.yml121
-rw-r--r--pad/tasks/mariadb.yml22
2 files changed, 92 insertions, 51 deletions
diff --git a/pad/tasks/main.yml b/pad/tasks/main.yml
index 8637406..bb3209d 100644
--- a/pad/tasks/main.yml
+++ b/pad/tasks/main.yml
@@ -1,70 +1,91 @@
---
# tasks file for pad
-- name: Add nodesource key
- apt_key:
- url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
- state: present
-- name: Add nodesource repository
- ansible.builtin.apt_repository:
- repo: deb https://deb.nodesource.com/node_13.x buster main
- update_cache: yes
-- name: Install packages
- apt:
- update_cache: yes
- name:
- - systemd
- - sudo
- - nodejs
- - mariadb-server
- - mariadb-client
- state: present
-- name: Create etherpad user
- user:
- name: etherpad
- home: /home/etherpad
- shell: /bin/bash
- state: present
-- name: Install etherpad
- git:
- repo: https://github.com/ether/etherpad-lite.git
- dest: "{{ etherpad_path }}"
- depth: 1
+- name: Set up packages as root
become: true
- become_user: etherpad
-- name: Configure etherpad
- template:
- src: templates/settings.json
- dest: "{{ etherpad_path }}/settings.json"
-- name: Set etherpad API key
- copy:
- content: "{{ etherpad_api_key }}"
- dest: "{{ etherpad_path }}/APIKEY.txt"
- owner: "{{ etherpad_user }}"
- mode: "0600"
-- name: Install dependencies
- shell: cd {{ etherpad_path }}; . src/bin/functions.sh; src/bin/installDeps.sh
+ block:
+ - name: Add nodesource key
+ apt_key:
+ url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
+ state: present
+ - name: Add nodesource repository
+ ansible.builtin.apt_repository:
+ repo: deb https://deb.nodesource.com/node_13.x buster main
+ update_cache: yes
+ - name: Install packages
+ apt:
+ update_cache: yes
+ name:
+ - systemd
+ - sudo
+ - nodejs
+ - mariadb-server
+ - mariadb-client
+ state: present
+ - name: Create etherpad user
+ user:
+ name: etherpad
+ home: /home/etherpad
+ shell: /bin/bash
+ state: present
+- include: mariadb.yml
become: true
- become_user: etherpad
-- name: Install etherpad plugins
- npm:
- name: ep_pad-lister
- path: "{{ etherpad_path }}"
+- name: Set up etherpad as the etherpad user
+ tags: etherpad-src
become: true
- become_user: etherpad
-- include: mariadb.yml
+ block:
+ - name: Install etherpad
+ git:
+ repo: https://github.com/ether/etherpad-lite.git
+ dest: "{{ etherpad_path }}"
+ depth: 1
+ - name: Configure etherpad
+ template:
+ src: templates/settings.json
+ dest: "{{ etherpad_path }}/settings.json"
+ - name: Install dependencies
+ shell: cd {{ etherpad_path }}; . src/bin/functions.sh; src/bin/installDeps.sh
+ - name: Install etherpad plugins
+ npm:
+ name: ep_pad-lister
+ path: "{{ etherpad_path }}"
+ - name: Change ownership
+ file:
+ dest: /home/etherpad/etherpad
+ owner: "{{ etherpad_user }}"
+ group: "{{ etherpad_group }}"
+ recurse: true
+ - name: Set etherpad API key
+ copy:
+ content: "{{ etherpad_api_key }}"
+ dest: "{{ etherpad_path }}/APIKEY.txt"
+ owner: "{{ etherpad_user }}"
+ mode: "0600"
- name: Install init.d configuration
tags: system
+ become: true
template:
src: etherpad.init.d
dest: /etc/init.d/etherpad
owner: root
group: root
+ mode: 0644
+ when: use_initd is defined
+- name: Install systemd configuration
+ tags: system
+ become: true
+ template:
+ src: etherpad.service
+ dest: /etc/systemd/system/etherpad.service
+ owner: root
+ group: root
mode: 0755
+ when: use_initd is not defined
- name: Start Etherpad
tags: system
+ become: true
service:
name: etherpad
- state: started
+ state: restarted
- tags: create-pads
include_vars:
file: talks.json
diff --git a/pad/tasks/mariadb.yml b/pad/tasks/mariadb.yml
index 7a406c9..8e613b6 100644
--- a/pad/tasks/mariadb.yml
+++ b/pad/tasks/mariadb.yml
@@ -5,10 +5,30 @@
- mariadb-server
- mariadb-client
- python3-mysqldb
+- name: Ensure anonymous users are not in the database
+ mysql_user:
+ name: ""
+ host: "{{ item }}"
+ state: absent
+ with_items:
+ - localhost
+ - 127.0.0.1
+ - ::1
+ - "%"
+- name: Ensure mysql is configured to bind only to localhost
+ ini_file:
+ dest: /etc/mysql/my.cnf
+ section: mysqld
+ option: "bind-address"
+ value: "127.0.0.1"
- name: Start MariaDB
service:
name: mysql
- state: started
+ state: restarted
+ enabled: yes
+ runlevel:
+ - 3
+ - 5
- name: Ensure emacsconf-pad database exists
mysql_db:
name: "{{ etherpad_database_name }}"