I have two roles that run in a playbook, one that creates a user and the other which runs through a series of tasks that I want to run as the newly created user on the server.
The playbook is written as follows:
- hosts: centos
connection: ssh
gather_facts: false
become: true
roles:
- ../roles/user_setup
- ../roles/tasks
Let's say the user created from the user_setup
role is called user1
: I basically want the role named tasks
to run as user1
. What would be the best way to do this? Thanks.