diff --git a/radvd.yml b/radvd.yml new file mode 100644 index 0000000..6163694 --- /dev/null +++ b/radvd.yml @@ -0,0 +1,3 @@ +- hosts: radvd + roles: + - radvd diff --git a/roles/radvd/defaults/main.yml b/roles/radvd/defaults/main.yml new file mode 100644 index 0000000..7058b9c --- /dev/null +++ b/roles/radvd/defaults/main.yml @@ -0,0 +1 @@ +radvd_interfaces: [] diff --git a/roles/radvd/handlers/main.yml b/roles/radvd/handlers/main.yml new file mode 100644 index 0000000..34c7b05 --- /dev/null +++ b/roles/radvd/handlers/main.yml @@ -0,0 +1,3 @@ +- name: restart radvd + service: name=radvd + state=restarted diff --git a/roles/radvd/tasks/main.yml b/roles/radvd/tasks/main.yml new file mode 100644 index 0000000..106d4e5 --- /dev/null +++ b/roles/radvd/tasks/main.yml @@ -0,0 +1,23 @@ +- name: ensure radvd is installed + package: + name=radvd + state=present + tags: + - install + +- name: ensure radvd is configured + template: + src=radvd.conf.j2 + dest=/etc/radvd.conf + mode=0644 + notify: restart radvd + +- name: ensure radvd starts at boot + service: + name=radvd + enabled=yes +- meta: flush_handlers +- name: ensure radvd is running + service: + name=radvd + state=started diff --git a/roles/radvd/templates/confd.radvd.j2 b/roles/radvd/templates/confd.radvd.j2 new file mode 100644 index 0000000..caf592e --- /dev/null +++ b/roles/radvd/templates/confd.radvd.j2 @@ -0,0 +1,13 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/radvd/files/radvd.conf,v 1.1 2006/07/19 13:02:36 uberlord Exp $ + +# Extra options to pass to radvd +OPTIONS="" + +# Set this to "no" to tell the init script NOT to set up IPv6 forwarding +# using /proc/sys/net/ipv6/conf/all/forwarding +# Only change this if you know what you're doing! +FORWARD="yes" + +rc_need="!net {% for i in radvd_interfaces %}net.{{ i.interface }}{% if not loop.last %} {% endif %}{% endfor %}" diff --git a/roles/radvd/templates/radvd.conf.j2 b/roles/radvd/templates/radvd.conf.j2 new file mode 100644 index 0000000..dd65565 --- /dev/null +++ b/roles/radvd/templates/radvd.conf.j2 @@ -0,0 +1,28 @@ +{% for iface in radvd_interfaces %} +interface {{ iface.interface }} +{ + AdvSendAdvert on; +{% if iface.other_config|d(False) %} + AdvOtherConfigFlag on; +{% endif %} + + prefix {{ iface.prefix }} { + AdvOnLink {% if iface.on_link|d(True) %}on{% else %}off{% endif %}; + AdvAutonomous {% if iface.autonomous|d(True) %}on{% else %}off{% endif %}; + }; +{% if iface.rdnss is defined %} +{% for address in iface.rdnss %} + + RDNSS {{ address }} { + }; +{% endfor %} +{% endif %} +{% if iface.dnssl is defined %} +{% for domain in iface.dnssl %} + + DNSSL {{ domain }} { + }; +{% endfor %} +{% endif %} +}; +{% endfor %}