# Ansible with Packer, root

**URL:** <https://forum.ansible.com/t/ansible-with-packer-root/18153>\
**Category:** Ansible Project\
**Created:** [May 4, 2015, 7:17am UTC](https://forum.ansible.com/t/ansible-with-packer-root/18153 "2015-05-04T07:17:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mic\_gourdet](https://avatars.discourse-cdn.com/v4/letter/m/ecc23a/32.png) [@mic\_gourdet](https://forum.ansible.com/u/mic_gourdet)\
**Post date:** [May 4, 2015, 7:17am UTC](https://forum.ansible.com/t/ansible-with-packer-root/18153/1 "2015-05-04T07:17:33Z")

</div>

I am using Ansible 1.9 and Packer to create and install new package on a Debian VM.

Packer run my playbook, but the installation of the package fail because I am not root.

Can anyone give me an example of a playbook which install a package on a Debian ? (With of course the possibility to be root in order to run apt-get install)

My actual playbook (which is not ok) is the following (I install fortune for a basic example)

hosts: all  
user: root

tasks:  
apt: name=fortune state=installed

Thanks for any help

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [May 4, 2015, 8:28pm UTC](https://forum.ansible.com/t/ansible-with-packer-root/18153/2 "2015-05-04T20:28:16Z")

</div>

tasks is list, so each one needs to be preceded by a dash '-'

hosts: all  
user: root  
tasks:  
&nbsp;&nbsp;- apt: name=fortune state=installed
