main.yml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. ---
  2. - name: Install nfs-utils
  3. yum:
  4. pkg: nfs-utils
  5. state: present
  6. - name: Configure NFS
  7. lineinfile:
  8. dest: /etc/sysconfig/nfs
  9. regexp: "{{ item.regex }}"
  10. line: "{{ item.line }}"
  11. register: nfs_config
  12. with_items:
  13. - regex: '^RPCNFSDARGS=.*$'
  14. line: 'RPCNFSDARGS="-N 2 -N 3"'
  15. - regex: '^RPCMOUNTDOPTS=.*$'
  16. line: 'RPCMOUNTDOPTS="-p 20048"'
  17. - regex: '^STATDARG=.*$'
  18. line: 'STATDARG="-p 50825"'
  19. - name: Restart nfs-config
  20. service: name=nfs-config state=restarted
  21. when: "True in (nfs_config.results | oo_collect(attribute='changed') | list)"
  22. - name: Ensure exports directory exists
  23. file:
  24. path: "{{ openshift.hosted.registry.storage.nfs.directory }}"
  25. state: directory
  26. - name: Ensure export directories exist
  27. file:
  28. path: "{{ openshift.hosted.registry.storage.nfs.directory }}/{{ item }}"
  29. state: directory
  30. mode: 0777
  31. owner: nfsnobody
  32. group: nfsnobody
  33. with_items:
  34. - "{{ openshift.hosted.registry.storage.volume.name }}"
  35. - name: Configure exports
  36. template:
  37. dest: /etc/exports
  38. src: exports.j2
  39. notify:
  40. - restart nfs-server
  41. - name: Enable and start services
  42. service:
  43. name: "{{ item }}"
  44. state: started
  45. enabled: yes
  46. register: start_result
  47. with_items:
  48. - nfs-server
  49. - set_fact:
  50. nfs_service_status_changed: "{{ True in (start_result.results
  51. | oo_collect(attribute='changed')
  52. | list) }}"