Files
casa/nodes/ansible/new-node-pre-setup.playbook.yaml
T

23 lines
656 B
YAML

# requirements, on device running ansible
# ansible-galaxy collection install ansible.posix
# python3 -m pip show passlib
- name: Setup System
hosts:
- ???
become: true
tasks:
- name: Add ansible user
ansible.builtin.user:
password: "{{ ansible_new_user_password | password_hash('sha512') }}"
name: "{{ ansible_new_user }}"
groups: sudo
shell: /bin/bash
create_home: yes
state: present
- name: Add SSH authorized key
ansible.posix.authorized_key:
user: "{{ ansible_new_user }}"
key: "{{ lookup('file', '~/.ssh/id_ed25519.pub') }}"
state: present