# Copy the first set of keys exclusively, which will remove keys that have been removed from the local `authorized_keys`.
- name: Copy master list authorized_keys file exclusively.
  ansible.posix.authorized_key:
    user: '{{ skolo_account }}'
    state: present
    key: "{{ lookup('file', '{{ all.repo_root }}/skolo/authorized_keys') }}"
    exclusive: yes

- name: Grab the 'chrome-bot' public key from the jumphost.
  become: yes
  become_user: 'chrome-bot'
  delegate_to: '{{ copy_authorized_keys__jumphost }}'
  ansible.builtin.fetch:
    src: '~chrome-bot/.ssh/id_ed25519.pub'
    dest: '/tmp/copy_authorized_keys-from-jumphost-to-{{ inventory_hostname }}'
    flat: yes
  when: copy_authorized_keys__jumphost

- name: Add the jumphost public key.
  ansible.posix.authorized_key:
    user: '{{ skolo_account }}'
    state: present
    key:
      "{{ lookup('file', '/tmp/copy_authorized_keys-from-jumphost-to-{{
      inventory_hostname }}') }}"
    exclusive: no
  when: copy_authorized_keys__jumphost

# Copy the first set of keys exclusively, which will remove keys that have been removed from the local `authorized_keys`.
- name: Copy master list authorized_keys file exclusively.
  ansible.posix.authorized_key:
    user: '{{ skolo_account }}'
    state: present
    key: "{{ lookup('file', all.repo_root + '/skolo/authorized_keys') }}"
    exclusive: yes

- name: set authorized_keys_filename fact.
  set_fact:
    authorized_keys_filename:
      '/tmp/copy_authorized_keys-from-jumphost-to-{{ inventory_hostname }}'

- name: Grab the 'chrome-bot' public key from the jumphost.
  become: yes
  become_user: 'chrome-bot'
  delegate_to: '{{ copy_authorized_keys__jumphost }}'
  ansible.builtin.fetch:
    src: '~chrome-bot/.ssh/id_ed25519.pub'
    dest: '{{ authorized_keys_filename }}'
    flat: yes
  when: copy_authorized_keys__jumphost

- name: Add the jumphost public key.
  ansible.posix.authorized_key:
    user: '{{ skolo_account }}'
    state: present
    key: "{{ lookup('file', authorized_keys_filename) }}"
    exclusive: no
  when: copy_authorized_keys__jumphost

Remove used of nested Jinja templates.
[Ansible] Remove used of nested Jinja templates.

Change-Id: Iaeaa1c2b9d81424f25926a13e245a277888e3ece
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/441516
Reviewed-by: Erik Rose <042ad22d8352d59a3d816dac710aebe65456f16e@google.com>
