# packer/local vs remote, service restart failure

**URL:** <https://forum.ansible.com/t/packer-local-vs-remote-service-restart-failure/16902>\
**Category:** Ansible Project\
**Created:** [November 27, 2014, 12:18pm UTC](https://forum.ansible.com/t/packer-local-vs-remote-service-restart-failure/16902 "2014-11-27T12:18:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steve\_Porter](https://avatars.discourse-cdn.com/v4/letter/s/8491ac/32.png) [@Steve\_Porter](https://forum.ansible.com/u/Steve_Porter)\
**Post date:** [November 27, 2014, 12:18pm UTC](https://forum.ansible.com/t/packer-local-vs-remote-service-restart-failure/16902/1 "2014-11-27T12:18:07Z")

</div>

Having a problem with a packer/local vs normal ansible remote provision.

**Remote**

On the remote, I provision mysql, then change the mysql settings and restart mysql - everything goes swimmingly.

- file: path={{ item }} state=absent  
with\_items:

- /var/lib/mysql/ib\_logfile0

- /var/lib/mysql/ib\_logfile1

- /var/lib/mysql/ib\_logfile2  
notify: restart-mysql  
tags: mysql

- name: restart-mysql  
service: name=mysql state=restarted sleep=10

Remote:

NOTIFIED: [mysql | restart-mysql] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
\<192.168.56.101\> REMOTE\_MODULE service name=mysql state=restarted  
\<192.168.56.101\> EXEC [‘/bin/sh’, ‘-c’, ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1417087683.16-109709247336195 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1417087683.16-109709247336195 && echo $HOME/.ansible/tmp/ansible-tmp-1417087683.16-109709247336195’]  
\<192.168.56.101\> PUT /tmp/tmpUOthBA TO /home/vagrant/.ansible/tmp/ansible-tmp-1417087683.16-109709247336195/service  
\<192.168.56.101\> EXEC /bin/sh -c ‘sudo -k && sudo -H -S -p “[sudo via ansible, key=ufnibuoyecqmoknrwhhfsbkwbevetxkc] password: " -u root /bin/sh -c '”’“‘echo SUDO-SUCCESS-ufnibuoyecqmoknrwhhfsbkwbevetxkc; LANG=C LC\_CTYPE=C /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1417087683.16-109709247336195/service; rm -rf /home/vagrant/.ansible/tmp/ansible-tmp-1417087683.16-109709247336195/ \>/dev/null 2\>&1’”‘"’’  
changed: [192.168.56.101] =\> {“changed”: true, “name”: “mysql”, “state”: “started”}

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

**Local**

On a local provision, I do the same as above from within the VM and everything goes swimmingly.

**Packer/Local**

If I run the above from packer i.e. local build, no matter what service I try to restart it fails:

virtualbox-iso: NOTIFIED: [mysql | restart-mysql] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
virtualbox-iso: \<192.168.56.101\> REMOTE\_MODULE service name=mysql state=restarted sleep=10  
virtualbox-iso: \<192.168.56.101\> EXEC [‘/bin/sh’, ‘-c’, ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1417090379.74-133308290545382 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1417090379.74-133308290545382 && echo $HOME/.ansible/tmp/ansible-tmp-1417090379.74-133308290545382’]  
virtualbox-iso: \<192.168.56.101\> PUT /tmp/tmpidQgBv TO /home/vagrant/.ansible/tmp/ansible-tmp-1417090379.74-133308290545382/service  
virtualbox-iso: \<192.168.56.101\> EXEC /bin/sh -c ‘sudo -k && sudo -H -S -p “[sudo via ansible, key=pfctarqsvenqtrfjkqxhizisscmtqntc] password: " -u root /bin/sh -c '”’“‘echo SUDO-SUCCESS-pfctarqsvenqtrfjkqxhizisscmtqntc; LANG=C LC\_CTYPE=C /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1417090379.74-133308290545382/service; rm -rf /home/vagrant/.ansible/tmp/ansible-tmp-1417090379.74-133308290545382/ \>/dev/null 2\>&1’”‘"’’  
virtualbox-iso: failed: [192.168.56.101] =\> {“failed”: true}  
virtualbox-iso: msg: start: Job failed to start

Ansible version in all instances is 1.7.2

Any guidance?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [December 1, 2014, 9:08pm UTC](https://forum.ansible.com/t/packer-local-vs-remote-service-restart-failure/16902/2 "2014-12-01T21:08:27Z")

</div>

I don’t use Packer often, but I’m unclear on why anyone would want to use the remote version, to be honest.

It seems the local version would always be simpler.
