setup.yml 648 B

1234567891011121314151617181920212223242526272829303132
  1. ---
  2. - name: setup firewall
  3. import_tasks: firewall.yml
  4. - name: Install nfs-utils
  5. package:
  6. name: nfs-utils
  7. state: present
  8. register: result
  9. until: result is succeeded
  10. - name: Configure NFS
  11. lineinfile:
  12. dest: /etc/sysconfig/nfs
  13. regexp: '^RPCNFSDARGS=.*$'
  14. line: 'RPCNFSDARGS="-N 2 -N 3"'
  15. register: nfs_config
  16. - name: Restart nfs-config
  17. systemd: name=nfs-config state=restarted
  18. when: nfs_config is changed
  19. - name: Ensure exports directory exists
  20. file:
  21. path: "{{ l_nfs_base_dir }}"
  22. state: directory
  23. - name: Enable and start NFS services
  24. systemd:
  25. name: nfs-server
  26. state: started
  27. enabled: yes