diff --git a/inventory/inventory b/inventory/inventory index a042282..7f0dc26 100644 --- a/inventory/inventory +++ b/inventory/inventory @@ -35,6 +35,8 @@ foremanAlma ansible_user=ansible [windows] bane ansible_user=ansible ansible_connection=winrm ansible_winrm_transport=basic ansible_port=5985 ansible_winrm_server_cert_validation=ignore +baxter + [servers:children] doc aws diff --git a/playbooks/common/nfs.yml b/playbooks/common/nfs.yml new file mode 100644 index 0000000..adff803 --- /dev/null +++ b/playbooks/common/nfs.yml @@ -0,0 +1,27 @@ +--- +- name: installs nfs and makes common folders available to the network + hosts: baxter + become: true + vars_files: + - ../../vars/secrets.yml + tasks: + - name: install nfs core packages + ansible.builtin.apt: + name: nfs-kernel-server + state: present + + - name: write config to /etc/exports + ansible.builtin.template: + src: ../../templates/exports.conf.j2 + dest: /etc/exports + mode: '0644' + + - name: export the configuration(being safe) + ansible.builtin.shell: | + exportfs -ra + + - name: start the nfs service + ansible.builtin.service: + name: nfs-kernel-server + state: started + enabled: true diff --git a/templates/exports.conf.j2 b/templates/exports.conf.j2 new file mode 100644 index 0000000..3bec685 --- /dev/null +++ b/templates/exports.conf.j2 @@ -0,0 +1 @@ +{{nfs_dir}} {{nfs_server_ip}}(rw,sync,no_root_squash,no_subtree_check)