Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
b84afb3abf
|
|||
|
65a02177fa
|
|||
|
9eb3e446af
|
|||
|
52bb82f900
|
|||
|
f657767632
|
|||
| 5bcdf66bb5 | |||
|
8f14ec2e69
|
|||
|
6f73b83bc0
|
@@ -16,3 +16,10 @@ backup_hosts:
|
|||||||
keep_daily: 7
|
keep_daily: 7
|
||||||
keep_weekly: 4
|
keep_weekly: 4
|
||||||
keep_monthly: 6
|
keep_monthly: 6
|
||||||
|
portainer1-jim.im.lab:
|
||||||
|
storage_size_gb: 5
|
||||||
|
source_directories:
|
||||||
|
- /data/compose
|
||||||
|
keep_daily: 7
|
||||||
|
keep_weekly: 4
|
||||||
|
keep_monthly: 6
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
# Canonical user list — consumed by both setup_linux.yml and
|
||||||
|
# initial_install/roles/users.
|
||||||
|
users:
|
||||||
|
- name: automation
|
||||||
|
shell: /bin/bash
|
||||||
|
sudo_nopasswd: true
|
||||||
|
ssh_keys:
|
||||||
|
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEx+ltCKNIEM7F4PzGLv22cIu7N0Fpn5gxwV02xq0GS9 automation@internet-master.cz"
|
||||||
|
|
||||||
|
- name: hellsoslocal
|
||||||
|
shell: /bin/bash
|
||||||
|
sudo_nopasswd: true
|
||||||
|
ssh_keys:
|
||||||
|
- "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAB+wC3T4/HSs1q5jf34sCqicSQOb05k+bxfmNMMKEGzRrGT3BfCG428F19OBIswvcuBPC0Q4TpPz84BkiATCx2o1JUH1xIOFcHzxxXbyzHAhjwto1wOr1DkwZWAvDPbdnJ39OsC0EdmrAHSXut93q4vzOsLlS34bOWP1THGY9nBKOHwJUQmS5tLw6dqbhKA886TrPXJDR9euEC+SYaytMyDUPYEa6dlDyRp77eII/uI/hf/6e+34wm9XyFyGMiMrQeO0u6Gq5NhsoBlhrCW3ds0To+DBZ/YKNzpzcN+uPKM1+r9nN8KwdwjRkQEwSdB4osz/UeGTiXB0jwb0+ftFthBFdOil86cd1OiAMmuKB/19QHv0NsVhs2JocP5JcrAgx8ktQzLIkOM4lt6Kt9rjHv1KNfdsZdiHqlOwrDv9B2Ei44qEUAsWlFSzEi7R3mOED4F04N3FeQ9TkrRRH6SE733t1Kum2VAz6wr4BSNyYxQOCnXoANy/JyoM5e5tQ7pht7tuxX78zhFlC7pAmVu0dnCQimSsIsXNlYGM7DQ7QMva8mKu49V3B7tU0ChghSRJUb2Sg0tkTAxzCR+WOOf8kAnkXNOV5vExQ3h5Xmb52A+az37Hyex379ryKqpffaf9RTx9pBagQf1XbUtA4KazuEi3fMmqCQjz+xFZJAZQ== hellsos@hellsos-PC"
|
||||||
|
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKhfQt1VNQo8EbIog4yjU5VEF3mTyMEC7o1Qe95X4JwG jan@rabcan.cz"
|
||||||
|
|
||||||
|
- name: jimlocal
|
||||||
|
shell: /bin/bash
|
||||||
|
sudo_nopasswd: true
|
||||||
|
ssh_keys:
|
||||||
|
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPFS4fsqMjMMu/Bi/884bw7yJBqvWusDRESvanH6Owco jakub@jimbuntu"
|
||||||
@@ -34,6 +34,16 @@
|
|||||||
no_log: false
|
no_log: false
|
||||||
when: not ipa_client_conf.stat.exists
|
when: not ipa_client_conf.stat.exists
|
||||||
|
|
||||||
|
- name: Prioritize SSS over local accounts in NSS
|
||||||
|
ansible.builtin.lineinfile:
|
||||||
|
path: /etc/nsswitch.conf
|
||||||
|
regexp: '^{{ item }}:'
|
||||||
|
line: '{{ item }}: sss files systemd'
|
||||||
|
loop:
|
||||||
|
- passwd
|
||||||
|
- group
|
||||||
|
notify: Restart SSSD
|
||||||
|
|
||||||
- name: Enable mkhomedir
|
- name: Enable mkhomedir
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
argv:
|
argv:
|
||||||
|
|||||||
@@ -1,28 +1,5 @@
|
|||||||
---
|
---
|
||||||
- name: Define users
|
# `users` comes from group_vars/all/users.yml
|
||||||
ansible.builtin.set_fact:
|
|
||||||
users:
|
|
||||||
- name: automation
|
|
||||||
shell: /bin/bash
|
|
||||||
sudo_nopasswd: true
|
|
||||||
ssh_keys:
|
|
||||||
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEx+ltCKNIEM7F4PzGLv22cIu7N0Fpn5gxwV02xq0GS9 automation@internet-master.cz"
|
|
||||||
|
|
||||||
- name: hellsos
|
|
||||||
shell: /bin/bash
|
|
||||||
sudo_nopasswd: true
|
|
||||||
ssh_keys:
|
|
||||||
- "ssh-ed25519 AAAAC3..."
|
|
||||||
|
|
||||||
- name: jim
|
|
||||||
shell: /bin/bash
|
|
||||||
sudo_nopasswd: true
|
|
||||||
ssh_keys:
|
|
||||||
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPFS4fsqMjMMu/Bi/884bw7yJBqvWusDRESvanH6Owco jakub@jimbuntu"
|
|
||||||
|
|
||||||
# --------------------------------------------------
|
|
||||||
# Create users
|
|
||||||
# --------------------------------------------------
|
|
||||||
- name: Ensure users exist
|
- name: Ensure users exist
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
name: "{{ item.name }}"
|
name: "{{ item.name }}"
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ galera3 ansible_host=192.168.19.92
|
|||||||
galera2 ansible_host=192.168.19.91
|
galera2 ansible_host=192.168.19.91
|
||||||
testipaclient ansible_host=192.168.19.98
|
testipaclient ansible_host=192.168.19.98
|
||||||
testclient ansible_host=192.168.19.115
|
testclient ansible_host=192.168.19.115
|
||||||
portainer1_jim.im.lab ansible_host=192.168.19.7
|
portainer1-jim.im.lab ansible_host=192.168.19.7
|
||||||
|
|
||||||
[linux_servers_hellsos]
|
[linux_servers_hellsos]
|
||||||
portainer2_hellsos ansible_host=192.168.52.9
|
portainer2_hellsos ansible_host=192.168.52.9
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
# Schedule for our own borgmatic.timer (overrides the package-shipped unit).
|
||||||
|
# OnCalendar uses systemd.time(7) syntax. RandomizedDelaySec spreads load so
|
||||||
|
# every host doesn't hit the borg server at the same instant.
|
||||||
|
borgmatic_oncalendar: "*-*-* 03:00:00"
|
||||||
|
borgmatic_randomized_delay_sec: 3h
|
||||||
|
borgmatic_persistent: true
|
||||||
|
|
||||||
|
# Extra flags passed to the borgmatic invocation in our borgmatic.service.
|
||||||
|
borgmatic_verbosity_args: "--verbosity -1 --syslog-verbosity 1"
|
||||||
@@ -75,6 +75,29 @@
|
|||||||
group: root
|
group: root
|
||||||
mode: '0640'
|
mode: '0640'
|
||||||
|
|
||||||
|
- name: Deploy borgmatic systemd service (overrides package unit)
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: borgmatic.service.j2
|
||||||
|
dest: /etc/systemd/system/borgmatic.service
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
register: _borgmatic_service_unit
|
||||||
|
|
||||||
|
- name: Deploy borgmatic systemd timer (overrides package unit)
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: borgmatic.timer.j2
|
||||||
|
dest: /etc/systemd/system/borgmatic.timer
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
register: _borgmatic_timer_unit
|
||||||
|
|
||||||
|
- name: Reload systemd if units changed
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
daemon_reload: true
|
||||||
|
when: _borgmatic_service_unit is changed or _borgmatic_timer_unit is changed
|
||||||
|
|
||||||
- name: Enable and start borgmatic timer
|
- name: Enable and start borgmatic timer
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
name: borgmatic.timer
|
name: borgmatic.timer
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
# Managed by Ansible — do not edit by hand.
|
||||||
|
[Unit]
|
||||||
|
Description=borgmatic backup
|
||||||
|
Wants=network-online.target
|
||||||
|
After=network-online.target
|
||||||
|
# Don't run on battery power.
|
||||||
|
ConditionACPower=true
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
# Lower priority so backups don't starve foreground work.
|
||||||
|
Nice=19
|
||||||
|
CPUSchedulingPolicy=batch
|
||||||
|
IOSchedulingClass=best-effort
|
||||||
|
IOSchedulingPriority=7
|
||||||
|
IOWeight=100
|
||||||
|
Restart=no
|
||||||
|
# Prevent rate limiting of borgmatic log events.
|
||||||
|
LogRateLimitIntervalSec=0
|
||||||
|
# Delay start by a random amount handled in the timer; keep the service simple.
|
||||||
|
ExecStart=systemd-inhibit --who="borgmatic" --what="sleep:shutdown" --why="Prevent interrupting scheduled backup" /usr/bin/borgmatic {{ borgmatic_verbosity_args }}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# Managed by Ansible — do not edit by hand.
|
||||||
|
[Unit]
|
||||||
|
Description=Run borgmatic backup
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar={{ borgmatic_oncalendar }}
|
||||||
|
RandomizedDelaySec={{ borgmatic_randomized_delay_sec }}
|
||||||
|
Persistent={{ borgmatic_persistent | bool | lower }}
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
||||||
@@ -2,30 +2,7 @@
|
|||||||
- name: Baseline user setup
|
- name: Baseline user setup
|
||||||
hosts: all
|
hosts: all
|
||||||
become: true
|
become: true
|
||||||
|
tags: users
|
||||||
vars:
|
|
||||||
users:
|
|
||||||
- name: automation
|
|
||||||
shell: /bin/bash
|
|
||||||
groups: []
|
|
||||||
sudo_nopasswd: true
|
|
||||||
ssh_keys:
|
|
||||||
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEx+ltCKNIEM7F4PzGLv22cIu7N0Fpn5gxwV02xq0GS9 automation@internet-master.cz"
|
|
||||||
|
|
||||||
- name: hellsoslocal
|
|
||||||
shell: /bin/bash
|
|
||||||
groups: []
|
|
||||||
sudo_nopasswd: true
|
|
||||||
ssh_keys:
|
|
||||||
- "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAB+wC3T4/HSs1q5jf34sCqicSQOb05k+bxfmNMMKEGzRrGT3BfCG428F19OBIswvcuBPC0Q4TpPz84BkiATCx2o1JUH1xIOFcHzxxXbyzHAhjwto1wOr1DkwZWAvDPbdnJ39OsC0EdmrAHSXut93q4vzOsLlS34bOWP1THGY9nBKOHwJUQmS5tLw6dqbhKA886TrPXJDR9euEC+SYaytMyDUPYEa6dlDyRp77eII/uI/hf/6e+34wm9XyFyGMiMrQeO0u6Gq5NhsoBlhrCW3ds0To+DBZ/YKNzpzcN+uPKM1+r9nN8KwdwjRkQEwSdB4osz/UeGTiXB0jwb0+ftFthBFdOil86cd1OiAMmuKB/19QHv0NsVhs2JocP5JcrAgx8ktQzLIkOM4lt6Kt9rjHv1KNfdsZdiHqlOwrDv9B2Ei44qEUAsWlFSzEi7R3mOED4F04N3FeQ9TkrRRH6SE733t1Kum2VAz6wr4BSNyYxQOCnXoANy/JyoM5e5tQ7pht7tuxX78zhFlC7pAmVu0dnCQimSsIsXNlYGM7DQ7QMva8mKu49V3B7tU0ChghSRJUb2Sg0tkTAxzCR+WOOf8kAnkXNOV5vExQ3h5Xmb52A+az37Hyex379ryKqpffaf9RTx9pBagQf1XbUtA4KazuEi3fMmqCQjz+xFZJAZQ== hellsos@hellsos-PC"
|
|
||||||
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKhfQt1VNQo8EbIog4yjU5VEF3mTyMEC7o1Qe95X4JwG jan@rabcan.cz"
|
|
||||||
|
|
||||||
- name: jimlocal
|
|
||||||
shell: /bin/bash
|
|
||||||
groups: []
|
|
||||||
sudo_nopasswd: true
|
|
||||||
ssh_keys:
|
|
||||||
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPFS4fsqMjMMu/Bi/884bw7yJBqvWusDRESvanH6Owco jakub@jimbuntu"
|
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
@@ -124,4 +101,22 @@
|
|||||||
|
|
||||||
- name: Set system hostname to inventory_hostname
|
- name: Set system hostname to inventory_hostname
|
||||||
ansible.builtin.hostname:
|
ansible.builtin.hostname:
|
||||||
name: "{{ inventory_hostname }}"
|
name: "{{ inventory_hostname }}"
|
||||||
|
|
||||||
|
# ==============================
|
||||||
|
# FOURTH PLAY: FREEIPA / SSSD
|
||||||
|
# ==============================
|
||||||
|
|
||||||
|
- name: FreeIPA client setup
|
||||||
|
hosts: all
|
||||||
|
become: true
|
||||||
|
tags: never,sssd
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- role: initial_install/roles/freeipa_client
|
||||||
|
|
||||||
|
# ==============================
|
||||||
|
# FIFTH PLAY: BACKUP
|
||||||
|
# ==============================
|
||||||
|
|
||||||
|
- import_playbook: backup.yml
|
||||||
Reference in New Issue
Block a user