summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Chaloupka <jchaloup@redhat.com>2017-07-06 08:42:12 +0200
committerGitHub <noreply@github.com>2017-07-06 08:42:12 +0200
commitcd578ccdb6cced49fde252077e135288d20f8e2a (patch)
treec023b8a337ccde77c92144df19fd36b7fc43ca25
parentac6bb627a424110192e2ee55b7a3059f48b19d85 (diff)
parent9a2352c645f833e3e1217e45b6dc7196cd761a30 (diff)
downloadopenshift-cd578ccdb6cced49fde252077e135288d20f8e2a.tar.gz
openshift-cd578ccdb6cced49fde252077e135288d20f8e2a.tar.bz2
openshift-cd578ccdb6cced49fde252077e135288d20f8e2a.tar.xz
openshift-cd578ccdb6cced49fde252077e135288d20f8e2a.zip
Merge pull request #4680 from ingvagabund/set-label-of-var-lib-etcd
set the proper label of /var/lib/etcd directory
-rw-r--r--roles/etcd_common/tasks/backup.yml15
1 files changed, 15 insertions, 0 deletions
diff --git a/roles/etcd_common/tasks/backup.yml b/roles/etcd_common/tasks/backup.yml
index 1a0b857f1..2bc486d3f 100644
--- a/roles/etcd_common/tasks/backup.yml
+++ b/roles/etcd_common/tasks/backup.yml
@@ -61,6 +61,21 @@
- r_etcd_common_embedded_etcd | bool
- not l_ostree_booted.stat.exists | bool
+- name: Check selinux label of '{{ l_etcd_data_dir }}'
+ command: >
+ stat -c '%C' {{ l_etcd_data_dir }}
+ register: l_etcd_selinux_labels
+
+- debug:
+ msg: "{{ l_etcd_selinux_labels }}"
+
+- name: Make sure the '{{ l_etcd_data_dir }}' has the proper label
+ command: >
+ chcon -t svirt_sandbox_file_t "{{ l_etcd_data_dir }}"
+ when:
+ - l_etcd_selinux_labels.rc == 0
+ - "'svirt_sandbox_file_t' not in l_etcd_selinux_labels.stdout"
+
- name: Generate etcd backup
command: >
{{ r_etcd_common_etcdctl_command }} backup --data-dir={{ l_etcd_incontainer_data_dir }}