summaryrefslogtreecommitdiffstats
path: root/ansible
diff options
context:
space:
mode:
authorSamuli Silvius <s.silvius@partner.samsung.com>2019-05-15 11:42:18 +0000
committerGerrit Code Review <gerrit@onap.org>2019-05-15 11:42:18 +0000
commitf32823d0c545ee2835de38fe41c9485c0f373e57 (patch)
tree5d77027a4d735c69c4dfc5890a9b392b9b2d4117 /ansible
parent280ef8da90cf2bab9ddf7b3df78b12a3b2cf6040 (diff)
parent25d56e36412b607fa55030072f550e5550b73e8b (diff)
Merge "Fix idempotence issue in dns role"
Diffstat (limited to 'ansible')
-rw-r--r--ansible/roles/dns/handlers/main.yml3
-rw-r--r--ansible/roles/dns/tasks/main.yml28
2 files changed, 12 insertions, 19 deletions
diff --git a/ansible/roles/dns/handlers/main.yml b/ansible/roles/dns/handlers/main.yml
index 9d77893a..9e957474 100644
--- a/ansible/roles/dns/handlers/main.yml
+++ b/ansible/roles/dns/handlers/main.yml
@@ -1,5 +1,5 @@
---
-- name: Restart dns server container
+- name: Run dns server container
docker_container:
name: dns-server
image: "{{ dns_server_image }}"
@@ -12,3 +12,4 @@
- "53:53/udp"
state: started
restart_policy: unless-stopped
+ recreate: true
diff --git a/ansible/roles/dns/tasks/main.yml b/ansible/roles/dns/tasks/main.yml
index 3eba9fdb..121ee0c4 100644
--- a/ansible/roles/dns/tasks/main.yml
+++ b/ansible/roles/dns/tasks/main.yml
@@ -8,7 +8,7 @@
template:
src: simulated_hosts.j2
dest: "{{ app_data_path }}/cfg/simulated_hosts"
- notify: Restart dns server container
+ notify: Run dns server container
- name: Load dns server container
docker_image:
@@ -16,21 +16,13 @@
load_path: "{{ infra_images_path }}/{{ dns_server_image_tar }}"
state: present
timeout: 120
- notify: Restart dns server container
+ notify: Run dns server container
-- name: Start dns server container
- docker_container:
- name: dns-server
- network_mode: host
- image: "{{ dns_server_image }}"
- command: -H /simulated_hosts --log-facility=-
- capabilities: NET_ADMIN
- dns_servers:
- - 127.0.0.1
- volumes:
- - "{{ app_data_path }}/cfg/simulated_hosts:/simulated_hosts:ro"
- ports:
- - "53:53/tcp"
- - "53:53/udp"
- state: started
- restart_policy: unless-stopped
+- name: Enumerate running containers
+ docker_list_containers:
+ register: containers_list
+
+- name: Ensure dns container is running
+ command: /bin/true
+ notify: Run dns server container
+ when: "'dns-server' not in containers_list.containers"