summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Chaloupka <jchaloup@redhat.com>2017-07-05 15:49:26 +0200
committerJan Chaloupka <jchaloup@redhat.com>2017-07-05 16:14:11 +0200
commit9a2352c645f833e3e1217e45b6dc7196cd761a30 (patch)
treedf7a29b151a8ca130e8fe4f1775676de38819a10
parentb7104cf8e01f94f9029a0808eb9eb2c6cb6107b2 (diff)
downloadopenshift-9a2352c645f833e3e1217e45b6dc7196cd761a30.tar.gz
openshift-9a2352c645f833e3e1217e45b6dc7196cd761a30.tar.bz2
openshift-9a2352c645f833e3e1217e45b6dc7196cd761a30.tar.xz
openshift-9a2352c645f833e3e1217e45b6dc7196cd761a30.zip
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 }}