create backup config dynamically

This commit is contained in:
2024-09-24 11:03:14 +02:00
parent 69ccca721f
commit e4116f9f94
2 changed files with 8 additions and 0 deletions

View File

@@ -18,6 +18,11 @@
dest: "/opt/backup/config/"
src: "config/"
- name: backup | system setup | copy backup config files 2
template:
src: "backup_remote.j2"
dest: "/opt/backup/config/backup_remote.conf"
- name: backup | system setup | add entries to ssh_config
blockinfile:
dest: "{{ ansible_user_dir }}/.ssh/config"

View File

@@ -0,0 +1,3 @@
{% for host in hostvars[inventory_hostname]['hosts_to_backup'] %}
{{ host.hostname }};/opt/backup/config/{{ host.hostname }}_includes.txt;/opt/backup/config/{{ host.hostname }}_excludes.txt
{% endfor %}