# Use ansible playbook from Vagrant provisioning to prod server provisioning.

**URL:** <https://forum.ansible.com/t/use-ansible-playbook-from-vagrant-provisioning-to-prod-server-provisioning/14088>\
**Category:** Ansible Project\
**Created:** [December 6, 2013, 10:02am UTC](https://forum.ansible.com/t/use-ansible-playbook-from-vagrant-provisioning-to-prod-server-provisioning/14088 "2013-12-06T10:02:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marko\_Lisica](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Marko\_Lisica](https://forum.ansible.com/u/Marko_Lisica)\
**Post date:** [December 6, 2013, 10:02am UTC](https://forum.ansible.com/t/use-ansible-playbook-from-vagrant-provisioning-to-prod-server-provisioning/14088/1 "2013-12-06T10:02:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Fred\_Badel](https://avatars.discourse-cdn.com/v4/letter/f/f07891/32.png) [@Fred\_Badel](https://forum.ansible.com/u/Fred_Badel)\
**Post date:** [December 6, 2013, 8:57pm UTC](https://forum.ansible.com/t/use-ansible-playbook-from-vagrant-provisioning-to-prod-server-provisioning/14088/2 "2013-12-06T20:57:12Z")

</div>

Hi,

> Hi, my first mailing list ever :),

Never too late 🙂

> 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

---

<div class="post-metadata">

**Author:** ![Marko\_Lisica](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Marko\_Lisica](https://forum.ansible.com/u/Marko_Lisica)\
**Post date:** [December 7, 2013, 12:32pm UTC](https://forum.ansible.com/t/use-ansible-playbook-from-vagrant-provisioning-to-prod-server-provisioning/14088/3 "2013-12-07T12:32:07Z")

</div>

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