Verified Commit 82baf629 authored by Florian Pritz's avatar Florian Pritz
Browse files

root_ssh: Use template for more flexibility



Signed-off-by: Florian Pritz's avatarFlorian Pritz <bluewind@xinu.at>
parent 8604be9f
---
- set_fact: pubkey_list="{{ lookup('file', '../pubkeys/' + item) }}"
register: pubkeys
with_items: "{{ root_ssh_keys }}"
- set_fact: pubkey_string={{ pubkeys.results | map(attribute='ansible_facts.pubkey_list') | join('\n') }}
- name: add authorized keys for root
authorized_key: user=root key="{{ pubkey_string }}" exclusive=yes
template: src=authorized_keys.j2 dest=/root/.ssh/authorized_keys mode=0600 owner=root group=root
#jinja2: lstrip_blocks: True
{% for user in root_ssh_keys | sort -%}
{{ lookup('file', '../pubkeys/' + user) }}
{% endfor %}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment