From 507bb161881b115964bc5b94d5dcd285f9d4f559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Berthaud-M=C3=BCller?= Date: Sun, 25 Jul 2021 17:35:08 +0200 Subject: [PATCH] add become --- config/hosts | 4 ++-- config/roles/knot/handlers/main.yml | 1 + config/roles/knot/tasks/main.yml | 7 ++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/config/hosts b/config/hosts index ffbd67c..a178558 100644 --- a/config/hosts +++ b/config/hosts @@ -1,5 +1,5 @@ [primary] -163.172.129.205 ansible_user=root +dev-ns1.vm ansible_user=roger [secondary] -51.158.108.60 ansible_user=root +dev-ns2.vm ansible_user=roger diff --git a/config/roles/knot/handlers/main.yml b/config/roles/knot/handlers/main.yml index a9e38d3..0418a36 100644 --- a/config/roles/knot/handlers/main.yml +++ b/config/roles/knot/handlers/main.yml @@ -1,4 +1,5 @@ --- - name: reload knot + become: yes command: cmd: knotc reload diff --git a/config/roles/knot/tasks/main.yml b/config/roles/knot/tasks/main.yml index 26423c9..81c3f71 100644 --- a/config/roles/knot/tasks/main.yml +++ b/config/roles/knot/tasks/main.yml @@ -1,11 +1,14 @@ --- - name: Install knot + become: yes apt: + update_cache: yes pkg: - knot - knot-dnsutils - name: Update zones + become: yes ansible.builtin.copy: src: '{{ zones_dir }}/' dest: /var/lib/knot/zones @@ -15,13 +18,15 @@ notify: reload knot when: "inventory_hostname in groups.primary" -- name: +- name: Deploy conf + become: yes template: src: knot.conf.j2 dest: /etc/knot/knot.conf notify: reload knot - name: Start knot + become: yes service: name: knot state: started