diff options
Diffstat (limited to 'roles/etcd_common/tasks')
-rw-r--r-- | roles/etcd_common/tasks/backup.yml | 72 | ||||
-rw-r--r-- | roles/etcd_common/tasks/drop_etcdctl.yml | 12 | ||||
-rw-r--r-- | roles/etcd_common/tasks/main.yml | 9 |
3 files changed, 0 insertions, 93 deletions
diff --git a/roles/etcd_common/tasks/backup.yml b/roles/etcd_common/tasks/backup.yml deleted file mode 100644 index 4a4832275..000000000 --- a/roles/etcd_common/tasks/backup.yml +++ /dev/null @@ -1,72 +0,0 @@ ---- -- set_fact: - l_etcd_backup_dir: "{{ etcd_data_dir }}/openshift-backup-{{ r_etcd_common_backup_tag }}{{ r_etcd_common_backup_sufix_name }}" - -# TODO: replace shell module with command and update later checks -- name: Check available disk space for etcd backup - shell: df --output=avail -k {{ etcd_data_dir }} | tail -n 1 - register: l_avail_disk - # AUDIT:changed_when: `false` because we are only inspecting - # state, not manipulating anything - changed_when: false - -# TODO: replace shell module with command and update later checks -- name: Check current etcd disk usage - shell: du --exclude='*openshift-backup*' -k {{ etcd_data_dir }} | tail -n 1 | cut -f1 - register: l_etcd_disk_usage - when: r_etcd_common_embedded_etcd | bool - # AUDIT:changed_when: `false` because we are only inspecting - # state, not manipulating anything - changed_when: false - -- name: Abort if insufficient disk space for etcd backup - fail: - msg: > - {{ l_etcd_disk_usage.stdout }} Kb disk space required for etcd backup, - {{ l_avail_disk.stdout }} Kb available. - when: (r_etcd_common_embedded_etcd | bool) and (l_etcd_disk_usage.stdout|int > l_avail_disk.stdout|int) - -# For non containerized and non embedded we should have the correct version of -# etcd installed already. So don't do anything. -# -# For containerized installs we now exec into etcd_container -# -# For embedded non containerized we need to ensure we have the latest version -# etcd on the host. -- name: Detecting Atomic Host Operating System - stat: - path: /run/ostree-booted - register: l_ostree_booted - -- name: Install latest etcd for embedded - package: - name: etcd - state: latest - when: - - r_etcd_common_embedded_etcd | bool - - not l_ostree_booted.stat.exists | bool - -- name: Generate etcd backup - command: > - {{ r_etcd_common_etcdctl_command }} backup --data-dir={{ etcd_data_dir }} - --backup-dir={{ l_etcd_backup_dir }} - -# According to the docs change you can simply copy snap/db -# https://github.com/openshift/openshift-docs/commit/b38042de02d9780842dce95cfa0ef45d53b58bc6 -- name: Check for v3 data store - stat: - path: "{{ etcd_data_dir }}/member/snap/db" - register: l_v3_db - -- name: Copy etcd v3 data store - command: > - cp -a {{ etcd_data_dir }}/member/snap/db - {{ l_etcd_backup_dir }}/member/snap/ - when: l_v3_db.stat.exists - -- set_fact: - r_etcd_common_backup_complete: True - -- name: Display location of etcd backup - debug: - msg: "Etcd backup created in {{ l_etcd_backup_dir }}" diff --git a/roles/etcd_common/tasks/drop_etcdctl.yml b/roles/etcd_common/tasks/drop_etcdctl.yml deleted file mode 100644 index 6cb456677..000000000 --- a/roles/etcd_common/tasks/drop_etcdctl.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -- name: Install etcd for etcdctl - package: name=etcd{{ '-' + etcd_version if etcd_version is defined else '' }} state=present - when: not openshift.common.is_atomic | bool - -- name: Configure etcd profile.d alises - template: - dest: "/etc/profile.d/etcdctl.sh" - src: etcdctl.sh.j2 - mode: 0755 - owner: root - group: root diff --git a/roles/etcd_common/tasks/main.yml b/roles/etcd_common/tasks/main.yml deleted file mode 100644 index 6ed87e6c7..000000000 --- a/roles/etcd_common/tasks/main.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -- name: Fail if invalid r_etcd_common_action provided - fail: - msg: "etcd_common role can only be called with 'noop' or 'backup' or 'drop_etcdctl'" - when: r_etcd_common_action not in ['noop', 'backup', 'drop_etcdctl'] - -- name: Include main action task file - include: "{{ r_etcd_common_action }}.yml" - when: r_etcd_common_action != "noop" |