rename server group
This commit is contained in:
parent
dc72e03bb3
commit
a1209ca8c2
8 changed files with 37 additions and 33 deletions
|
|
@ -28,7 +28,7 @@
|
|||
key_options: 'command="cd {{ item.home }}{{ item.pool }}/{{ inventory_hostname }};borg serve {% if borgbackup_appendonly %}--append-only {% endif %}--restrict-to-path {{ item.home }}/{{ item.pool }}/{{ inventory_hostname }}",no-port-forwarding,no-X11-forwarding,no-pty,no-agent-forwarding,no-user-rc'
|
||||
delegate_to: "{{ item.fqdn }}"
|
||||
when: item.type == 'normal'
|
||||
with_items: "{{ backupservers }}"
|
||||
with_items: "{{ borgbackup_servers }}"
|
||||
|
||||
# rsync.net has no python, so we can only use raw to manage ssh keys - workaround with local tmp file
|
||||
- name: client | get rsync.net authorized_keys file
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
delegate_to: localhost
|
||||
become: no
|
||||
when: item.type == 'rsync.net'
|
||||
with_items: "{{ backupservers }}"
|
||||
with_items: "{{ borgbackup_servers }}"
|
||||
changed_when: false
|
||||
|
||||
- name: client | modify local rsync.net authorized_keys
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
delegate_to: localhost
|
||||
become: no
|
||||
when: item.type == 'rsync.net'
|
||||
with_items: "{{ backupservers }}"
|
||||
with_items: "{{ borgbackup_servers }}"
|
||||
register: authkeys
|
||||
|
||||
- name: client | upload local authorized_keys to rsync.net
|
||||
|
|
@ -57,7 +57,7 @@
|
|||
delegate_to: localhost
|
||||
become: no
|
||||
when: item.type == 'rsync.net' and authkeys.changed
|
||||
with_items: "{{ backupservers }}"
|
||||
with_items: "{{ borgbackup_servers }}"
|
||||
|
||||
- name: client | remove tmp authorized_keys files
|
||||
file:
|
||||
|
|
@ -65,7 +65,7 @@
|
|||
state: absent
|
||||
delegate_to: localhost
|
||||
become: no
|
||||
with_items: "{{ backupservers }}"
|
||||
with_items: "{{ borgbackup_servers }}"
|
||||
when: authkeys.changed
|
||||
changed_when: false
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
mode: "0755"
|
||||
url: "{{ borgbackup_download_url }}"
|
||||
delegate_to: "{{ item.fqdn }}"
|
||||
with_items: "{{ backupservers }}"
|
||||
with_items: "{{ borgbackup_servers }}"
|
||||
when: item.type == 'normal'
|
||||
|
||||
- name: server | create user
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
home: "{{ item.home }}"
|
||||
createhome: "yes"
|
||||
delegate_to: "{{ item.fqdn }}"
|
||||
with_items: "{{ backupservers }}"
|
||||
with_items: "{{ borgbackup_servers }}"
|
||||
when: item.type == 'normal'
|
||||
|
||||
- name: server | create directories
|
||||
|
|
@ -28,4 +28,4 @@
|
|||
owner: "{{ item.user }}"
|
||||
group: "{{ item.user }}"
|
||||
mode: "0770"
|
||||
with_items: "{{ backupservers }}"
|
||||
with_items: "{{ borgbackup_servers }}"
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
- include: install.yml
|
||||
when: >
|
||||
borgbackup_required == True or
|
||||
inventory_hostname in groups.backupservers
|
||||
inventory_hostname in groups.borgbackup_servers
|
||||
|
||||
- include: borg-server.yml
|
||||
when: inventory_hostname in groups.backupservers
|
||||
when: inventory_hostname in groups.borgbackup_servers
|
||||
|
||||
- include: borg-client.yml
|
||||
when: >
|
||||
borgbackup_required == True and
|
||||
inventory_hostname not in groups.backupservers
|
||||
inventory_hostname not in groups.borgbackup_servers
|
||||
|
||||
- include: management.yml
|
||||
when: >
|
||||
inventory_hostname in groups.borgbackup_management and
|
||||
inventory_hostname not in groups.backupservers
|
||||
inventory_hostname not in groups.borgbackup_servers
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
key: "{{ borgbackup_management_sshkey }}"
|
||||
delegate_to: "{{ item.fqdn }}"
|
||||
when: item.type == 'normal'
|
||||
with_items: "{{ backupservers }}"
|
||||
with_items: "{{ borgbackup_servers }}"
|
||||
|
||||
|
||||
# rsync.net has no python, so we can only use raw to manage ssh keys - workaround with local tmp file
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
delegate_to: localhost
|
||||
become: no
|
||||
when: item.type == 'rsync.net'
|
||||
with_items: "{{ backupservers }}"
|
||||
with_items: "{{ borgbackup_servers }}"
|
||||
changed_when: false
|
||||
|
||||
- name: management | modify local rsync.net authorized_keys
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
delegate_to: localhost
|
||||
become: no
|
||||
when: item.type == 'rsync.net'
|
||||
with_items: "{{ backupservers }}"
|
||||
with_items: "{{ borgbackup_servers }}"
|
||||
register: authkeys
|
||||
|
||||
- name: management | upload local authorized_keys to rsync.net
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
delegate_to: localhost
|
||||
become: no
|
||||
when: item.type == 'rsync.net' and authkeys.changed
|
||||
with_items: "{{ backupservers }}"
|
||||
with_items: "{{ borgbackup_servers }}"
|
||||
|
||||
- name: management | remove tmp authorized_keys files
|
||||
file:
|
||||
|
|
@ -50,6 +50,6 @@
|
|||
state: absent
|
||||
delegate_to: localhost
|
||||
become: no
|
||||
with_items: "{{ backupservers }}"
|
||||
with_items: "{{ borgbackup_servers }}"
|
||||
when: authkeys.changed
|
||||
changed_when: false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue