main.yml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Configure ISC KEA
  2. ---
  3. - name: check whether isc-dhcp-server.service is running
  4. shell: "systemctl status isc-dhcp-server.service"
  5. register: _isc_dhcp_status
  6. failed_when: False
  7. changed_when: False
  8. check_mode: no
  9. when: domaenenliste is defined
  10. - name: check whether isc-dhcp-server.service is enabled
  11. shell: "systemctl is-enabled isc-dhcp-server.service"
  12. register: _isc_dhcp_enabled
  13. failed_when: False
  14. changed_when: False
  15. check_mode: no
  16. when: domaenenliste is defined
  17. - name: stop isc-dhcp
  18. service: name=isc-dhcp-server state=stopped
  19. when:
  20. - domaenenliste is defined
  21. - _isc_dhcp_status.rc == 0
  22. - name: disable isc-dhcp
  23. service: name=isc-dhcp-server enabled=no
  24. when:
  25. - domaenenliste is defined
  26. - _isc_dhcp_enabled.rc == 0
  27. - name: enable kea-dhcp4.service
  28. service: name=kea-dhcp4.service enabled=yes
  29. when: domaenenliste is defined
  30. - name: Create /etc/kea directory
  31. file: path=/etc/kea state=directory mode=0755
  32. when: domaenenliste is defined
  33. - name: Create /var/kea directory
  34. file: path=/var/kea state=directory mode=0755
  35. when: domaenenliste is defined
  36. - name: create /etc/kea/kea.conf
  37. template: src=keav4.conf.j2 dest=/etc/kea/kea.conf
  38. notify:
  39. - reload-or-restart kea-dhcp4.service
  40. when: domaenenliste is defined