- name: translate server string to server dict ansible.builtin.set_fact: nfsclient_server_ip: "{{ hostvars[nfsclient_server].__ip.external }}" when: not nfsclient_server_ip - name: include distribution specific prerequisites # noqa: ignore-errors ansible.builtin.include_tasks: "os_{{ ansible_distribution | lower }}.yml" ignore_errors: true - name: create directory on client ansible.builtin.file: path: "{{ nfsclient_dir }}" owner: 0 group: 0 mode: 0755 state: directory - name: cleanup fstab with previous nfs setup ansible.builtin.lineinfile: path: "{{ nfsclient_fstab_path }}" regexp: ^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:/.* {{ nfsclient_dir }} nfs state: absent register: result - name: complete fstab with nfs ansible.builtin.lineinfile: path: "{{ nfsclient_fstab_path }}" line: "{{ nfsclient_server_ip }}:{{ nfsclient_server_dir }}/{{ inventory_hostname }} {{ nfsclient_dir }} nfs rw,nodev,nosuid 0 0" notify: reload fstab