Use ansible playbook from Vagrant provisioning to prod server provisioning.

Hi, my first mailing list ever :),

I wanted to try Ansible as deployment tool and have some setup to use with Vagrant. Deployment of that devel VM is working, I wanted to use same playbook on barebone server by manually running ansible-playbook.

However I have some specific config in ansible because of Vagrant, for example user vagrant and use sudo.

Can you share an advice how should I make ansible playbook usable without neccesity to change anything in the playbook when provisioning servers with root acess and key auth for example in contrare to vagrant sudo user.

Hi,

Hi, my first mailing list ever :),

Never too late :slight_smile:

I wanted to try Ansible as deployment tool and have some setup to use with Vagrant. Deployment of that devel VM is working, I wanted to use same playbook on barebone server by manually running ansible-playbook.

However I have some specific config in ansible because of Vagrant, for example user vagrant and use sudo.

Can you share an advice how should I make ansible playbook usable without neccesity to change anything in the playbook when provisioning servers with root acess and key auth for example in contrare to vagrant sudo user.

You should put the login information in your inventory file(s)…

test_inventory:
[group_vagrant]
vm01 ansible_ssh_user=vagrant

real_inventory

[group_prod]
prodserver1 ansible_ssh_user=root

root being present in sudoers, you shouldn’t run into any problem having root calling sudo to run your tasks.

that being said, that may appear old fashion, but you might consider creating an other user and use sudo rather than root on your production server …

fred

HI thanks for help, in the meantime I actually carefully read a little bit of documentation with understanding not just reading :slight_smile: . Nevertheless I will hangout with the ansible community, I find it much simpler than chef.