main.yml 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. ---
  2. - name: Set nfs facts
  3. openshift_facts:
  4. role: nfs
  5. local_facts:
  6. exports_dir: "{{ openshift_nfs_exports_dir | default(None) }}"
  7. export_options: "{{ openshift_nfs_export_options | default(None) }}"
  8. registry_volume: "{{ openshift_nfs_registry_volume | default(None) }}"
  9. - name: Install nfs-utils
  10. yum:
  11. pkg: nfs-utils
  12. state: present
  13. - name: Ensure exports directory exists
  14. file:
  15. path: "{{ openshift.nfs.exports_dir }}"
  16. state: directory
  17. - name: Ensure export directories exist
  18. file:
  19. path: "{{ openshift.nfs.exports_dir }}/{{ item }}"
  20. state: directory
  21. mode: 0777
  22. owner: nfsnobody
  23. group: nfsnobody
  24. with_items:
  25. - "{{ openshift.nfs.registry_volume }}"
  26. - name: Configure exports
  27. template:
  28. dest: /etc/exports
  29. src: exports.j2
  30. notify:
  31. - restart nfs-server
  32. - name: Enable and start services
  33. service:
  34. name: "{{ item }}"
  35. state: started
  36. enabled: yes
  37. register: start_result
  38. with_items:
  39. - nfs-server
  40. - set_fact:
  41. nfs_service_status_changed: "{{ True in (start_result.results
  42. | map(attribute='changed')
  43. | list) }}"