Added evobackup-client role #83

Manually merged
Ghost merged 17 commits from evobackup-client into unstable 2020-02-06 22:31:45 +01:00
5 changed files with 18 additions and 18 deletions
Showing only changes of commit c773c901f2 - Show all commits

View file

@ -1,13 +1,13 @@
---
evobackup-client__root_key_path: "/root/.ssh/evobackup_id"
Review

I like the idea, but I'm not sure if we need a separate key for backups only

I like the idea, but I'm not sure if we need a separate key for backups only
Review

This idea was brought up by @jlecour I can let him expand on it.

This idea was brought up by @jlecour I can let him expand on it.
evobackup-client___cron_path: "/etc/cron.daily/zzz_evobackup"
evobackup-client___cron_template_name: "zzz_evobackup"
evobackup-client___mail: null
evobackup-client__cron_path: "/etc/cron.daily/zzz_evobackup"
evobackup-client__cron_template_name: "zzz_evobackup"
evobackup-client__mail: null
evobackup-client__pid_path: "/var/run/evobackup.pid"
evobackup-client___log_path: "/var/log/evobackup.log"
evobackup-client__log_path: "/var/log/evobackup.log"
evobackup-client__backup_path: "/home/backup"
evobackup-client___ssh_port: null
evobackup-client___hosts: null
evobackup-client__ssh_port: null

each backup server can have a different ssh port. Itr should be in the evobackup-client___hosts dictionary.

each backup server can have a different ssh port. Itr should be in the `evobackup-client___hosts` dictionary.
Outdated
Review

I havent met that case in the wild. It would be annoying to have to define the full dict for every host though. Not sure there is a clean way around this.

I havent met that case in the wild. It would be annoying to have to define the full dict for every host though. Not sure there is a clean way around this.
evobackup-client__hosts: null
# - name: "backups.example.org"
# ip: "xxx.xxx.xxx.xxx"
# fingerprint: "ecdsa-sha2-nistp256 ..."

View file

@ -12,7 +12,7 @@
blockinfile:
dest: /etc/default/minifirewall
marker: "# evobackup ssh port"
block: "evobackup_port={{ evobackup-client___ssh_port }}"
block: "evobackup_port={{ evobackup-client__ssh_port }}"
when: evobackup-client__minifirewall.stat.exists
tags:
- evobackup-client
@ -23,8 +23,8 @@
dest: /etc/default/minifirewall
marker: "# {{ item.name }}"
block: |
/sbin/iptables -A INPUT -p tcp --sport {{ evobackup-client___ssh_port }} --dport 1024:65535 -s {{ item.ip }} -m state --state ESTABLISHED,RELATED -j ACCEPT
with_items: "{{ evobackup-client___hosts }}"
/sbin/iptables -A INPUT -p tcp --sport {{ evobackup-client__ssh_port }} --dport 1024:65535 -s {{ item.ip }} -m state --state ESTABLISHED,RELATED -j ACCEPT
with_items: "{{ evobackup-client__hosts }}"
when: evobackup-client__minifirewall.stat.exists
tags:
- evobackup-client

View file

@ -3,13 +3,13 @@
- name: Upload evobackup script
template:
src: "{{ item }}"
dest: "{{ evobackup-client___cron_path }}"
dest: "{{ evobackup-client__cron_path }}"
force: true
mode: 0755
with_first_found:
- "templates/evobackup-client/{{ evobackup-client___cron_template_name }}.{{ inventory_hostname }}.sh.j2"
- "templates/evobackup-client/{{ evobackup-client___cron_template_name }}.{{ host_group }}.sh.j2"
- "templates/evobackup-client/{{ evobackup-client___cron_template_name }}.sh.j2"
- "templates/evobackup-client/{{ evobackup-client__cron_template_name }}.{{ inventory_hostname }}.sh.j2"
- "templates/evobackup-client/{{ evobackup-client__cron_template_name }}.{{ host_group }}.sh.j2"
- "templates/evobackup-client/{{ evobackup-client__cron_template_name }}.sh.j2"
- "zzz_evobackup.default.sh.j2"
tags:
- evobackup-client

View file

@ -3,9 +3,9 @@
- name: Verify evolix backup servers
known_hosts:
path: /root/.ssh/known_hosts
name: "[{{ item.name }}]:{{ evobackup-client___ssh_port }}"
key: "[{{ item.name }}]:{{ evobackup-client___ssh_port }} {{ item.fingerprint }}"
with_list: "{{ evobackup-client___hosts }}"
name: "[{{ item.name }}]:{{ evobackup-client__ssh_port }}"
key: "[{{ item.name }}]:{{ evobackup-client__ssh_port }} {{ item.fingerprint }}"
with_list: "{{ evobackup-client__hosts }}"
tags:
- evobackup-client
- evobackup-client-backup-hosts

View file

@ -18,10 +18,10 @@
##### Configuration ###################################################
# email adress for notifications
MAIL={{ evobackup-client___mail }}
MAIL={{ evobackup-client__mail }}

This probably is a bad copy/paste.

This probably is a bad copy/paste.
Outdated
Review

Damnit, thought I had erased that.

Damnit, thought I had erased that.
# list of hosts (hostname or IP) and SSH port for Rsync
SERVERS="{% for host in evobackup-client___hosts %}{{ host.name }}:{{ evobackup-client___ssh_port }} {% endfor %}"
SERVERS="{% for host in evobackup-client__hosts %}{{ host.name }}:{{ evobackup-client__ssh_port }} {% endfor %}"

i'm not sure this loop produces the intended output.

i'm not sure this loop produces the intended output.
Outdated
Review

It produces:

SERVERS="hostname:port hostname:port "

The extra space at the end is not the cleanest, but it does not break the script.

It produces: ``` SERVERS="hostname:port hostname:port " ``` The extra space at the end is not the cleanest, but it does not break the script.
Outdated
Review

But this is kind of reason why it's a pull request and not a straight merge.

But this is kind of reason why it's a pull request and not a straight merge.
Outdated
Review

This should not be marked as outdated, this conversation is still open.

This should not be marked as outdated, this conversation is still open.
# timeout (in seconds) for SSH connections
SSH_CONNECT_TIMEOUT=30