glusterfs.yml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. ---
  2. - name: Install GlusterFS storage plugin dependencies
  3. package: name=glusterfs-fuse state=present
  4. when: not openshift.common.is_atomic | bool
  5. - name: Check for existence of fusefs sebooleans
  6. command: getsebool {{ item }}
  7. register: fusefs_getsebool_status
  8. when:
  9. - ansible_selinux
  10. - ansible_selinux.status == "enabled"
  11. failed_when: false
  12. changed_when: false
  13. with_items:
  14. - virt_use_fusefs
  15. - virt_sandbox_use_fusefs
  16. - name: Set seboolean to allow gluster storage plugin access from containers
  17. seboolean:
  18. name: "{{ item.item }}"
  19. state: yes
  20. persistent: yes
  21. when:
  22. - ansible_selinux
  23. - ansible_selinux.status == "enabled"
  24. - item.rc == 0
  25. # We need to detect whether or not the boolean is an alias, since `seboolean`
  26. # will error if it is an alias. We do this by inspecting stdout for the boolean name,
  27. # since getsebool prints the resolved name. (At some point Ansible's seboolean module
  28. # should learn to deal with aliases)
  29. - item.item in item.stdout # Boolean does not have an alias.
  30. - ansible_python_version | version_compare('3', '<')
  31. with_items: "{{ fusefs_getsebool_status.results }}"
  32. # Workaround for https://github.com/openshift/openshift-ansible/issues/4438
  33. # Use command module rather than seboolean module to set GlusterFS booleans.
  34. # TODO: Remove this task and the ansible_python_version comparison in
  35. # the previous task when the problem has been addressed in current
  36. # ansible release.
  37. - name: Set seboolean to allow gluster storage plugin access from containers (python 3)
  38. command: >
  39. setsebool -P {{ item.item }} on
  40. when:
  41. - ansible_selinux
  42. - ansible_selinux.status == "enabled"
  43. - item.rc == 0
  44. # We need to detect whether or not the boolean is an alias, since `seboolean`
  45. # will error if it is an alias. We do this by inspecting stdout for the boolean name,
  46. # since getsebool prints the resolved name. (At some point Ansible's seboolean module
  47. # should learn to deal with aliases)
  48. - item.item in item.stdout # Boolean does not have an alias.
  49. - ('--> off' in item.stdout) # Boolean is currently off.
  50. - ansible_python_version | version_compare('3', '>=')
  51. with_items: "{{ fusefs_getsebool_status.results }}"