packer/local vs remote, service restart failure

64 views
Skip to first unread message

Steve Porter

unread,
Nov 27, 2014, 7:18:07 AM11/27/14
to ansible...@googlegroups.com
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?

Michael DeHaan

unread,
Dec 1, 2014, 4:08:30 PM12/1/14
to ansible...@googlegroups.com
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.


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/ae5978cd-3b93-4ccc-9875-6a7f6227f752%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages