change: define pleroma variable as a dictionary
This commit is contained in:
parent
dde9b88088
commit
53648b4a22
6 changed files with 51 additions and 46 deletions
|
@ -1,33 +1,35 @@
|
|||
---
|
||||
pleroma_config_email: admin@localhost
|
||||
pleroma_config_notify_email: no_reply@{{ pleroma_config_host }}
|
||||
pleroma_config_host: pleroma.localhost
|
||||
pleroma_config_listeningPort: 4000
|
||||
pleroma_config_instanceName: Pleroma
|
||||
pleroma_config_instanceDescription: "A new Pleroma instance."
|
||||
pleroma_config_characterLimit: 5000
|
||||
pleroma_config_registrationsOpen: "false"
|
||||
pleroma_config_dynamicConfiguration: "false"
|
||||
pleroma_config_healthCheck: "true"
|
||||
pleroma_config_logLevel: info
|
||||
pleroma_config_federating: "true"
|
||||
|
||||
pleroma_db_user: pleroma
|
||||
pleroma_db_name: pleroma_db
|
||||
|
||||
pleroma_db_hba:
|
||||
- type: local
|
||||
database: postgres
|
||||
user: postgres
|
||||
address: ""
|
||||
method: peer
|
||||
- type: local
|
||||
database: "{{ pleroma_db_name }}"
|
||||
user: postgres
|
||||
address: ""
|
||||
method: peer
|
||||
- type: host
|
||||
database: "{{ pleroma_db_name }}"
|
||||
user: "{{ pleroma_db_user }}"
|
||||
address: 127.0.0.1/32
|
||||
method: md5
|
||||
pleroma_defaults:
|
||||
config:
|
||||
email: admin@localhost
|
||||
notifyEmail: no_reply@{{ pleroma.config.host }}
|
||||
host: pleroma.localhost
|
||||
listeningPort: 4000
|
||||
instanceName: "Ansible Pleroma"
|
||||
instanceDescription: "A new single instance of Pleroma"
|
||||
characterLimit: 5000
|
||||
registrationsOpen: "false"
|
||||
dynamicConfiguration: "false"
|
||||
healthCheck: "true"
|
||||
logLevel: info
|
||||
federating: "true"
|
||||
db:
|
||||
name: pleroma_db
|
||||
user: pleroma
|
||||
postgresServer:
|
||||
pg_hba:
|
||||
- type: local
|
||||
database: postgres
|
||||
user: postgres
|
||||
address: ""
|
||||
method: peer
|
||||
- type: local
|
||||
database: "{{ pleroma.config.db.name }}"
|
||||
user: postgres
|
||||
address: ""
|
||||
method: peer
|
||||
- type: host
|
||||
database: "{{ pleroma.config.db.name }}"
|
||||
user: "{{ pleroma.config.db.user }}"
|
||||
address: 127.0.0.1/32
|
||||
method: md5
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
---
|
||||
- name: Combining Pleroma config details
|
||||
set_fact: pleroma="{{ pleroma_defaults | combine(pleroma, recursive=true) }}"
|
||||
|
||||
- name: Installing and configuring PostgreSQL.
|
||||
include_tasks:
|
||||
file: postgres.yml
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
owner: root
|
||||
path: "{{ pleroma_ssl_csrPath }}"
|
||||
privatekey_path: "{{ pleroma_ssl_privateKeyPath }}"
|
||||
common_name: "{{ pleroma_config_host }}"
|
||||
common_name: "{{ pleroma.config.host }}"
|
||||
|
||||
- name: Nginx -- Ensuring the self-signed certificate is generated.
|
||||
openssl_certificate:
|
||||
|
|
|
@ -39,24 +39,24 @@
|
|||
port: 5432
|
||||
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
|
||||
postgresql_user:
|
||||
db: postgres
|
||||
encrypted: yes
|
||||
name: "{{ pleroma_db_user }}"
|
||||
password: "{{ pleroma_db_password }}"
|
||||
name: "{{ pleroma.config.db.user }}"
|
||||
password: "{{ pleroma.config.db.password }}"
|
||||
state: present
|
||||
vars:
|
||||
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
|
||||
postgresql_db:
|
||||
conn_limit: "20"
|
||||
encoding: UTF-8
|
||||
name: "{{ pleroma_db_name }}"
|
||||
owner: "{{ pleroma_db_user }}"
|
||||
name: "{{ pleroma.config.db.name }}"
|
||||
owner: "{{ pleroma.config.db.user }}"
|
||||
state: present
|
||||
vars:
|
||||
ansible_ssh_pipelining: true
|
||||
|
@ -65,7 +65,7 @@
|
|||
become_user: postgres
|
||||
postgresql_ext:
|
||||
name: "{{ item }}"
|
||||
db: "{{ pleroma_db_name }}"
|
||||
db: "{{ pleroma.config.db.name }}"
|
||||
state: present
|
||||
loop:
|
||||
- citext
|
||||
|
|
|
@ -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;
|
||||
|
||||
server {
|
||||
server_name {{ pleroma_config_host }};
|
||||
server_name {{ pleroma.config.host }};
|
||||
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
@ -25,13 +25,13 @@ server {
|
|||
ssl_session_cache shared:ssl_session_cache:10m;
|
||||
|
||||
server {
|
||||
server_name {{ pleroma_config_host }};
|
||||
server_name {{ pleroma.config.host }};
|
||||
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
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_key {{ pleroma_ssl_privateKeyPath }};
|
||||
|
||||
|
@ -62,7 +62,7 @@ server {
|
|||
|
||||
# this is explicitly IPv4 since Pleroma.Web.Endpoint binds on IPv4 only
|
||||
# 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;
|
||||
}
|
||||
|
@ -80,6 +80,6 @@ server {
|
|||
chunked_transfer_encoding on;
|
||||
proxy_ignore_headers Cache-Control;
|
||||
proxy_hide_header Cache-Control;
|
||||
proxy_pass http://localhost:{{ pleroma_config_listeningPort }};
|
||||
proxy_pass http://localhost:{{ pleroma.config.listeningPort }};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# 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 }}
|
||||
{% endfor %}
|
||||
|
|
Reference in a new issue