Compare commits
4 Commits
6e5547a7c5
...
2b5d0c8534
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b5d0c8534 | ||
|
|
e8e88e50a1 | ||
|
|
064e270ce4 | ||
|
|
4c454ec76c |
@@ -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
|
||||
```
|
||||
|
||||
13
docs/locale.md
Normal file
13
docs/locale.md
Normal 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"
|
||||
```
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace: uumas
|
||||
name: general
|
||||
version: 0.5.1
|
||||
version: 0.5.2
|
||||
readme: README.md
|
||||
authors:
|
||||
- uumas
|
||||
|
||||
1
roles/locale/README.md
Normal file
1
roles/locale/README.md
Normal file
@@ -0,0 +1 @@
|
||||
Generates and configures locales
|
||||
10
roles/locale/defaults/main.yml
Normal file
10
roles/locale/defaults/main.yml
Normal 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"
|
||||
|
||||
16
roles/locale/tasks/main.yml
Normal file
16
roles/locale/tasks/main.yml
Normal 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
|
||||
|
||||
6
roles/locale/templates/locale.j2
Normal file
6
roles/locale/templates/locale.j2
Normal file
@@ -0,0 +1,6 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
LANG="{{ lang }}"
|
||||
LC_MESSAGES="{{ lc_messages }}"
|
||||
LANGUAGE="{{ language }}"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
---
|
||||
|
||||
reverse_proxy_type: caddy
|
||||
proxy_target_protocol: http
|
||||
proxy_target_host: localhost
|
||||
|
||||
@@ -6,7 +6,13 @@
|
||||
marker: "# {mark} ANSIBLE MANAGED BLOCK {{ vhost_id }}"
|
||||
block: |
|
||||
{{ 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'
|
||||
backup: true
|
||||
|
||||
@@ -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
|
||||
include_tasks: "{{ reverse_proxy_type }}.yml"
|
||||
when: reverse_proxy_type != 'none'
|
||||
|
||||
Reference in New Issue
Block a user