generated from sebclem/ansible-playbook-template
This commit is contained in:
parent
fa1c4c5999
commit
47f065d800
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,6 +1,6 @@
|
||||||
# ---> Ansible
|
# ---> Ansible
|
||||||
*.retry
|
*.retry
|
||||||
*vault_token
|
|
||||||
roles/*
|
roles/*
|
||||||
!roles/requirements.yml
|
!roles/requirements.yml
|
||||||
node_modules
|
node_modules
|
||||||
|
|
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -6,5 +6,6 @@
|
||||||
"**/.woodpecker/*.yml": "yaml"
|
"**/.woodpecker/*.yml": "yaml"
|
||||||
},
|
},
|
||||||
"ansible.ansible.useFullyQualifiedCollectionNames": true,
|
"ansible.ansible.useFullyQualifiedCollectionNames": true,
|
||||||
"editor.formatOnSave": true
|
"editor.formatOnSave": true,
|
||||||
|
"ansible.python.interpreterPath": "/root/.virtualenvs/ansible/bin/python"
|
||||||
}
|
}
|
||||||
|
|
3
credentials/vault_token
Executable file
3
credentials/vault_token
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
bw get password 8b2cc036-1b49-4891-aff9-b4fcd6d9f3ec
|
|
@ -5,6 +5,9 @@ borg_version: "1.2.3"
|
||||||
|
|
||||||
home: /home/backup
|
home: /home/backup
|
||||||
pool: "{{ home }}/repos"
|
pool: "{{ home }}/repos"
|
||||||
|
service_name: "{{ pool[1:] | replace('/', '-') }}"
|
||||||
|
|
||||||
|
nfs_url: 10.23.0.11:/media/big_data/Infra/borg
|
||||||
|
|
||||||
auth_users:
|
auth_users:
|
||||||
- host: docker.home
|
- host: docker.home
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
$ANSIBLE_VAULT;1.1;AES256
|
|
||||||
64343764653264313038396261633363376366373462316234623132306465343431393966623534
|
|
||||||
6332363366396161323561623130303130613234373966320a303163643663653930633235306331
|
|
||||||
37313338303637336133356535653636333462343237646438373830313835333834343133636136
|
|
||||||
3565626161353363640a393632346535353636356134663263356361656561383866643533376138
|
|
||||||
3137
|
|
|
@ -1,26 +1,28 @@
|
||||||
---
|
---
|
||||||
- name: Ansible-borg-server-playbook
|
- name: Ansible-borg-server-playbook
|
||||||
hosts: nodes
|
hosts: nodes
|
||||||
|
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
- name: Load secrets
|
|
||||||
ansible.builtin.include_vars:
|
|
||||||
file: "{{ inventory_dir }}/secrets/{{ inventory_hostname }}.yml"
|
|
||||||
tags:
|
|
||||||
- always
|
|
||||||
post_tasks:
|
|
||||||
- name: Install nfs-common
|
- name: Install nfs-common
|
||||||
ansible.builtin.package:
|
ansible.builtin.package:
|
||||||
name: nfs-common
|
name: nfs-common
|
||||||
tags:
|
tags:
|
||||||
- mount
|
- mount
|
||||||
|
|
||||||
- name: Add repo mount
|
- name: Add repo mount
|
||||||
ansible.posix.mount:
|
ansible.builtin.template:
|
||||||
src: 10.23.0.11:/media/big_data/Infra/borg
|
src: "mnt-borg.{{ item }}.j2"
|
||||||
path: "{{ pool }}"
|
dest: "/etc/systemd/system/{{ service_name }}.{{ item }}"
|
||||||
opts: rw,sync,hard,_netdev
|
tags:
|
||||||
state: mounted
|
- mount
|
||||||
fstype: nfs
|
loop:
|
||||||
|
- automount
|
||||||
|
- mount
|
||||||
|
|
||||||
|
- name: Enable automount
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: "{{ service_name }}.automount"
|
||||||
|
state: started
|
||||||
|
enabled: true
|
||||||
tags:
|
tags:
|
||||||
- mount
|
- mount
|
||||||
|
|
||||||
|
|
10
playbooks/templates/mnt-borg.automount.j2
Normal file
10
playbooks/templates/mnt-borg.automount.j2
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{{ ansible_managed | comment }}
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=Automount Borg repos
|
||||||
|
|
||||||
|
[Automount]
|
||||||
|
Where={{pool}}
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
14
playbooks/templates/mnt-borg.mount.j2
Normal file
14
playbooks/templates/mnt-borg.mount.j2
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{{ ansible_managed | comment }}
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=Borg repos moint
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Mount]
|
||||||
|
What={{nfs_url}}
|
||||||
|
Where={{pool}}
|
||||||
|
Type=nfs
|
||||||
|
Options=_netdev,auto
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Loading…
Reference in New Issue
Block a user