summaryrefslogtreecommitdiff
path: root/roles/network/coredns/tasks/main.yml
blob: a0cfa6c569308aeb5841a7026d20d56839d459b7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---
- name: install coredns
  apt:
    name: coredns
    state: present

- name: create coredns user
  user:
    name: coredns
    home: /nonexistent
    shell: /usr/sbin/nologin
    create_home: no
    system: yes
    state: present

- name: create coredns config directory
  file:
    path: /etc/coredns
    state: directory

- name: generate Corefile
  copy:
    content: |
      # ansible managed

      {{ coredns_config }}
    dest: /etc/coredns/Corefile
  notify: reload coredns

- name: install systemd service unit
  template:
    src: coredns.service.j2
    dest: /etc/systemd/system/coredns.service

- name: make sure coredns is enabled started
  systemd:
    daemon_reload: yes
    name: coredns.service
    enabled: yes
    state: started