diff --git a/training/become_method.yml b/training/become_method.yml new file mode 100644 index 0000000..4520c22 --- /dev/null +++ b/training/become_method.yml @@ -0,0 +1,12 @@ +- name: Usar su en lugar de sudo + hosts: all + become: yes + become_method: su + tasks: + - name: Verificar el usuario actual + command: whoami + register: resultado + + - name: Mostrar el usuario actual + debug: + msg: "El usuario actual es {{ resultado.stdout }}" \ No newline at end of file diff --git a/training/become_user.yml b/training/become_user.yml new file mode 100644 index 0000000..64fb52b --- /dev/null +++ b/training/become_user.yml @@ -0,0 +1,9 @@ +- name: ejecutar tareas con un usuario especifico + hosts: all + become: yes + become_user: postgres + tasks: + - name: Crear base de datos + postgresql_db: + name: mi_base_de_datos + state: present \ No newline at end of file