Browse Source

minimal pre-flight test

Grega Bremec 3 years ago
parent
commit
fa11daa8fc
4 changed files with 68 additions and 0 deletions
  1. 9 0
      ansible.cfg
  2. 12 0
      inventory
  3. 8 0
      prepare-deploy-sno1.yml
  4. 39 0
      roles/check-env/tasks/main.yml

+ 9 - 0
ansible.cfg

@@ -0,0 +1,9 @@
+[defaults]
+inventory = ./inventory
+remote_user = student
+ask_pass = no
+
+[privilege_escalation]
+become = no
+become_method = sudo
+become_askpass = no

+ 12 - 0
inventory

@@ -0,0 +1,12 @@
+workstation.lab.example.com
+utility.lab.example.com ansible_user=lab
+bastion.lab.example.com ansible_user=root
+
+# Example: override variables here.
+[all:vars]
+ocp_maj = 4.9
+ocp_z = 4.9.11
+rhcos_ver = 4.9.0
+cinst_ver = latest
+butane_ver = latest
+

+ 8 - 0
prepare-deploy-sno1.yml

@@ -0,0 +1,8 @@
+---
+- name: Prepare the utility VM for deployment of SNO1 cluster
+  hosts: utility.lab.example.com
+  become: true
+  gather_facts: false
+  roles:
+    - role: check-env
+...

+ 39 - 0
roles/check-env/tasks/main.yml

@@ -0,0 +1,39 @@
+---
+# Checks that every prereq is in place:
+#
+# Services:
+#  - DHCP
+#  - TFTP
+#  - DNS
+#  - chronyd
+#  - haproxy
+#  - httpd
+#
+# Tools:
+#  - openshift-install
+#  - butane
+#  - oc
+#
+# Files:
+#  - ???
+- name: Check services are running
+  service:
+    name: "{{ item }}"
+    state: running
+  loop:
+    - dhcpd
+    - tftp.socket
+    - named
+    - chronyd
+    - haproxy
+    - httpd
+
+- name: Make sure all the tools are there
+  file:
+    path: /usr/local/bin/{{ item }}
+    state: file
+  loop:
+    - openshift-install
+    - butane
+    - oc
+...