This is what my playbook looks like:
---
- hosts: ec2
user: root
roles:
- createuser
- hosts: ec2
user: winery
roles:
- winery
The task for createuser looks like this:
---
- name: create user for given app
user: name=winery
The first task works as expected, but then it can't continue on as the user "winery", because it doesn't have sufficient privileges to login to the server as that user.
How do you continue on from here?
Can I upload an SSL key for the user so that I can login without problems?
If the root and the new user both have the same SSL key, that seems wrong, what would be suggested if it is in appropriate to do this?
It seems silly to create a user using a "createuser" role, is there a way to get around this? I was just using user:root with remote_user: winery attached to every command, but that didn't seem right either.
I really hope somebody responds!