Skip to content

Instantly share code, notes, and snippets.

@hartsock
Created October 22, 2019 17:38
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hartsock/7c88cd7552fade836574e67196123571 to your computer and use it in GitHub Desktop.
Save hartsock/7c88cd7552fade836574e67196123571 to your computer and use it in GitHub Desktop.
An Ansible playbook for upgrading VMware Photon OS 2.x to 3.x
---
- hosts: photon
remote_user: root
tasks:
- name: pip prerequisite
command: bash -c "tdnf -y install python-pip"
- name: python prerequisites
command: bash -c "pip install -I pexpect"
- name: install upgrade script for photon
command: bash -c "tdnf -y install photon-upgrade"
- name: upgrade photon OS from v 2 to v 3
expect:
command: /usr/bin/photon-upgrade.sh
responses:
(?i)\(y\/n\)\?: y
register: upgraded_result
- name: wait for reboot
wait_for_connection:
connect_timeout: 30
sleep: 10
delay: 5
timeout: 300
when: upgraded_result is changed
- name: update tdnf
command: bash -c "tdnf updateinfo && tdnf upgrade -y "
when: upgraded_result is changed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment