diff --git a/.travis.yml b/.travis.yml index 9e35717..d6e17c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,4 +10,4 @@ install: script: - echo localhost > inventory - ansible-playbook -i inventory --syntax-check --list-tasks test.yml - - ansible-playbook -i inventory --connection=local --sudo -vvvv test.yml + - ansible-playbook -i inventory --connection=local --sudo -vvvv test.yml --diff diff --git a/tasks/main.yml b/tasks/main.yml index f88d95f..6eaa535 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -2,8 +2,17 @@ - name: Remove resolvconf on Debian system apt: pkg=resolvconf state=absent when: ansible_os_family == 'Debian' and dns_remove_resolvconf - tags: ["packages","dns"] + tags: [packages,dns] - name: Ensure dns servers are configured in /etc/resolv.conf template: src=resolv.conf.j2 dest=/etc/resolv.conf - tags: ["configuration","dns"] + tags: [configuration,dns] + +- name: Ensure dns servers are configured in dhclient.conf + lineinfile: > + regexp="(supersede|prepend) domain-name-servers" + line="{{dns_dhclient_rule}} domain-name-servers {% for nameserver in dns_nameservers %}{{nameserver}}{% if not loop.last %},{% endif %}{% endfor %};" + dest=/etc/dhcp/dhclient.conf + state=present + when: ansible_distribution == "Ubuntu" + tags: [configuration,dns]