From 098e93cc02adb16f35574127ba86326a8e236a94 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 7 Jun 2017 15:53:31 +0200 Subject: etcd: copy previous database when migrating to system container Signed-off-by: Giuseppe Scrivano --- roles/etcd/tasks/system_container.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'roles/etcd') diff --git a/roles/etcd/tasks/system_container.yml b/roles/etcd/tasks/system_container.yml index 72ffadbd2..34bff52b1 100644 --- a/roles/etcd/tasks/system_container.yml +++ b/roles/etcd/tasks/system_container.yml @@ -15,6 +15,30 @@ {%- endif -%} {% endfor -%} +- name: Check for previous etcd data store + stat: + path: "{{ etcd_data_dir }}/member/" + register: src_datastore + +- name: Check for etcd system container data store + stat: + path: "{{ r_etcd_common_system_container_host_dir }}/etcd.etcd/member" + register: dest_datastore + +- name: Ensure that etcd system container data dirs exist + file: path="{{ item }}" state=directory + with_items: + - "{{ r_etcd_common_system_container_host_dir }}/etc" + - "{{ r_etcd_common_system_container_host_dir }}/etcd.etcd" + +- name: Copy etcd data store + command: > + cp -a {{ etcd_data_dir }}/member + {{ r_etcd_common_system_container_host_dir }}/etcd.etcd/member + when: + - src_datastore.stat.exists + - not dest_datastore.stat.exists + - name: Install or Update Etcd system container package oc_atomic_container: name: etcd -- cgit v1.2.3 From 8b29fcfca4a244802b725118869d0370a7c715c4 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 7 Jun 2017 15:55:06 +0200 Subject: etcd: unmask system container service before installing it Signed-off-by: Giuseppe Scrivano --- roles/etcd/tasks/system_container.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'roles/etcd') diff --git a/roles/etcd/tasks/system_container.yml b/roles/etcd/tasks/system_container.yml index 34bff52b1..af972bf47 100644 --- a/roles/etcd/tasks/system_container.yml +++ b/roles/etcd/tasks/system_container.yml @@ -15,6 +15,32 @@ {%- endif -%} {% endfor -%} +- name: Check etcd system container package + command: > + atomic containers list --no-trunc -a -f container=etcd -f backend=ostree + register: etcd_result + +- name: Unmask etcd service + systemd: + name: etcd + state: stopped + enabled: yes + masked: no + daemon_reload: yes + register: task_result + failed_when: task_result|failed and 'could not' not in task_result.msg|lower + when: "'etcd' in etcd_result.stdout" + +- name: Disable etcd_container + systemd: + name: etcd_container + state: stopped + enabled: no + masked: yes + daemon_reload: yes + register: task_result + failed_when: task_result|failed and 'could not' not in task_result.msg|lower + - name: Check for previous etcd data store stat: path: "{{ etcd_data_dir }}/member/" -- cgit v1.2.3 From b29bf363e254f3d1967a015a225579e6a5e8e1a1 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 7 Jun 2017 15:58:18 +0200 Subject: etcd: system container defines ETCD_(PEER_)?TRUSTED_CA_FILE Signed-off-by: Giuseppe Scrivano --- roles/etcd/tasks/system_container.yml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'roles/etcd') diff --git a/roles/etcd/tasks/system_container.yml b/roles/etcd/tasks/system_container.yml index af972bf47..f1d948d16 100644 --- a/roles/etcd/tasks/system_container.yml +++ b/roles/etcd/tasks/system_container.yml @@ -85,3 +85,5 @@ - ETCD_PEER_CA_FILE={{ etcd_system_container_conf_dir }}/ca.crt - ETCD_PEER_CERT_FILE={{ etcd_system_container_conf_dir }}/peer.crt - ETCD_PEER_KEY_FILE={{ etcd_system_container_conf_dir }}/peer.key + - ETCD_TRUSTED_CA_FILE={{ etcd_system_container_conf_dir }}/ca.crt + - ETCD_PEER_TRUSTED_CA_FILE={{ etcd_system_container_conf_dir }}/ca.crt -- cgit v1.2.3