Skip to content

Commit

Permalink
Merge pull request #199 from mbargull/usermgmt-bug-ipa-sshkey-comment…
Browse files Browse the repository at this point in the history
…-spaces

playbooks/usermgmt: Workaround for SSH pub keys with spaces in comment
  • Loading branch information
mbargull authored Jul 17, 2024
2 parents 92c9cca + bd5ea68 commit 45f19c6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ansible/playbooks/usermgmt/tasks/add-user-ipa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
sn: "{{ item['value']['last_name'] }}"
mail: "{{ item['value']['email'] }}"
loginshell: "{{ item['value']['login_shell'] | default('/bin/bash') }}"
sshpubkey: "{{ item['value']['ssh_public_key'] | default([]) }}"
# Ugly workaround for yet-to-be-investigated upstream(?) issue that breaks
# execution if there are spaces in key file comments.
# -> Take first key and use first 3 fields only, i.e., omit spaces in comment.
sshpubkey: "{{ [item['value']['ssh_public_key'][0].split()[:3] | join(' ')] if item['value']['ssh_public_key'] else [] }}"
# sshpubkey: "{{ item['value']['ssh_public_key'] | default([]) }}"
validate_certs: false
state: "{{ item['value']['desired_state'] | default('present') }}"

Expand Down

0 comments on commit 45f19c6

Please sign in to comment.