Add resolved to the networkd setup
If the new variable systemd_resolved is defined, resolved will be setup within the environment. This will configure the global configuration file and restart the service. A test has been added to ensure this code path is exercised on every commit. It should be noted that suse does not have a resolved package so this functionality is disabled when a suse system is encountered. This should be revised as soon as suse has resolved available. Change-Id: I85278719bc5b7158244fd44c65d4366935555780 Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
parent
0ee22bc7db
commit
12ae3acd6e
@ -107,3 +107,15 @@ systemd_netdevs: []
|
||||
# ConfigureWithoutCarrier: true
|
||||
|
||||
systemd_networks: []
|
||||
|
||||
# The systemd resolved service can be setup using th following configuration.
|
||||
# The generator is a Key=Value pair hash and will set whatever directives it's
|
||||
# instructed to. For more information on all of the possible configuration see
|
||||
# https://www.freedesktop.org/software/systemd/man/resolved.conf.html
|
||||
|
||||
# systemd_resolved:
|
||||
# DNS: "10.127.83.1"
|
||||
# FallbackDNS: "208.67.222.222 8.8.8.8"
|
||||
# Cache: yes
|
||||
|
||||
systemd_resolved: {}
|
||||
|
@ -23,5 +23,16 @@
|
||||
tags:
|
||||
- systemd-networkd
|
||||
|
||||
- name: Restart systemd-resolved
|
||||
systemd:
|
||||
name: "systemd-resolved"
|
||||
daemon_reload: yes
|
||||
state: restarted
|
||||
when:
|
||||
- systemd_resolved_available | bool
|
||||
tags:
|
||||
- systemd-networkd
|
||||
- systemd-resolved
|
||||
|
||||
- name: Update initramfs
|
||||
command: "{{ systemd_networkd_update_initramfs }}"
|
||||
|
@ -73,6 +73,20 @@
|
||||
tags:
|
||||
- systemd-networkd
|
||||
|
||||
- name: Create systemd-resolved config
|
||||
template:
|
||||
src: "systemd-resolved.conf.j2"
|
||||
dest: "/etc/systemd/resolved.conf"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0644"
|
||||
when:
|
||||
- systemd_resolved
|
||||
notify:
|
||||
- Restart systemd-resolved
|
||||
tags:
|
||||
- systemd-resolved
|
||||
|
||||
- name: Run interface cleanup script
|
||||
command: "/usr/local/bin/interface-cleanup"
|
||||
failed_when: false
|
||||
|
4
templates/systemd-resolved.conf.j2
Normal file
4
templates/systemd-resolved.conf.j2
Normal file
@ -0,0 +1,4 @@
|
||||
[Resolve]
|
||||
{% for key, value in systemd_resolved.items() %}
|
||||
{{ key }}={{ value }}
|
||||
{% endfor %}
|
@ -27,10 +27,11 @@
|
||||
pause:
|
||||
seconds: 15
|
||||
vars:
|
||||
systemd_networkd_distro_packages:
|
||||
yum:
|
||||
- systemd-networkd
|
||||
systemd_run_networkd: yes
|
||||
systemd_resolved:
|
||||
DNS: "208.67.222.222"
|
||||
FallbackDNS: "8.8.8.8"
|
||||
Cache: yes
|
||||
systemd_netdevs:
|
||||
- NetDev:
|
||||
Name: dummy0
|
||||
|
@ -15,5 +15,8 @@
|
||||
|
||||
systemd_networkd_distro_packages:
|
||||
- systemd-networkd
|
||||
- systemd-resolved
|
||||
|
||||
systemd_resolved_available: true
|
||||
|
||||
systemd_networkd_update_initramfs: "dracut -f"
|
||||
|
@ -13,4 +13,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
systemd_resolved_available: false
|
||||
|
||||
systemd_networkd_update_initramfs: "dracut -f"
|
||||
|
@ -13,4 +13,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
systemd_resolved_available: true
|
||||
|
||||
systemd_networkd_update_initramfs: "/usr/sbin/update-initramfs -u"
|
||||
|
Loading…
Reference in New Issue
Block a user