diff --git a/infra.yml b/infra.yml index a5e7b6b..e73c3c9 100644 --- a/infra.yml +++ b/infra.yml @@ -1,13 +1,13 @@ --- ## ETHERPAD -# - name: Etherpad -# hosts: paddone -# roles: -# - role: stable/common -# - role: stable/etherpad -# vars_files: -# - vars/etherpad.yml +- name: Etherpad + hosts: paddone + roles: + - role: stable/common + - role: stable/etherpad + vars_files: + - vars/etherpad.yml ## CICLES @@ -16,3 +16,16 @@ roles: - role: stable/common - role: stable/goploader + + +## GANCIO +- name: Gancio + hosts: gancio + roles: + - role: stable/common + - role: stable/gancio + vars_files: + - vars/gancio.yml + + +## MASTODON diff --git a/inventory.yml b/inventory.yml index 78e861f..ac7f75a 100644 --- a/inventory.yml +++ b/inventory.yml @@ -4,6 +4,9 @@ paddone: cicles: hosts: 192.168.199.105 +gancio: + hosts: 192.168.199.106 + all: vars: passwordstore_path: cisti.org/ansible diff --git a/roles/gancio/defaults/main.yml b/roles/gancio/defaults/main.yml deleted file mode 100644 index 83ca7fb..0000000 --- a/roles/gancio/defaults/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -database_password: "{{lookup('password', './.pass/gancio_db_password')}}" - diff --git a/roles/gancio/meta/main.yml b/roles/gancio/meta/main.yml deleted file mode 100644 index e8d7a4a..0000000 --- a/roles/gancio/meta/main.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -dependencies: - - # install nodejs - - role: nodejs - - # install postgres - # and create an etherpad user and db - - role: postgresql - vars: - username: gancio - password: "{{ database_password }}" - database: gancio - - # install caddy and configure it as reverse proxy - - role: caddy - vars: - caddy_config: | - {{hostname}} - encode gzip - reverse_proxy localhost:31337 \ No newline at end of file diff --git a/roles/stable/gancio/defaults/main.yml b/roles/stable/gancio/defaults/main.yml new file mode 100644 index 0000000..4b821b2 --- /dev/null +++ b/roles/stable/gancio/defaults/main.yml @@ -0,0 +1,7 @@ +--- +title: "Gancio" +listen_ip: "0.0.0.0" +listen_port: "13120" +url: "http://localhost:13120" +database_password: "{{lookup('community.general.passwordstore', '{{passwordstore_path}}/gancio/db_password create=True nosymbols=true')}}" + diff --git a/roles/stable/gancio/meta/main.yml b/roles/stable/gancio/meta/main.yml new file mode 100644 index 0000000..d263422 --- /dev/null +++ b/roles/stable/gancio/meta/main.yml @@ -0,0 +1,13 @@ +--- +dependencies: + + # install nodejs + - role: nodejs + + # install postgres + # and create an gancio user and db + - role: postgresql + vars: + username: gancio + password: "{{ database_password }}" + database: gancio diff --git a/roles/gancio/tasks/main.yml b/roles/stable/gancio/tasks/main.yml similarity index 61% rename from roles/gancio/tasks/main.yml rename to roles/stable/gancio/tasks/main.yml index 5bedac0..33f3ffe 100644 --- a/roles/gancio/tasks/main.yml +++ b/roles/stable/gancio/tasks/main.yml @@ -16,15 +16,24 @@ - name: NODE | Install gancio npm: + executable: /usr/bin/npm --unsafe-perm=true --allow-root name: gancio global: yes production: yes state: present + +- name: Copy settings + template: + src: config.json.j2 + dest: /srv/gancio/config.json + owner: gancio + group: gancio + mode: 0660 - name: NODE | Start APP become: true become_user: gancio - shell: pm2 start gancio start --db="postgres" + shell: pm2 start gancio -- start --config config.json args: chdir: /srv/gancio ignore_errors: yes \ No newline at end of file diff --git a/roles/stable/gancio/templates/config.json.j2 b/roles/stable/gancio/templates/config.json.j2 new file mode 100644 index 0000000..80cf19e --- /dev/null +++ b/roles/stable/gancio/templates/config.json.j2 @@ -0,0 +1,23 @@ +{ + "title": "{{title}}", + "baseurl": "{{url}}", + "server": { + "host": "{{listen_ip}}", + "port": {{listen_port}} + }, + "db": { + "dialect": "postgres", + "host": "/var/run/postgresql", + "database": "gancio", + "username": "gancio", + "password": "{{database_password}}", + "logging": false + }, + "upload_path": "/srv/gancio/uploads", + "smtp": { + "sendmail": true, + "newline": "unix", + "path": "/usr/sbin/sendmail" + }, + "secret": "{{lookup('community.general.passwordstore', '{{passwordstore_path}}/gancio/session_secret create=True nosymbols=true')}}" +} \ No newline at end of file diff --git a/vars/gancio.yml b/vars/gancio.yml new file mode 100644 index 0000000..2a1fc4f --- /dev/null +++ b/vars/gancio.yml @@ -0,0 +1,2 @@ +--- +url: "https://g.cisti.org" \ No newline at end of file