setup.yml 638 B

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