add ansible nodes management

This commit is contained in:
Márcio Fernandes
2026-08-19 13:50:53 +00:00
parent 157dcfd4b6
commit 2b963b55e8
8 changed files with 37 additions and 9 deletions
@@ -0,0 +1,23 @@
# 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