---
- name: Add specific zextras-ci account
  ansible.builtin.user:
    name: zextras-ci
    shell: /bin/bash

- name: Set SSH key
  ansible.posix.authorized_key:
    user: zextras-ci
    state: present
    key: "{{ lookup('file', '../files/id_ecdsa.pub') }}"

- name: Add environnement variable for systemd --user management
  ansible.builtin.lineinfile:
    path: /home/zextras-ci/.bashrc
    line: 'export XDG_RUNTIME_DIR=/run/user/$(id -u $USER)'

- name: Set credentials file
  ansible.builtin.template:
    src: credentials.j2
    dest: /home/zextras-ci/credentials
    owner: zextras-ci
    group: zextras-ci
    mode: 0600
