server-config/roles/nethcfg/tasks/dhcpdns.yml

49 lines
1.4 KiB
YAML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
# Installing and configuring DHCP and DNS
- name: Installing DHCP and DNS related NethServer packages.
yum:
name: nethserver-dnsmasq
state: present
# DHCP
- name: Checking DHCP configuration
shell: /sbin/e-smith/db dhcp getprop {{ intnic }} DhcpRangeStart
ignore_errors: true
register: chk_dhcp
- name: Configuring DHCP
shell: /sbin/e-smith/db dhcp set {{ intnic }} range DhcpRangeStart {{ ansible_local.domain.dhcprange_start }} DhcpRangeEnd {{ ansible_local.domain.dhcprange_end }} status enabled
when: chk_dhcp|failed
- name: Activating DHCP
shell: /sbin/e-smith/signal-event nethserver-dnsmasq-save
when: chk_dhcp|failed
# DNS
- name: Checking DNS configuration
shell: /sbin/e-smith/db configuration printprop dns NameServers
register: chk_dns
changed_when: "'NameServers={{ ansible_local.domain.extdnsserver1 }},{{ ansible_local.domain.extdnsserver2 }}' not in chk_dns.stdout"
ignore_errors: yes
- name: Configuring DNS
shell: /sbin/e-smith/db configuration setprop dns role resolver NameServers "{{ ansible_local.domain.extdnsserver1 }},{{ ansible_local.domain.extdnsserver2 }}"
when: chk_dns|changed
- name: Activating DNS
shell: "/sbin/e-smith/signal-event nethserver-dnsmasq-{{ item }}"
when: chk_dns|changed
with_items:
- save
- update
# Avahi
- name: Installing avahi-daemon
yum:
name: nethserver-avahi
state: present