Skip to content

Commit 81ef85f

Browse files
authored
Merge pull request #331 from stackhpc/feat/ood-sshkey
Avoid prompting user to accept hostkey in OOD shell
2 parents 2abd860 + 70a9364 commit 81ef85f

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

ansible/roles/openondemand/tasks/main.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,19 @@
128128
# loop:
129129
# - /var/www/ood/public
130130
# - /usr/share/ondemand-dex/web/themes/
131+
132+
- name: Keyscan login host
133+
command:
134+
cmd: "ssh-keyscan {{ openondemand_clusters.slurm.v2.login.host }}"
135+
register: _openondemand_login_key
136+
changed_when: false
137+
138+
- name: Add login hostkeys to known hosts
139+
blockinfile:
140+
path: /etc/ssh/ssh_known_hosts
141+
create: true
142+
block: "{{ _openondemand_login_key.stdout_lines | sort | join('\n') }}"
143+
marker: "# {mark} ANSIBLE MANAGED BLOCK: openondemand login host" # allows other tasks to use blockinfile on this file
144+
owner: root
145+
group: root
146+
mode: o=rw,go=r

environments/common/inventory/group_vars/all/openondemand.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ openondemand_dashboard_links_grafana:
2424
url: "{{ grafana_url_openondemand_proxy }}"
2525
openondemand_dashboard_links: "{{ openondemand_dashboard_links_grafana if groups['grafana'] | length > 0 }}"
2626

27+
openondemand_login_host: localhost
28+
2729
openondemand_clusters:
2830
slurm:
2931
v2:
3032
metadata:
3133
title: "{{ openhpc_cluster_name }}" # interpolation here works as openondemand is lexically after openhpc
3234
login:
33-
host: "{{ hostvars[groups['login'].0].api_address }}"
35+
host: "{{ openondemand_login_host }}"
3436
default: true
3537
job:
3638
adapter: slurm

0 commit comments

Comments
 (0)