Styleguide improvements
This commit is contained in:
parent
3e1b0473cc
commit
01bc64e95c
@ -2,7 +2,7 @@
|
||||
|
||||
- name: Configure Borg backup
|
||||
hosts: all
|
||||
become: True
|
||||
become: true
|
||||
|
||||
roles:
|
||||
- role: borgbackup
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
borgbackup_required: True
|
||||
borgbackup_required: true
|
||||
|
||||
borgbackup_client_user: root
|
||||
borgbackup_ssh_key: "~{{ borgbackup_client_user }}/.ssh/id_borg_rsa"
|
||||
@ -36,8 +36,8 @@ borgbackup_cron_day: "*"
|
||||
borgbackup_cron_hour: "{{ 5|random(seed=inventory_hostname) }}"
|
||||
borgbackup_cron_minute: "{{ 59|random(seed=inventory_hostname) }}"
|
||||
|
||||
borgbackup_appendonly: False
|
||||
borgbackup_appendonly_repoconfig: False
|
||||
borgbackup_appendonly: false
|
||||
borgbackup_appendonly_repoconfig: false
|
||||
borgbackup_management_station: ''
|
||||
borgbackup_management_user: ''
|
||||
borgbackup_management_ssh_pubkey: ''
|
||||
|
@ -5,15 +5,15 @@ galaxy_info:
|
||||
license: MIT
|
||||
min_ansible_version: 1.9
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- all
|
||||
- name: Debian
|
||||
versions:
|
||||
- all
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- all
|
||||
- name: EL
|
||||
versions:
|
||||
- all
|
||||
- name: Debian
|
||||
versions:
|
||||
- all
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- all
|
||||
galaxy_tags:
|
||||
- borg
|
||||
- borgbackup
|
||||
|
@ -2,7 +2,7 @@
|
||||
- name: client | generate ssh key for this machine
|
||||
user:
|
||||
name: "{{ borgbackup_client_user }}"
|
||||
generate_ssh_key: yes
|
||||
generate_ssh_key: true
|
||||
ssh_key_bits: 2048
|
||||
ssh_key_file: "{{ borgbackup_ssh_key }}"
|
||||
ssh_key_type: rsa
|
||||
@ -10,19 +10,19 @@
|
||||
- name: client | fetch ssh-key
|
||||
shell: "cat {{ borgbackup_ssh_key }}.pub"
|
||||
register: sshkey
|
||||
changed_when: False
|
||||
changed_when: false
|
||||
|
||||
- name: client | write passphrase
|
||||
lineinfile:
|
||||
dest: "~{{ borgbackup_client_user }}/.borg.passphrase"
|
||||
state: "present"
|
||||
line: 'export BORG_PASSPHRASE="{{ borgbackup_passphrase }}"'
|
||||
create: "yes"
|
||||
create: true
|
||||
|
||||
- name: client | disable strict key checking for backup servers
|
||||
blockinfile:
|
||||
dest: "~{{ borgbackup_client_user }}/.ssh/config"
|
||||
create: yes
|
||||
create: true
|
||||
marker: "### {mark} ANSIBLE MANAGED BLOCK {{ item.fqdn }} ###"
|
||||
content: |
|
||||
Host {{ item.fqdn }}
|
||||
@ -46,7 +46,7 @@
|
||||
- name: client | get authorized_keys file
|
||||
raw: scp {{ item.user }}@{{ item.fqdn }}:.ssh/authorized_keys /tmp/authkeys-{{ item.type }}-{{ item.fqdn }}-authkeys
|
||||
delegate_to: localhost
|
||||
become: no
|
||||
become: false
|
||||
when: item.type in ['rsync.net','hetzner']
|
||||
with_items: "{{ borgbackup_servers }}"
|
||||
changed_when: false
|
||||
@ -57,9 +57,9 @@
|
||||
key: "{{ sshkey.stdout }}"
|
||||
key_options: 'command="cd {{ item.pool }}/{{ inventory_hostname }};/usr/local/bin/borg1 serve {% if borgbackup_appendonly %}--append-only {% endif %} --restrict-to-path {{ item.pool }}/{{ inventory_hostname }}",no-port-forwarding,no-X11-forwarding,no-pty,no-agent-forwarding,no-user-rc'
|
||||
path: "/tmp/authkeys-{{ item.type }}-{{ item.fqdn }}-authkeys"
|
||||
manage_dir: no
|
||||
manage_dir: false
|
||||
delegate_to: localhost
|
||||
become: no
|
||||
become: false
|
||||
when: item.type in ['rsync.net','hetzner']
|
||||
with_items: "{{ borgbackup_servers }}"
|
||||
register: authkeys
|
||||
@ -67,7 +67,7 @@
|
||||
- name: client | upload local authorized_keys to rsync.net / hetzner
|
||||
raw: scp /tmp/authkeys-{{ item.type }}-{{ item.fqdn }}-authkeys {{ item.user }}@{{ item.fqdn }}:.ssh/authorized_keys
|
||||
delegate_to: localhost
|
||||
become: no
|
||||
become: false
|
||||
when: item.type in ['rsync.net','hetzner'] and authkeys.changed
|
||||
with_items: "{{ borgbackup_servers }}"
|
||||
|
||||
@ -76,7 +76,7 @@
|
||||
path: /tmp/authkeys-{{ item.type }}-{{ item.fqdn }}-authkeys
|
||||
state: absent
|
||||
delegate_to: localhost
|
||||
become: no
|
||||
become: false
|
||||
with_items: "{{ borgbackup_servers }}"
|
||||
when: authkeys.changed
|
||||
changed_when: false
|
||||
@ -109,12 +109,12 @@
|
||||
day: "{{ borgbackup_cron_day }}"
|
||||
job: "/usr/local/bin/borg-backup backup"
|
||||
|
||||
- name: client | disable automysqlbackup cronjob, it's in our pre-backup-tasks
|
||||
- name: client | disable automysqlbackup cronjob, it's in our pre-backup-tasks
|
||||
lineinfile:
|
||||
dest: "/etc/cron.daily/automysqlbackup"
|
||||
regexp: "^/usr/sbin/automysqlbackup$"
|
||||
line: "#/usr/sbin/automysqlbackup"
|
||||
state: "present"
|
||||
backrefs: "yes"
|
||||
create: "no"
|
||||
backrefs: true
|
||||
create: false
|
||||
when: automysql.stat.isdir is defined and automysql.stat.isdir == True
|
||||
|
@ -1,6 +1,7 @@
|
||||
---
|
||||
# Due to inverse logic behaviour when searching for an item in an undefined list.
|
||||
- set_fact:
|
||||
- name: setting facts
|
||||
set_fact:
|
||||
borgbackup_servers_group: "{{ groups.borgbackup_servers | default([]) }} "
|
||||
borgbackup_management_group: "{{ groups.borgbackup_management | default([]) }}"
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
- name: management | get rsync.net authorized_keys file
|
||||
raw: scp {{ item.user }}@{{ item.fqdn }}:.ssh/authorized_keys /tmp/rsync.net-{{ item.fqdn }}-authkeys
|
||||
delegate_to: localhost
|
||||
become: no
|
||||
become: false
|
||||
when: item.type == 'rsync.net'
|
||||
with_items: "{{ borgbackup_servers }}"
|
||||
changed_when: false
|
||||
@ -30,9 +30,9 @@
|
||||
user: "{{ ansible_user_id }}"
|
||||
key: "{{ borgbackup_management_ssh_pubkey }}"
|
||||
path: "/tmp/rsync.net-{{ item.fqdn }}-authkeys"
|
||||
manage_dir: no
|
||||
manage_dir: false
|
||||
delegate_to: localhost
|
||||
become: no
|
||||
become: false
|
||||
when: item.type == 'rsync.net'
|
||||
with_items: "{{ borgbackup_servers }}"
|
||||
register: authkeys
|
||||
@ -40,7 +40,7 @@
|
||||
- name: management | upload local authorized_keys to rsync.net
|
||||
raw: scp /tmp/rsync.net-{{ item.fqdn }}-authkeys {{ item.user }}@{{ item.fqdn }}:.ssh/authorized_keys
|
||||
delegate_to: localhost
|
||||
become: no
|
||||
become: false
|
||||
when: item.type == 'rsync.net' and authkeys.changed
|
||||
with_items: "{{ borgbackup_servers }}"
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
path: /tmp/rsync.net-{{ item.fqdn }}-authkeys
|
||||
state: absent
|
||||
delegate_to: localhost
|
||||
become: no
|
||||
become: false
|
||||
with_items: "{{ borgbackup_servers }}"
|
||||
when: authkeys.changed
|
||||
changed_when: false
|
||||
|
Loading…
Reference in New Issue
Block a user