summaryrefslogtreecommitdiffstats
path: root/ansible/roles
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/roles')
-rw-r--r--ansible/roles/package-repository-check/tasks/RedHat.yml20
-rw-r--r--ansible/roles/package-repository-check/tasks/main.yml12
2 files changed, 32 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
diff --git a/ansible/roles/package-repository-check/tasks/main.yml b/ansible/roles/package-repository-check/tasks/main.yml
new file mode 100644
index 00000000..ac63eceb
--- /dev/null
+++ b/ansible/roles/package-repository-check/tasks/main.yml
@@ -0,0 +1,12 @@
+---
+# Purpose of this role is to check whether configured repositories are working.
+#
+# Successfull prior invocation of 'package-repository' role on 'infrastructure' hosts
+# is prerequisite for playing this one on 'infrastructure' group.
+#
+# Successfull prior invocation of 'package-repository' and 'nginx' role on infrastructure hosts
+# is prerequisite for playing this one on 'kubernetes' group.
+
+#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'