diff options
author | Jan Chaloupka <jchaloup@redhat.com> | 2017-06-14 18:01:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-14 18:01:25 +0200 |
commit | cf81c53e8b747603ba6599f8c9fbdf50feff4c88 (patch) | |
tree | 6e5b8a6c6dfc2be5a41674b94b6e2a8d0192009f /roles/etcd_upgrade/tasks | |
parent | f7d8bd196c4cd7fed7de94a9ab87abd3295b5b06 (diff) | |
parent | 9e2fcb48c36b9478e34b93ed0025c6b77b7ad597 (diff) | |
download | openshift-cf81c53e8b747603ba6599f8c9fbdf50feff4c88.tar.gz openshift-cf81c53e8b747603ba6599f8c9fbdf50feff4c88.tar.bz2 openshift-cf81c53e8b747603ba6599f8c9fbdf50feff4c88.tar.xz openshift-cf81c53e8b747603ba6599f8c9fbdf50feff4c88.zip |
Merge pull request #4443 from ingvagabund/move-etcd-backup-to-etcd-common
move etcd backup to etcd_common role
Diffstat (limited to 'roles/etcd_upgrade/tasks')
-rw-r--r-- | roles/etcd_upgrade/tasks/backup.yml | 71 | ||||
-rw-r--r-- | roles/etcd_upgrade/tasks/main.yml | 4 |
2 files changed, 2 insertions, 73 deletions
diff --git a/roles/etcd_upgrade/tasks/backup.yml b/roles/etcd_upgrade/tasks/backup.yml deleted file mode 100644 index 1ea6fc59f..000000000 --- a/roles/etcd_upgrade/tasks/backup.yml +++ /dev/null @@ -1,71 +0,0 @@ ---- -# INPUT r_etcd_backup_sufix_name -# INPUT r_etcd_backup_tag -# OUTPUT r_etcd_upgrade_backup_complete -- set_fact: - # ORIGIN etcd_data_dir etcd_common.defaults - l_etcd_backup_dir: "{{ etcd_data_dir }}/openshift-backup-{{ r_etcd_backup_tag | default('') }}{{ r_etcd_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: 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: etcd_disk_usage - when: r_etcd_upgrade_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: > - {{ etcd_disk_usage.stdout }} Kb disk space required for etcd backup, - {{ avail_disk.stdout }} Kb available. - when: (r_etcd_upgrade_embedded_etcd | bool) and (etcd_disk_usage.stdout|int > 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: Install latest etcd for embedded - package: - name: etcd - state: latest - when: - - r_etcd_upgrade_embedded_etcd | bool - - not l_ostree_booted.stat.exists | bool - -- name: Generate etcd backup - command: > - {{ 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: v3_db - -- name: Copy etcd v3 data store - command: > - cp -a {{ etcd_data_dir }}/member/snap/db - {{ l_etcd_backup_dir }}/member/snap/ - when: v3_db.stat.exists - -- set_fact: - r_etcd_upgrade_backup_complete: True - -- name: Display location of etcd backup - debug: - msg: "Etcd backup created in {{ l_etcd_backup_dir }}" diff --git a/roles/etcd_upgrade/tasks/main.yml b/roles/etcd_upgrade/tasks/main.yml index 5178c14e3..129c69d6b 100644 --- a/roles/etcd_upgrade/tasks/main.yml +++ b/roles/etcd_upgrade/tasks/main.yml @@ -2,9 +2,9 @@ # INPUT r_etcd_upgrade_action - name: Fail if invalid etcd_upgrade_action provided fail: - msg: "etcd_upgrade role can only be called with 'upgrade' or 'backup'" + msg: "etcd_upgrade role can only be called with 'upgrade'" when: - - r_etcd_upgrade_action not in ['upgrade', 'backup'] + - r_etcd_upgrade_action not in ['upgrade'] - name: Detecting Atomic Host Operating System stat: |