main.yml 610 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
---
- name: dhcpd installed
  become: true
  dnf:
    name: dhcp
    state: installed
  notify:
    - start dhcpd
    - enable dhcpd

- name: copy mac addresses and config
  become: true
  copy:
    src: "{{ item }}"
    dest: "/etc/dhcp/{{ item }}"
    backup: yes
    owner: root
    group: root
    validate: /sbin/dhcpd -t -cf %s
    decrypt: yes
  notify: restart dhcpd
  with_items:
    - "host-list-las"
    - dhcpd.conf

- name: install dhcpd config
  become: true
  template:
    src: dhcpd.j2
    dest: /etc/dhcp/dhcpd.conf
    backup: yes
    validate: /sbin/dhcpd -t -cf %s
  notify: restart dhcpd