---
- name: Ensure the Kayobe Ansible user account exists
  hosts: seed:overcloud
  vars:
    ansible_user: "{{ bootstrap_user }}"
  roles:
    - role: singleplatform-eng.users
      users:
        - username: "{{ kayobe_ansible_user }}"
          name: Kayobe deployment user
          append: True
          ssh_key:
            - "{{ lookup('file', ssh_public_key_path) }}"
      become: True

  post_tasks:
    - name: Ensure the Kayobe Ansible user has passwordless sudo
      copy:
        content: "{{ kayobe_ansible_user }} ALL=(ALL) NOPASSWD: ALL"
        dest: "/etc/sudoers.d/kayobe-ansible-user"
        mode: 0440
      become: True