Available in a Ansible Playbook
A cluster is a network of computers. Our master node has the responsibility over the IP addresses that are assigned to the participating hosts within the network. Therefore, we’re going to need an DHCP server running on the master node.
Also, we wanted to have our own “intranet” with our own local-only domain. That’s why we’re going to make use of a DNS server that routes HTTP requests to an webserver (which also runs on the same host).
In this tutorial, we show how to install
dnsmasq that provides the functionality of a DHCP server and a DNS server.
We’d chosen DNSmasq as DNS server that runs on our master node. Here’s how to install it.
sudo apt-get install dnsmasq
Next, we have to configure the DHCP and DNS.
DHCP is going to assign IP addresses to hosts that join the network without a static IP address. The IP addresses will be in the range of 50 - 99 in our subnet. The corresponding directives in the configuration file are:
We also want to have our own local-only domain named “.raspifarm”. This, among others, can be achieved with a DNS server. The directives for the DNS servers are:
The configuration file for dnsmasq is here:
We ended up with this configuration:
domain-needed bogus-priv local=/raspifarm/ address=/raspifarm/192.168.17.1 interface=eth0 expand-hosts domain=raspifarm dhcp-range=192.168.17.50,192.168.17.99,12h dhcp-option=option:router,192.168.17.1 dhcp-authoritative
sudo service dnsmasq restart
In order to interpret the requests to
http://[anything].raspifarm, we have installed an Apache server that handles the requests and routes them to corresponding applications.