diff --git a/roles/ydbd_config/tasks/main.yml b/roles/ydbd_config/tasks/main.yml index f31c980..9116c66 100644 --- a/roles/ydbd_config/tasks/main.yml +++ b/roles/ydbd_config/tasks/main.yml @@ -12,6 +12,7 @@ command: "{{ ydb_dir }}/home/backup_config.sh {{ ydb_config_backup }}" become: true become_user: ydb + when: ydb_config_backup is defined - name: Copy the TLS ca.crt copy: src={{ ydb_tls_dir }}/ca.crt dest={{ ydb_dir }}/certs/ca.crt diff --git a/roles/ydbd_config/templates/backup_config.j2 b/roles/ydbd_config/templates/backup_config.j2 index 13c7674..0232ee4 100644 --- a/roles/ydbd_config/templates/backup_config.j2 +++ b/roles/ydbd_config/templates/backup_config.j2 @@ -7,6 +7,11 @@ set +u YDB_DIR="{{ ydb_dir }}" BACKUP_DIR=${YDB_DIR}/reserve/"$1" +if [ -z "$1" ] || [ "$1" = "none" ]; then + echo "$0: skipping configuration backup" >&2 + exit 0 +fi + if [ -d ${BACKUP_DIR} ]; then echo "$0: target directory already exists" >&2 exit 1 diff --git a/rolling-static.yaml b/rolling-static.yaml new file mode 100644 index 0000000..ef802dc --- /dev/null +++ b/rolling-static.yaml @@ -0,0 +1,5 @@ +# Rolling restart for the configured static nodes + +- hosts: ydbd_static + roles: + - role: ydbd_rolling_static diff --git a/run-rolling-static.sh b/run-rolling-static.sh new file mode 100755 index 0000000..0adfa8a --- /dev/null +++ b/run-rolling-static.sh @@ -0,0 +1,3 @@ +#! /bin/sh + +ansible-playbook -b -i hosts rolling-static.yaml