Skip to content

Commit 6cae5ec

Browse files
committed
make known_hosts idempotent for OOD login host
1 parent 252ff34 commit 6cae5ec

File tree

1 file changed

+6
-3
lines changed
  • ansible/roles/openondemand/tasks

1 file changed

+6
-3
lines changed

ansible/roles/openondemand/tasks/main.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,14 @@
133133
command:
134134
cmd: "ssh-keyscan -t ssh-ed25519 {{ openondemand_clusters.slurm.v2.login.host }}"
135135
register: _openondemand_login_key
136+
changed_when: false
136137

137138
- name: Add login hostkey to known hosts
138-
copy:
139-
dest: /etc/ssh/known_hosts
140-
content: "{{ _openondemand_login_key.stdout }}"
139+
lineinfile:
140+
path: /etc/ssh/known_hosts
141+
create: true
142+
line: "{{ _openondemand_login_key.stdout }}"
143+
regexp: "^{{ openondemand_clusters.slurm.v2.login.host}}"
141144
owner: root
142145
group: root
143146
mode: o=rw,go=r

0 commit comments

Comments
 (0)