Compare commits
15 Commits
c0753aeaa2
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d8bd645a80 | ||
|
|
6d2d305fd0 | ||
|
|
90ade1e766 | ||
|
|
f2840d79a7 | ||
|
|
217b79b225 | ||
|
|
37066850a0 | ||
|
|
7617edfdde | ||
|
|
e4c8a2343a | ||
|
|
9b40f06804 | ||
|
|
273da948b5 | ||
|
|
7e0538ae20 | ||
|
|
1c9649e8d6 | ||
|
|
648da9266b | ||
|
|
8af49bcc3e | ||
|
|
cb0817fc54 |
2
roles/automatic_updates/README.md
Normal file
2
roles/automatic_updates/README.md
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
This role enables automatic package updates.
|
||||||
|
It currently supports Debian and Ubuntu.
|
||||||
1
roles/borgmatic/README.md
Normal file
1
roles/borgmatic/README.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Installs borgmatic
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
- name: Gather facts
|
- name: Gather facts
|
||||||
ansible.builtin.setup:
|
ansible.builtin.setup:
|
||||||
delegate_facts: true
|
delegate_facts: true
|
||||||
|
ignore_unreachable: true
|
||||||
retries: 3
|
retries: 3
|
||||||
|
|
||||||
- name: Add ssh key to authorized_keys
|
- name: Add ssh key to authorized_keys
|
||||||
|
|||||||
1
roles/borgmatic_config/README.md
Normal file
1
roles/borgmatic_config/README.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Creates a bormatic configuration in /etc/borgmatic.d/ and creates the repos
|
||||||
@@ -1,4 +1,10 @@
|
|||||||
---
|
---
|
||||||
|
- name: Initialize borgmatic
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: borgmatic init --encryption repokey
|
||||||
|
register: _borgmatic_init_out
|
||||||
|
changed_when: _borgmatic_init_out.stdout | length > 0
|
||||||
|
|
||||||
- name: Restart borgmatic timer {{ borgmatic_config_name }}
|
- name: Restart borgmatic timer {{ borgmatic_config_name }}
|
||||||
ansible.builtin.systemd_service:
|
ansible.builtin.systemd_service:
|
||||||
name: "borgmatic@{{ borgmatic_config_name }}.timer"
|
name: "borgmatic@{{ borgmatic_config_name }}.timer"
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
dest: /etc/borgmatic.d/{{ borgmatic_config_name }}.yaml
|
dest: /etc/borgmatic.d/{{ borgmatic_config_name }}.yaml
|
||||||
mode: "0600"
|
mode: "0600"
|
||||||
no_log: true
|
no_log: true
|
||||||
|
notify: Initialize borgmatic
|
||||||
|
|
||||||
- name: Add systemd timer for borgmatic {{ borgmatic_config_name }}
|
- name: Add systemd timer for borgmatic {{ borgmatic_config_name }}
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ dependencies:
|
|||||||
vars:
|
vars:
|
||||||
compatcheck_supported_distributions:
|
compatcheck_supported_distributions:
|
||||||
- name: debian
|
- name: debian
|
||||||
version_min: 11
|
version_min: 12
|
||||||
- name: ubuntu
|
- name: ubuntu
|
||||||
version_min: 22
|
version_min: 22
|
||||||
|
- role: uumas.general.firewalld
|
||||||
|
|||||||
@@ -36,8 +36,19 @@
|
|||||||
marker: "# {mark} ANSIBLE MANAGED BLOCK general"
|
marker: "# {mark} ANSIBLE MANAGED BLOCK general"
|
||||||
block: |
|
block: |
|
||||||
{
|
{
|
||||||
email {{ caddy_admin_email }}
|
email {{ caddy_admin_email }}
|
||||||
}
|
}
|
||||||
validate: 'caddy validate --config %s --adapter caddyfile'
|
validate: 'caddy validate --config %s --adapter caddyfile'
|
||||||
backup: true
|
backup: true
|
||||||
notify: Reload caddy
|
notify: Reload caddy
|
||||||
|
|
||||||
|
- name: Open ports for caddy
|
||||||
|
ansible.posix.firewalld:
|
||||||
|
service: "{{ item }}"
|
||||||
|
state: enabled
|
||||||
|
permanent: true
|
||||||
|
immediate: true
|
||||||
|
loop:
|
||||||
|
- http
|
||||||
|
- https
|
||||||
|
- http3
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ argument_specs:
|
|||||||
- ubuntu
|
- ubuntu
|
||||||
- fedora
|
- fedora
|
||||||
- archlinux
|
- archlinux
|
||||||
|
- macosx
|
||||||
version_min:
|
version_min:
|
||||||
description: Earliest supported major version. Allows any version if not specified.
|
description: Earliest supported major version. Allows any version if not specified.
|
||||||
type: int
|
type: int
|
||||||
@@ -31,7 +32,9 @@ argument_specs:
|
|||||||
type: int
|
type: int
|
||||||
required: false
|
required: false
|
||||||
package_managers:
|
package_managers:
|
||||||
description: List of supported package managers. Defaults to apt for debian and ubuntu, dnf for fedora, pacman for archlinux
|
description: >-
|
||||||
|
List of supported package managers. Defaults to apt for debian and ubuntu,
|
||||||
|
dnf for fedora, pacman for archlinux, homebrew for macosx
|
||||||
type: list
|
type: list
|
||||||
required: false
|
required: false
|
||||||
elements: str
|
elements: str
|
||||||
@@ -40,3 +43,4 @@ argument_specs:
|
|||||||
- dnf
|
- dnf
|
||||||
- pacman
|
- pacman
|
||||||
- atomic_container
|
- atomic_container
|
||||||
|
- homebrew
|
||||||
|
|||||||
@@ -5,4 +5,5 @@ _compatcheck_default_package_managers:
|
|||||||
ubuntu: apt
|
ubuntu: apt
|
||||||
fedora: dnf
|
fedora: dnf
|
||||||
archlinux: pacman
|
archlinux: pacman
|
||||||
|
macosx: homebrew
|
||||||
_compatcheck_default_package_manager: "{{ _compatcheck_default_package_managers[ansible_distribution | lower] }}"
|
_compatcheck_default_package_manager: "{{ _compatcheck_default_package_managers[ansible_distribution | lower] }}"
|
||||||
|
|||||||
1
roles/firewalld/README.md
Normal file
1
roles/firewalld/README.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Installs firewalld
|
||||||
5
roles/firewalld/meta/argument_specs.yaml
Normal file
5
roles/firewalld/meta/argument_specs.yaml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
argument_specs:
|
||||||
|
main:
|
||||||
|
description: Installs firewalld
|
||||||
|
options: {}
|
||||||
9
roles/firewalld/meta/main.yaml
Normal file
9
roles/firewalld/meta/main.yaml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
dependencies:
|
||||||
|
- role: uumas.general.compatcheck
|
||||||
|
vars:
|
||||||
|
compatcheck_supported_distributions:
|
||||||
|
- name: debian
|
||||||
|
version_min: 12
|
||||||
|
- name: ubuntu
|
||||||
|
version_min: 22
|
||||||
4
roles/firewalld/tasks/main.yaml
Normal file
4
roles/firewalld/tasks/main.yaml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
- name: Install firewalld
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name: firewalld
|
||||||
2
roles/prometheus_node_exporter/defaults/main.yaml
Normal file
2
roles/prometheus_node_exporter/defaults/main.yaml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
prometheus_node_exporter_local_network: ""
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
- name: Restart prometheus-node-exporter
|
- name: Restart prometheus-node-exporter
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd_service:
|
||||||
name: prometheus-node-exporter
|
name: prometheus-node-exporter
|
||||||
state: restarted
|
state: restarted
|
||||||
|
|||||||
@@ -3,7 +3,10 @@ argument_specs:
|
|||||||
main:
|
main:
|
||||||
description: Installs and configures prometheus node exporter to listen on local ipv4 address
|
description: Installs and configures prometheus node exporter to listen on local ipv4 address
|
||||||
options:
|
options:
|
||||||
local_network:
|
prometheus_node_exporter_local_network:
|
||||||
description: The local ipv4 network block, listen address is taken from this block
|
description: >-
|
||||||
|
The local ipv4 network block, listen address is taken from this block.
|
||||||
|
If empty, listens on 0.0.0.0
|
||||||
type: str
|
type: str
|
||||||
required: true
|
required: false
|
||||||
|
default: ""
|
||||||
|
|||||||
@@ -1,9 +1,3 @@
|
|||||||
---
|
---
|
||||||
dependencies:
|
dependencies:
|
||||||
- role: uumas.general.compatcheck
|
- role: uumas.general.firewalld
|
||||||
vars:
|
|
||||||
compatcheck_supported_distributions:
|
|
||||||
- name: debian
|
|
||||||
version_min: 11
|
|
||||||
- name: ubuntu
|
|
||||||
version_min: 24
|
|
||||||
|
|||||||
@@ -1,7 +1,18 @@
|
|||||||
---
|
---
|
||||||
|
- name: Compatibility check
|
||||||
|
ansible.builtin.import_role:
|
||||||
|
name: uumas.general.compatcheck
|
||||||
|
vars:
|
||||||
|
compatcheck_supported_distributions:
|
||||||
|
- name: debian
|
||||||
|
version_min: 11
|
||||||
|
- name: ubuntu
|
||||||
|
version_min: 22
|
||||||
|
|
||||||
- name: Install prometheus node exporter
|
- name: Install prometheus node exporter
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
name: prometheus-node-exporter
|
name: prometheus-node-exporter
|
||||||
|
install_recommends: false
|
||||||
|
|
||||||
- name: Set prometheus options in /etc/default/prometheus-node-exporter
|
- name: Set prometheus options in /etc/default/prometheus-node-exporter
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
ARGS="--web.listen-address {{ (ansible_all_ipv4_addresses | ansible.utils.ipaddr(local_network))[0] }}:9100 --collector.logind --collector.systemd --collector.processes"
|
ARGS="--web.listen-address {{ (ansible_all_ipv4_addresses | ansible.utils.ipaddr(prometheus_node_exporter_local_network))[0] if prometheus_node_exporter_local_network | length > 0 else '0.0.0.0' }}:9100 --collector.logind --collector.systemd --collector.processes"
|
||||||
|
|||||||
@@ -26,7 +26,8 @@
|
|||||||
- name: Set ssh authorized keys for users
|
- name: Set ssh authorized keys for users
|
||||||
ansible.posix.authorized_key:
|
ansible.posix.authorized_key:
|
||||||
user: "{{ item.name }}"
|
user: "{{ item.name }}"
|
||||||
key: "{{ item.ssh_pubkey }}"
|
key: "{{ item.ssh_pubkeys | default([item.ssh_pubkey]) | join('\n') }}"
|
||||||
|
exclusive: true
|
||||||
when: item.state | default('present') == 'present'
|
when: item.state | default('present') == 'present'
|
||||||
loop: "{{ users }}"
|
loop: "{{ users }}"
|
||||||
|
|
||||||
|
|||||||
@@ -378,7 +378,9 @@ argument_specs:
|
|||||||
elements: dict
|
elements: dict
|
||||||
options:
|
options:
|
||||||
path:
|
path:
|
||||||
description: Path to match. Only supports full paths for now.
|
description: >-
|
||||||
|
Path to match.
|
||||||
|
If the value begins with ^ and end with $, the value is matched as regex.
|
||||||
type: str
|
type: str
|
||||||
required: true
|
required: true
|
||||||
type:
|
type:
|
||||||
@@ -565,8 +567,7 @@ argument_specs:
|
|||||||
match_headers:
|
match_headers:
|
||||||
description: >-
|
description: >-
|
||||||
Headers to match against.
|
Headers to match against.
|
||||||
The value is matched as regex.
|
If the value begins with ^ and end with $, the value is matched as regex.
|
||||||
^ and $ are implied, so don't add them yourself.
|
|
||||||
type: dict
|
type: dict
|
||||||
required: false
|
required: false
|
||||||
default: {}
|
default: {}
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
#jinja2: lstrip_blocks: True
|
#jinja2: lstrip_blocks: True
|
||||||
{{ vhost_domains | join(' ') }} {
|
{{ vhost_domains | join(' ') }} {
|
||||||
{% for location in _vhost_locations_complete %}
|
{% for location in _vhost_locations_complete %}
|
||||||
handle {{ location.path }} {
|
{% if location.path != '' %}
|
||||||
|
@{{ location.path }} path{{ '_regexp' if location.path.startswith('^') and location.path.endswith('$') else '' }} {{ location.path }}
|
||||||
|
handle @{{ location.path }} {
|
||||||
|
{% else %}
|
||||||
|
handle {
|
||||||
|
{% endif %}
|
||||||
{% for matcher in location.matchers %}
|
{% for matcher in location.matchers %}
|
||||||
{% if matcher.name != '' %}
|
{% if matcher.name != '' %}
|
||||||
@{{ matcher.name }} {
|
@{{ matcher.name }} {
|
||||||
|
|||||||
Reference in New Issue
Block a user