create_export.yml 906 B

12345678910111213141516171819202122232425262728293031323334
  1. ---
  2. # Makes a new NFS export
  3. #
  4. # Include signature
  5. #
  6. # include_role:
  7. # role: openshift_nfs
  8. # tasks_from: create_export
  9. # vars:
  10. # l_nfs_base_dir: Base dir to exports
  11. # l_nfs_export_config: Name to prefix the .exports file with
  12. # l_nfs_export_name: Name of sub-directory of the export
  13. # l_nfs_options: Mount Options
  14. - name: "Ensure {{ l_nfs_export_name }} NFS export directory exists"
  15. file:
  16. path: "{{ l_nfs_base_dir }}/{{ l_nfs_export_name }}"
  17. state: directory
  18. mode: 0777
  19. owner: nfsnobody
  20. group: nfsnobody
  21. - name: "Create {{ l_nfs_export_name }} NFS export"
  22. lineinfile:
  23. path: "/etc/exports.d/{{ l_nfs_export_config }}.exports"
  24. create: true
  25. state: present
  26. line: "{{ l_nfs_base_dir }}/{{ l_nfs_export_name }} {{ l_nfs_options }}"
  27. register: created_export
  28. - name: Re-export NFS filesystems
  29. command: exportfs -ar
  30. when:
  31. - created_export is changed