I’m just starting using Ansible a few weeks ago. Using:
ansible 1.4 (devel a002a24973) last updated 2013/09/25 17:14:03 (GMT -700)
Currently, I’m using it with Vagrant, VirtualBox with Ansible as a provisioner to build a clustered Varnish test suite. It works awesome.
In our dev/qa/production environments we’ve been running Varnish on Ubuntu Lucid. I’d like to upgrade to Precise. Time to upgrade. I thought this might be good test for Ansible. I’ve downloaded the standard lucid64 box and created a simple playbook:
-
name: Update apt cache
action: apt update_cache=true
tags: ubuntu_upgrade
-
name: Distribution Upgrade {{dist_upgrade}}
apt: pkg=update-manager-core state=latest
when: ${dist_upgrade}
register: upgrade
tags: ubuntu_upgrade
-
name: Do Release Upgrade
command: /usr/bin/do-release-upgrade -f DistUpgradeViewNonInteractive
when: (upgrade|success) and (${dist_upgrade})
tags: ubuntu_upgrade
When I run the playbook, the do-release fails task fails and Ansible hangs. I thought at some point it may timeout or someting but I let in run all night and the console indicated it was still working on the task.
When I log into the machines while the tasks are executing. It seems to start off okay on one machine but after a few minutes activity on the box decreases to an idle state. One thing I noticed is a precise process that has gone into a zombie state. The task does not kick off on the other box.
I am curious if anyone might be able to shed some light on doing a release upgrade on Ubuntu using Ansible.
If I ssh into the guest machine I can run it manually.
Cheers,
Paul
I would probably consider async mode (see docs on async), though I would expect you to encounter an SSH timeout. It is probably that this command is not daemonizing correctly.
I should point out your use of legacy variables is discouraged:
when: (upgrade|success) and (${dist_upgrade})
Can be written as:
when: (upgrade|success) and dist_upgrade
Similarly:
when: ${dist_upgrade}
Should be:
when: dist_upgrade
do-release-upgrade is slow… can take from 1 - 2 hours to complete depending on your internet speeds.
Have you checked the screen that it creates during the processing when you think it is idling ?
do a:
sudo screen -list
It should list the one running there with something like this:
There is a screen on:
2953.ubuntu-release-upgrade-screen-window (09/13/2012 04:48:02 AM) (Detached)
1 Socket in /var/run/screen/S-root.
Then you can run:
sudo screen -d -r root/2953.ubuntu-release-upgrade-screen-window
I’m not 100% sure that screen gets run when you do a DistUpgradeViewNonInteractive… but have a look…
I would suggest running this command without waiting for it in a shell script or something like that, so Ansible doesn’t wait forever/until SSH times out. As this can’t really be timed or checked if succeeded before the machine have rebooted and you see a new distro version.
Ansible has an async option that can be used to poll on long running tasks, BTW.
Nice I didn’t even notice that.
What would happen if the box restarts though ? (Which happens after do-release-upgrade is done)
At least one can run it with poll 0, but would be cool if it can still run after reboot to continue doing a play.