ansible/roles/nfs-server/tasks/main.yml
Timo Makinen befa371fdc nfs-server: Allow role/home autocreation run more often
1. Implemented locking for scripts so only one instance is running
   simultaneously. This will also remove stale lock file if found.

2. Use LDAP contextCSN value to determine if we need to run script
   at all. Previous contextCSN is stored in state file which will
   be cleaned during reboots. If state file is not found direcotries
   are scanned in normal way.
2021-03-24 05:48:04 +00:00

44 lines
896 B
YAML

---
- name: disable nfs versions 2 and 3
lineinfile:
path: /etc/nfs.conf
line: "{{ item }}=n"
regexp: '^(#\s*)?{{ item }}=.*'
with_items:
- vers2
- vers3
notify: restart nfs-server
- name: disable nfs over udp
lineinfile:
path: /etc/nfs.conf
line: "udp=n"
regexp: '^(#\s*)?udp=.*'
insertbefore: vers2=n
notify: restart nfs-server
- name: install home/role autocreate scripts
copy:
dest: "/usr/local/sbin/{{ item }}"
src: "{{ item }}.sh"
mode: 0755
owner: root
group: "{{ ansible_wheel }}"
with_items:
- mknfshomedir
- mknfsroledir
- name: add home/role autocreate cron jobs
cron:
name: "{{ item }}"
user: root
job: "/usr/local/sbin/{{ item }}"
with_items:
- mknfshomedir
- mknfsroledir
- name: enable nfs server services
service:
name: nfs-server
state: started
enabled: true