---
- name: dns | Install openresolv and {{ dns_resolver }}
  apk:
    name: openresolv, {{ dns_resolver }}
    state: present

# Static import_tasks doesn't work here
- name: dns | Configure {{ dns_resolver }}
  include_tasks: '{{ dns_resolver }}.yml'

- name: dns | Update resolvconf config
  template:
    src: resolvconf.j2
    dest: /etc/resolvconf.conf
    owner: root
    group: root
    mode: 0644

- name: dns | Overwrite /etc/netconfig/interfaces
  template:
    src: interfaces.j2
    dest: /etc/network/interfaces
    owner: root
    group: root
    mode: 0644

- name: dns | Overwrite /etc/hosts to support IPv6
  copy:
    src: hosts
    dest: /etc/hosts
    owner: root
    group: root
    mode: 0644
