summaryrefslogtreecommitdiffstats
path: root/ansible/roles
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-04-30 11:30:12 +0000
committerGerrit Code Review <gerrit@onap.org>2020-04-30 11:30:12 +0000
commit97009aaa3a8c1c12f1ea842581609992fc9506af (patch)
tree49ffcd9d1492d589215557f94d91f0fd3a4e126d /ansible/roles
parenta2e2b84c0437aa09724319b49e968776dad71b5b (diff)
parentb00aa9a38d88b391cd67860f16b16edb95577405 (diff)
Merge "Adding Ubuntu support in Ansible - package-repository-check role"
Diffstat (limited to 'ansible/roles')
-rw-r--r--ansible/roles/package-repository-check/tasks/Debian.yml34
-rw-r--r--ansible/roles/package-repository-check/tasks/main.yml1
2 files changed, 34 insertions, 1 deletions
diff --git a/ansible/roles/package-repository-check/tasks/Debian.yml b/ansible/roles/package-repository-check/tasks/Debian.yml
new file mode 100644
index 00000000..8fb37848
--- /dev/null
+++ b/ansible/roles/package-repository-check/tasks/Debian.yml
@@ -0,0 +1,34 @@
+---
+- name: verify
+ block:
+ # Clean cache prior to refreshing
+ - name: Clean apt cache
+ command: apt clean && apt autoclean
+ args:
+ warn: false
+ # Refresh cache to ensure repo is reachable
+ - name: Update apt cache
+ apt:
+ update_cache: yes
+ state: latest
+ tags:
+ - skip_ansible_lint # Prevent '[403] Package installs should not use latest' ansible lint task rule
+ rescue:
+ - name: Fail if apt cache updating failed
+ fail:
+ msg: "Couldn't refresh apt cache, repositories not configured properly. Check ansible logs for details."
+ become: true
+
+- name: Install resolvconf
+ package:
+ name: resolvconf
+ state: present
+
+- name: Add a line to a file if the file does not exist, without passing regexp
+ lineinfile:
+ path: /etc/resolvconf/resolv.conf.d/head
+ line: "nameserver {{ hostvars[groups.infrastructure[0]].cluster_ip }}"
+ create: yes
+
+- name: Make DNS settings permanent
+ command: service resolvconf restart
diff --git a/ansible/roles/package-repository-check/tasks/main.yml b/ansible/roles/package-repository-check/tasks/main.yml
index ac63eceb..11fb3296 100644
--- a/ansible/roles/package-repository-check/tasks/main.yml
+++ b/ansible/roles/package-repository-check/tasks/main.yml
@@ -9,4 +9,3 @@
#Set of tasks designated to failing fast if configured repos are not functioning properly
- include_tasks: "{{ ansible_os_family }}.yml"
- when: ansible_os_family == 'RedHat'