diff --git a/main.yml b/main.yml index b22009e..33d492e 100644 --- a/main.yml +++ b/main.yml @@ -8,3 +8,4 @@ - {role: youcompleteme, tags: [vim,youcompleteme]} - {role: secure, become: yes, tags: [secure]} - {role: test, tags: [test]} + - {role: dns, tags: [dns]} diff --git a/roles/dns/tasks/main.yml b/roles/dns/tasks/main.yml new file mode 100644 index 0000000..4b1c6ff --- /dev/null +++ b/roles/dns/tasks/main.yml @@ -0,0 +1,15 @@ +- name: Change DNS + lineinfile: + path: /etc/dhcp/dhclient.conf + regexp: '^\s*prepend\s+domain-name-servers' + insertafter: 'prepend\s+domain-name-servers' + state: 'present' + line: 'prepend domain-name-servers 1.0.0.1;' + become: yes + register: changed_dns +- name: Restart networking + service: + name: network + state: restarted + become: yes + when: changed_dns.changed diff --git a/roles/secure/tasks/main.yml b/roles/secure/tasks/main.yml index 1969fa6..e3c7ab0 100644 --- a/roles/secure/tasks/main.yml +++ b/roles/secure/tasks/main.yml @@ -34,3 +34,4 @@ state: 'present' line: 'PermitRootLogin without-password' notify: restart_sshd +- meta: flush_handlers