Skip to content
This repository has been archived by the owner on Apr 25, 2020. It is now read-only.

Commit

Permalink
Add dns to dhclient.conf in Ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
jdauphant committed Apr 4, 2014
1 parent 0f2fc59 commit fd77232
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 11 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]

0 comments on commit fd77232

Please sign in to comment.