--- - name: Share a directory with NFS hosts: serverc.lab.example.com become: true vars: shared_dir: /srv/operators tasks: - name: the package for NFS server is installed yum: name: #FIXME: install the required package for an NFS server state: present - name: the directory exists file: path: "{{ shared_dir }}" owner: root group: operators mode: '2770' state: directory - name: the directory is shared copy: #FIXME: declare the {{ shared_dir }} directory as an NFS share. # Only servera.lab.example.com must be able to access the share. # servera has read/write access to the share. # The root user on servera must have no access to the share. content: "{{ shared_dir }} #FIXME#(#FIXME#)\n" dest: /etc/exports.d/share.exports owner: root group: root mode: '0644' notify: reload exports - name: NFS is started and enabled service: name: #FIXME: the NFS server service must be started and enabled state: started enabled: yes - name: the firewall is opened for NFS firewalld: service: #FIXME: configure the firewall to allow NFS traffic state: enabled immediate: yes permanent: yes handlers: - name: reload exports service: name: #FIXME: the NFS server service must be reloaded state: reloaded