Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
file: path=/etc/network/interfaces.d state=directory
when: ansible_os_family == "Debian"

- name: Create resolv.conf
template: src=resolv.conf.j2 dest=/etc/resolv.conf
with_items: "{{ dns_servers }}"
when: dns_servers is defined

- name: Create the network configuration file for ethernet devices
template: src=ethernet_{{ ansible_os_family }}.j2 dest={{ net_path }}/ifcfg-{{ item.device }}
with_items: network_ether_interfaces
Expand Down
15 changes: 15 additions & 0 deletions templates/resolv.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# keep in mind to disable NetworkManager or else this will be overwritten, possibly disabling DNS

{% if dns_servers is defined %}
{% for dns in dns_servers %}
nameserver {{ dns }}
{% endfor %}
{% endif %}

{% if dns_search is defined %}
search {{ dns_search }}
{% endif %}

{% if dns_domain is defined %}
domain {{ dns_domain }}
{% endif %}