| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- ---
- - name: Share a directory with NFS
- hosts: serverd.lab.example.com
- become: true
- vars:
- shared_dir: /srv/operators
- tasks:
- - name: the package for NFS server is installed
- yum:
- name: nfs-utils
- state: present
- - name: the directory exists
- file:
- name: "{{ shared_dir }}"
- owner: root
- group: operators
- mode: 2770
- state: directory
- #FIXME: create the {{ shared_dir }} directory as follows:
- # Directory ownership: root
- # Directory group ownership: operators
- # Group access: read/write
- # Other users access: none
- # All contents created in the directory must automatically
- # belong to the operators group.
- - name: the directory is shared
- copy:
- content: "{{ shared_dir }} servera.lab.example.com(rw)\n"
- dest: /etc/exports.d/operators.exports
- owner: root
- group: root
- mode: 0644
- #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.
- notify: reload exports
- - name: NFS is started and enabled
- service:
- name: nfs-server
- state: started
- enabled: yes
- #FIXME: the service must be started and enabled
- - name: the firewall is opened for NFS
- firewalld:
- service: nfs
- state: enabled
- permanent: yes
- immediate: yes
- #FIXME: configure the firewall to allow NFS traffic
- handlers:
- - name: reload exports
- #FIXME: reload the NFS service
|