# Ubuntu Release Upgrade

**URL:** <https://forum.ansible.com/t/ubuntu-release-upgrade/13773>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [October 26, 2013, 1:36am UTC](https://forum.ansible.com/t/ubuntu-release-upgrade/13773 "2013-10-26T01:36:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Wolstenholme](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@Paul\_Wolstenholme](https://forum.ansible.com/u/Paul_Wolstenholme)\
**Post date:** [October 26, 2013, 1:36am UTC](https://forum.ansible.com/t/ubuntu-release-upgrade/13773/1 "2013-10-26T01:36:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 26, 2013, 3:23pm UTC](https://forum.ansible.com/t/ubuntu-release-upgrade/13773/2 "2013-10-26T15:23:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Alex\_Rodenberg](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@Alex\_Rodenberg](https://forum.ansible.com/u/Alex_Rodenberg)\
**Post date:** [October 29, 2013, 2:57pm UTC](https://forum.ansible.com/t/ubuntu-release-upgrade/13773/3 "2013-10-29T14:57:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 30, 2013, 1:54am UTC](https://forum.ansible.com/t/ubuntu-release-upgrade/13773/4 "2013-10-30T01:54:31Z")

</div>

Ansible has an async option that can be used to poll on long running tasks, BTW.

---

<div class="post-metadata">

**Author:** ![Alex\_Rodenberg](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@Alex\_Rodenberg](https://forum.ansible.com/u/Alex_Rodenberg)\
**Post date:** [November 1, 2013, 10:48am UTC](https://forum.ansible.com/t/ubuntu-release-upgrade/13773/5 "2013-11-01T10:48:31Z")

</div>

Nice I didn’t even notice that.

What would happen if the box restarts though ? (Which happens after do-release-upgrade is done)

---

<div class="post-metadata">

**Author:** ![Alex\_Rodenberg](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@Alex\_Rodenberg](https://forum.ansible.com/u/Alex_Rodenberg)\
**Post date:** [November 1, 2013, 10:49am UTC](https://forum.ansible.com/t/ubuntu-release-upgrade/13773/6 "2013-11-01T10:49:26Z")

</div>

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.
