Files
startusingansible/training/practica-3-roles/users/tasks/main.yml
Guillem Hernandez Sola fee4726e73 Fix users passlib
2025-06-19 10:41:16 +02:00

28 lines
735 B
YAML

- name: Install Python3
apt:
pkg:
- python3
- python3-pip
- python3-passlib
become: true
- name: Create a symbolic link from python3 to python
file:
src: /usr/bin/python3
dest: /usr/bin/python
state: link
- name: Set ansible_python_interpreter to use the installed Python
set_fact:
ansible_python_interpreter: /usr/bin/python3
- name: Generar hash de la contraseña en el controlador (local)
ansible.builtin.set_fact:
hashed_password: "{{ user_password | password_hash('sha512') }}"
- name: Crear usuarios con contraseña
ansible.builtin.user:
name: "{{ item }}"
password: "{{ hashed_password }}"
state: present
loop: "{{ user_list }}"