From e802cbb1011bf2abbea9cf9c88ac238157c57893 Mon Sep 17 00:00:00 2001 From: clarkzjw Date: Mon, 6 Mar 2023 10:55:13 -0800 Subject: add hetzner ansible playbooks --- hetzner/collection.yaml | 8 ++++++++ hetzner/mastodon.yml | 1 + hetzner/nginx.yaml | 1 + hetzner/pg_restore.yaml | 13 +++++++++++++ hetzner/psql.yaml | 19 +++++++++++++++++++ hetzner/user.yaml | 1 + 6 files changed, 43 insertions(+) create mode 100644 hetzner/collection.yaml create mode 100644 hetzner/pg_restore.yaml create mode 100644 hetzner/psql.yaml (limited to 'hetzner') diff --git a/hetzner/collection.yaml b/hetzner/collection.yaml new file mode 100644 index 0000000..5b133c2 --- /dev/null +++ b/hetzner/collection.yaml @@ -0,0 +1,8 @@ +--- +collections: + - name: community.general + version: 4.7.0 + - name: ansible.posix + version: 1.3.0 + - name: community.postgresql + version: 2.3.2 diff --git a/hetzner/mastodon.yml b/hetzner/mastodon.yml index 354390c..7fc3ec5 100644 --- a/hetzner/mastodon.yml +++ b/hetzner/mastodon.yml @@ -1,6 +1,7 @@ --- - name: Install Mastodon dependencies hosts: localhost + become: true tasks: - name: Install required packages apt: diff --git a/hetzner/nginx.yaml b/hetzner/nginx.yaml index 006d4e3..cfce968 100644 --- a/hetzner/nginx.yaml +++ b/hetzner/nginx.yaml @@ -1,6 +1,7 @@ --- - name: Install Nginx hosts: localhost + become: true tasks: - name: Install NGINX ansible.builtin.include_role: diff --git a/hetzner/pg_restore.yaml b/hetzner/pg_restore.yaml new file mode 100644 index 0000000..9ff1c7c --- /dev/null +++ b/hetzner/pg_restore.yaml @@ -0,0 +1,13 @@ +--- +- name: Postgresql + hosts: localhost + become: true + become_user: postgres + tasks: + - name: Restore Mastodon Database + postgresql_db: + state: restore + name: mastodon_production + target: "" + become: yes + become_user: postgres diff --git a/hetzner/psql.yaml b/hetzner/psql.yaml new file mode 100644 index 0000000..4941ea9 --- /dev/null +++ b/hetzner/psql.yaml @@ -0,0 +1,19 @@ +--- +- name: Postgresql + hosts: localhost + become: true + become_user: postgres + tasks: + - name: Create Mastodon Database + community.postgresql.postgresql_db: + name: mastodon_production + encoding: UTF-8 + lc_collate: en_US.UTF-8 + lc_ctype: en_US.UTF-8 + template: template0 + + - name: Create Postgresql User + community.postgresql.postgresql_user: + db: mastodon_production + user: mastodon + password: diff --git a/hetzner/user.yaml b/hetzner/user.yaml index bf21687..2308ff8 100644 --- a/hetzner/user.yaml +++ b/hetzner/user.yaml @@ -23,6 +23,7 @@ - lsb-release - cifs-utils - vnstat + - python3-psycopg2 - python3-dev - python3-pip - python3 -- cgit v1.2.3