summaryrefslogtreecommitdiffstats
path: root/ansible/roles/package-repository-check/tasks/RedHat.yml
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2019-03-13 09:33:53 +0100
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>2019-04-03 13:32:47 +0200
commit4e2e9e887b8941a501a80a6c870ad4cb9295ddac (patch)
tree154d0f41504247ed5be17f9d92328bce5ad9985f /ansible/roles/package-repository-check/tasks/RedHat.yml
parentcdd93f561042f5ee4df72895e33bc02a122d5104 (diff)
Verify offline app repo is working
A patch for failing fast if configured offline application repository is not working properly. Just adding repo to repolist doesn't guarantee it's really operational. Change-Id: I65372b9b1ea5f5dcb797548b14e3ae1295668592 Issue-ID: OOM-1689 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'ansible/roles/package-repository-check/tasks/RedHat.yml')
-rw-r--r--ansible/roles/package-repository-check/tasks/RedHat.yml20
1 files changed, 20 insertions, 0 deletions
diff --git a/ansible/roles/package-repository-check/tasks/RedHat.yml b/ansible/roles/package-repository-check/tasks/RedHat.yml
new file mode 100644
index 00000000..ed496f99
--- /dev/null
+++ b/ansible/roles/package-repository-check/tasks/RedHat.yml
@@ -0,0 +1,20 @@
+---
+- name: verify
+ block:
+ # Clean cache prior to refreshing
+ - name: Clean yum cache
+ command: yum clean all
+ args:
+ warn: false
+ # Refresh cache to ensure repo is reachable
+ - name: Update yum cache
+ yum:
+ 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 yum cache updating failed
+ fail:
+ msg: "Couldn't refresh yum cache, repositories not configured properly. Check ansible logs for details."
+ become: true