Commit b59be657 authored by Stefano Rivera's avatar Stefano Rivera

Support for writing out static /etc/hosts entries

parent 544882fe
---
# static_ips:
# - hostname: r1mix
# ip: 10.20.0.10
# mac: 12:34:56:78:90:ab
---
- name: Write /etc/hosts entries
template:
src: templates/hosts.j2
dest: /etc/hosts
when: static_ips is defined
---
- include: hosts.yml
# We don't want to fight with the dhcp-server role
- include: interfaces.yml
when: eth_local_ip_address is undefined
# {{ ansible_managed }}
127.0.0.1 localhost
{% for host in static_ips %}
{{ host.ip }} {{ host.hostname }}.{{ domain }} {{ host.hostname }}
{% endfor %}
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
......@@ -19,6 +19,7 @@
- apt
- bash
- motd
- staticips
- hosts: opsis
roles:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment