{% for key in pillar['tlu-harvester']['os']['ssh_authorized_keys'] -%} {% set len = key | length %} {% set pos = len - key.rfind(' ') - 1 %} {% set name = key[-pos:].replace('@','-') %} --- apiVersion: harvesterhci.io/v1beta1 kind: KeyPair metadata: name: {{ name }} namespace: default spec: publicKey: | {{ key }} {% endfor %}