Browse Source

Merge pull request #257 from sakshiarora13/devel

Issue #256: Automate Passwordless SSH during each omnia.yml execution
Lucas A. Wilson 4 years ago
parent
commit
51ae7164b4

+ 6 - 0
appliance/tools/roles/cluster_preperation/tasks/passwordless_ssh.yml

@@ -18,6 +18,12 @@
     ssh_status: false
     ssh_status: false
     current_host: "{{ item }}"
     current_host: "{{ item }}"
 
 
+- name: Refresh ssh-key if changed
+  command: ssh-keygen -R {{ current_host }}
+  changed_when: False
+  ignore_errors: yes
+  when: "'manager' in group_names"
+
 - name: Verify whether passwordless ssh is set on the remote host
 - name: Verify whether passwordless ssh is set on the remote host
   command: ssh -o PasswordAuthentication=no root@"{{ current_host }}" 'hostname'
   command: ssh -o PasswordAuthentication=no root@"{{ current_host }}" 'hostname'
   register: ssh_output
   register: ssh_output

+ 5 - 1
omnia.yml

@@ -123,4 +123,8 @@
   gather_facts: false
   gather_facts: false
   roles:
   roles:
     - slurm_exporter
     - slurm_exporter
-  tags: slurm
+  tags: slurm
+
+- name: Passwordless SSH between manager and compute nodes
+  include: appliance/tools/passwordless_ssh.yml
+  when: hostvars['127.0.0.1']['appliance_status']

+ 1 - 1
roles/cluster_validation/tasks/fetch_password.yml

@@ -84,4 +84,4 @@
   command: >-
   command: >-
     ansible-vault encrypt {{ role_path }}/../../{{ config_filename }}
     ansible-vault encrypt {{ role_path }}/../../{{ config_filename }}
     --vault-password-file {{ role_path }}/../../{{ config_vaultname }}
     --vault-password-file {{ role_path }}/../../{{ config_vaultname }}
-  changed_when: false
+  changed_when: false

+ 19 - 1
roles/cluster_validation/tasks/main.yml

@@ -16,4 +16,22 @@
   include_tasks: validations.yml
   include_tasks: validations.yml
 
 
 - name: Fetch passwords
 - name: Fetch passwords
-  include_tasks: fetch_password.yml
+  include_tasks: fetch_password.yml
+
+- name: Check if omnia is running from AWX
+  block:
+    - name: Appliance status
+      set_fact:
+        appliance_status: false
+
+    - name: Check AWX instance
+      command: awx-manage --version
+
+    - name: Update appliance status
+      set_fact:
+        appliance_status: true
+
+  rescue:
+    - name: Passwordless SSH status
+      debug:
+        msg: "omnia.yml running on host"