change: define pleroma variable as a dictionary

This commit is contained in:
Dan Anglin 2019-10-07 21:28:53 +01:00
parent dde9b88088
commit 53648b4a22
No known key found for this signature in database
GPG key ID: 7AC2B18EC1D09F27
6 changed files with 51 additions and 46 deletions

View file

@ -1,33 +1,35 @@
--- ---
pleroma_config_email: admin@localhost pleroma_defaults:
pleroma_config_notify_email: no_reply@{{ pleroma_config_host }} config:
pleroma_config_host: pleroma.localhost email: admin@localhost
pleroma_config_listeningPort: 4000 notifyEmail: no_reply@{{ pleroma.config.host }}
pleroma_config_instanceName: Pleroma host: pleroma.localhost
pleroma_config_instanceDescription: "A new Pleroma instance." listeningPort: 4000
pleroma_config_characterLimit: 5000 instanceName: "Ansible Pleroma"
pleroma_config_registrationsOpen: "false" instanceDescription: "A new single instance of Pleroma"
pleroma_config_dynamicConfiguration: "false" characterLimit: 5000
pleroma_config_healthCheck: "true" registrationsOpen: "false"
pleroma_config_logLevel: info dynamicConfiguration: "false"
pleroma_config_federating: "true" healthCheck: "true"
logLevel: info
pleroma_db_user: pleroma federating: "true"
pleroma_db_name: pleroma_db db:
name: pleroma_db
pleroma_db_hba: user: pleroma
postgresServer:
pg_hba:
- type: local - type: local
database: postgres database: postgres
user: postgres user: postgres
address: "" address: ""
method: peer method: peer
- type: local - type: local
database: "{{ pleroma_db_name }}" database: "{{ pleroma.config.db.name }}"
user: postgres user: postgres
address: "" address: ""
method: peer method: peer
- type: host - type: host
database: "{{ pleroma_db_name }}" database: "{{ pleroma.config.db.name }}"
user: "{{ pleroma_db_user }}" user: "{{ pleroma.config.db.user }}"
address: 127.0.0.1/32 address: 127.0.0.1/32
method: md5 method: md5

View file

@ -1,4 +1,7 @@
--- ---
- name: Combining Pleroma config details
set_fact: pleroma="{{ pleroma_defaults | combine(pleroma, recursive=true) }}"
- name: Installing and configuring PostgreSQL. - name: Installing and configuring PostgreSQL.
include_tasks: include_tasks:
file: postgres.yml file: postgres.yml

View file

@ -31,7 +31,7 @@
owner: root owner: root
path: "{{ pleroma_ssl_csrPath }}" path: "{{ pleroma_ssl_csrPath }}"
privatekey_path: "{{ pleroma_ssl_privateKeyPath }}" privatekey_path: "{{ pleroma_ssl_privateKeyPath }}"
common_name: "{{ pleroma_config_host }}" common_name: "{{ pleroma.config.host }}"
- name: Nginx -- Ensuring the self-signed certificate is generated. - name: Nginx -- Ensuring the self-signed certificate is generated.
openssl_certificate: openssl_certificate:

View file

@ -39,24 +39,24 @@
port: 5432 port: 5432
state: started state: started
- name: Postgres -- Ensuring that the database user {{ pleroma_db_user }} exists. - name: Postgres -- Ensuring that the database user {{ pleroma.config.db.user }} exists.
become_user: postgres become_user: postgres
postgresql_user: postgresql_user:
db: postgres db: postgres
encrypted: yes encrypted: yes
name: "{{ pleroma_db_user }}" name: "{{ pleroma.config.db.user }}"
password: "{{ pleroma_db_password }}" password: "{{ pleroma.config.db.password }}"
state: present state: present
vars: vars:
ansible_ssh_pipelining: true ansible_ssh_pipelining: true
- name: Postgres -- Ensuring that the database {{ pleroma_db_name }} exists. - name: Postgres -- Ensuring that the database {{ pleroma.config.db.name }} exists.
become_user: postgres become_user: postgres
postgresql_db: postgresql_db:
conn_limit: "20" conn_limit: "20"
encoding: UTF-8 encoding: UTF-8
name: "{{ pleroma_db_name }}" name: "{{ pleroma.config.db.name }}"
owner: "{{ pleroma_db_user }}" owner: "{{ pleroma.config.db.user }}"
state: present state: present
vars: vars:
ansible_ssh_pipelining: true ansible_ssh_pipelining: true
@ -65,7 +65,7 @@
become_user: postgres become_user: postgres
postgresql_ext: postgresql_ext:
name: "{{ item }}" name: "{{ item }}"
db: "{{ pleroma_db_name }}" db: "{{ pleroma.config.db.name }}"
state: present state: present
loop: loop:
- citext - citext

View file

@ -2,7 +2,7 @@ proxy_cache_path /tmp/pleroma-media-cache levels=1:2 keys_zone=pleroma_media_cac
inactive=720m use_temp_path=off; inactive=720m use_temp_path=off;
server { server {
server_name {{ pleroma_config_host }}; server_name {{ pleroma.config.host }};
listen 80; listen 80;
listen [::]:80; listen [::]:80;
@ -25,13 +25,13 @@ server {
ssl_session_cache shared:ssl_session_cache:10m; ssl_session_cache shared:ssl_session_cache:10m;
server { server {
server_name {{ pleroma_config_host }}; server_name {{ pleroma.config.host }};
listen 443 ssl http2; listen 443 ssl http2;
listen [::]:443 ssl http2; listen [::]:443 ssl http2;
ssl_session_timeout 5m; ssl_session_timeout 5m;
# ssl_trusted_certificate /etc/letsencrypt/live/{{ pleroma_config_host }}/chain.pem; # ssl_trusted_certificate /etc/letsencrypt/live/{{ pleroma.config.host }}/chain.pem;
ssl_certificate {{ pleroma_ssl_selfSignedCertPath }}; ssl_certificate {{ pleroma_ssl_selfSignedCertPath }};
ssl_certificate_key {{ pleroma_ssl_privateKeyPath }}; ssl_certificate_key {{ pleroma_ssl_privateKeyPath }};
@ -62,7 +62,7 @@ server {
# this is explicitly IPv4 since Pleroma.Web.Endpoint binds on IPv4 only # this is explicitly IPv4 since Pleroma.Web.Endpoint binds on IPv4 only
# and `localhost.` resolves to [::0] on some systems: see issue #930 # and `localhost.` resolves to [::0] on some systems: see issue #930
proxy_pass http://127.0.0.1:{{ pleroma_config_listeningPort }}; proxy_pass http://127.0.0.1:{{ pleroma.config.listeningPort }};
client_max_body_size 16m; client_max_body_size 16m;
} }
@ -80,6 +80,6 @@ server {
chunked_transfer_encoding on; chunked_transfer_encoding on;
proxy_ignore_headers Cache-Control; proxy_ignore_headers Cache-Control;
proxy_hide_header Cache-Control; proxy_hide_header Cache-Control;
proxy_pass http://localhost:{{ pleroma_config_listeningPort }}; proxy_pass http://localhost:{{ pleroma.config.listeningPort }};
} }
} }

View file

@ -1,4 +1,4 @@
# TYPE DATABASE USER ADDRESS METHOD # TYPE DATABASE USER ADDRESS METHOD
{% for i in pleroma_db_hba %} {% for i in pleroma.postgresServer.pg_hba %}
{{ i.type }} {{ i.database }} {{ i.user }} {{ i.address }} {{ i.method }} {{ i.type }} {{ i.database }} {{ i.user }} {{ i.address }} {{ i.method }}
{% endfor %} {% endfor %}