main.yml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. ---
  2. - name: install requirements
  3. apt: pkg=rsync state=installed
  4. - name: create persitent folder dhcpd data
  5. file: path=/var/lib/dhcp_persistent state=directory mode=0755
  6. notify:
  7. - restart isc-dhcp-server
  8. - name: Ramdisk in fstab eintragen
  9. mount: name=/var/lib/dhcp src=tmpfs fstype=tmpfs opts='defaults,size=100M' state=mounted
  10. notify:
  11. - restart isc-dhcp-server
  12. - name: create dir for tmpfs scripts
  13. file: path=/usr/src/dhcpd state=directory
  14. - name: tmpfs start script for dhcpd
  15. template: src=openramdisk.j2 dest=/usr/src/dhcpd/openramdisk mode="a+x"
  16. - name: tmpfs stop script for dhcpd
  17. template: src=closeramdisk.j2 dest=/usr/src/dhcpd/closeramdisk mode="a+x"
  18. - name: tmpfs systemd service for dhcpd
  19. template: src=dhcpd-tmpfs.service.j2 dest=/lib/systemd/system/dhcpd-tmpfs.service
  20. - name: enable dhcpd-tmpfs service
  21. service: name=dhcpd-tmpfs enabled=yes state=started
  22. - name: install isc-dhcp-server
  23. apt: pkg=isc-dhcp-server state=installed
  24. - name: create dhcp defaults
  25. template: src=isc-dhcp-server.j2 dest=/etc/default/isc-dhcp-server
  26. notify:
  27. - restart isc-dhcp-server
  28. - name: create dhcpd config
  29. template: src=dhcpd.conf.j2 dest=/etc/dhcp/dhcpd.conf
  30. notify:
  31. - restart isc-dhcp-server
  32. - stat: path=/var/lib/dhcp/dhcpd.leases
  33. register: leases4_file