Felix Stupp 69b884ad3f | 5 years ago | |
---|---|---|
.. | ||
defaults | ||
tasks | 5 years ago | |
README.md |
README.md
Ansible Bootstrap Role
This role will manage to use another user to connect to the server, if your server hoster configures another root / sudo user as you want to use. This allows you to build one simple playbook and execute it no matter if your server is already configured or not.
Example
My server hoster allows me to define a password for root while configuring the server, then I can connect via SSH using this password to this new server, however I prefer to use another account with sudo privileges.
Now you can use this role to etablish this workflow to Ansible.
Configure Ansible's remote_user
to be the user you want to give sudo privileges to.
Define this role to be the first executed and set the variable bootstrap_sudo_user
to the user your hoster configures for you.
Ansible will try to log in as remote_user
at first,
if this fails, then it will try to log in as bootstrap_sudo_user
.
As long as one of both connection attempts succeeds,
the execution of the playbook will continue using the privileges of the first succeeded login.