Compare commits

...

4 Commits

Author SHA1 Message Date
uumas
2b5d0c8534 0.5.2 2022-05-12 00:50:22 +03:00
uumas
e8e88e50a1 add locale role 2022-05-12 00:50:00 +03:00
uumas
064e270ce4 more modular reverse proxy config 2022-05-12 00:49:40 +03:00
uumas
4c454ec76c rename common docs 2022-05-11 21:31:54 +03:00
10 changed files with 72 additions and 2 deletions

View File

@@ -10,4 +10,5 @@ These variables are used by multiple roles and have the following default values
``` ```
reverse_proxy_type: caddy # Allowed values: caddy, none reverse_proxy_type: caddy # Allowed values: caddy, none
```

13
docs/locale.md Normal file
View File

@@ -0,0 +1,13 @@
Generates loacles defined in `gen_locales`, sets `LANG`, `LC_MESSAGES`, and `LANGUAGE` to the values of
`lang`, `lc_messages` and `language` respectively. These have the following defaults:
```
gen_locales:
- en_US.UTF-8
- en_GB.UTF-8
lang: en_US.UTF-8
lc_messages: "{{ lang }}"
language: "en_US:en"
```

View File

@@ -2,7 +2,7 @@
namespace: uumas namespace: uumas
name: general name: general
version: 0.5.1 version: 0.5.2
readme: README.md readme: README.md
authors: authors:
- uumas - uumas

1
roles/locale/README.md Normal file
View File

@@ -0,0 +1 @@
Generates and configures locales

View File

@@ -0,0 +1,10 @@
---
gen_locales:
- en_US.UTF-8
- en_GB.UTF-8
lang: en_US.UTF-8
lc_messages: "{{ lang }}"
language: "en_US:en"

View File

@@ -0,0 +1,16 @@
---
- name: Install locales package
package:
name: locales
- name: Generate locales
locale_gen:
name: "{{ item }}"
loop: "{{ gen_locales }}"
- name: Put default locale config in place
template:
src: locale.j2
dest: /etc/default/locale

View File

@@ -0,0 +1,6 @@
# {{ ansible_managed }}
LANG="{{ lang }}"
LC_MESSAGES="{{ lc_messages }}"
LANGUAGE="{{ language }}"

View File

@@ -1,3 +1,5 @@
--- ---
reverse_proxy_type: caddy reverse_proxy_type: caddy
proxy_target_protocol: http
proxy_target_host: localhost

View File

@@ -6,7 +6,13 @@
marker: "# {mark} ANSIBLE MANAGED BLOCK {{ vhost_id }}" marker: "# {mark} ANSIBLE MANAGED BLOCK {{ vhost_id }}"
block: | block: |
{{ vhost_domains | join(' ') }} { {{ vhost_domains | join(' ') }} {
reverse_proxy {{ proxy_target }} reverse_proxy {{ proxy_target_protocol }}://{{ proxy_target_host }}:{{ proxy_target_port }} {
{% if proxy_target_protocol == 'https' and proxy_target_host == 'localhost' %}
transport http {
tls_insecure_skip_verify
}
{% endif %}
}
} }
validate: 'caddy validate --config %s --adapter caddyfile' validate: 'caddy validate --config %s --adapter caddyfile'
backup: true backup: true

View File

@@ -1,5 +1,20 @@
--- ---
- block:
- name: Split legacy proxy_target to protocol, host and port
set_fact:
proxy_target_split_protocol: "{{ proxy_target.split('://') }}"
proxy_target_split_host: "{{ (proxy_target_split_protocol | last).split(':') }}"
proxy_target_host: "{{ proxy_target_split_host[0] }}"
proxy_target_port: "{{ proxy_target_split_host[1] }}"
- name: Set proxy_target_protocol based on proxy_target
set_fact:
proxy_target_protocol: "{{ proxy_target_split_protocol[0] }}"
when: proxy_target_split_protocol | length == 2
when: proxy_target is defined and proxy_target_port is not defined
- name: Setup {{ vhost_id }} reverse proxy - name: Setup {{ vhost_id }} reverse proxy
include_tasks: "{{ reverse_proxy_type }}.yml" include_tasks: "{{ reverse_proxy_type }}.yml"
when: reverse_proxy_type != 'none' when: reverse_proxy_type != 'none'