Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Dirty incomplete upgrade OpenBSD 5.8 to 5.9 using ansible 2
---
- hosts: all
gather_facts: yes
vars:
mirror: http://ftp.eu.openbsd.org/pub/OpenBSD
release: 5.9
arch: amd64
tasks:
- name: installboot on sd0
command: installboot -v sd0
- name: Ensure /usr/rel exists
file: dest=/usr/rel state=directory
- name: Clean /usr/rel
shell: rm /usr/rel/*
ignore_errors: true
- name: Download packages
command: ftp -o /usr/rel/{{item}} {{mirror}}/{{release}}/{{arch}}/{{item}}
with_items:
- SHA256
- SHA256.sig
- bsd.rd
- bsd.mp
- bsd
- man59.tgz
- base59.tgz
- comp59.tgz
- game59.tgz
- xbase59.tgz
- xshare59.tgz
- name: Check SHA256
command: chdir=/usr/rel sha256 -C SHA256 bsd.rd bsd.mp bsd man59.tgz comp59.tgz base59.tgz game59.tgz xbase59.tgz xshare59.tgz
- name: Check with signify
command: chdir=/usr/rel signify -C -p /etc/signify/openbsd-59-base.pub -x SHA256.sig bsd.rd bsd.mp bsd man59.tgz comp59.tgz base59.tgz game59.tgz xbase59.tgz xshare59.tgz
- shell: cp /sbin/reboot /sbin/oreboot && cp /usr/rel/bsd /bsd.sp && cp /usr/rel/bsd.mp /bsd && cp /usr/rel/bsd.rd /bsd.rd
- name: Extract packages
command: tar -C / -xzphf {{item}}
chdir=/usr/rel
with_items:
- comp59.tgz
- man59.tgz
- game59.tgz
- xbase59.tgz
- xshare59.tgz
- name: Extract base and reboot
shell: tar -C / -xzphf /usr/rel/base59.tgz && /sbin/oreboot
async: 1
poll: 0
ignore_errors: true
- name: waiting for server to come back
local_action: wait_for host={{ inventory_hostname }} state=started delay=30 timeout=300
- name: MAKEDEV
command: chdir=/dev ./MAKEDEV all
- name: upgrade bootloader
command: installboot -v sd0
- name: sysmerge non interractive
command: sysmerge -b
ignore_errors: true
- name: firmware update
command: fw_update -v
- name: update pkg.conf
lineinfile:
regexp="^installpath ="
line="installpath = {{mirror}}/{{release}}/packages/{{arch}}"
dest=/etc/pkg.conf
- name: upgrade packages
command: pkg_add -u
- name: reboot again
command: /sbin/reboot
async: 1
poll: 0
ignore_errors: true
- name: waiting for server to come back
local_action: wait_for host={{ inventory_hostname }} state=started delay=30 timeout=300
- name: check uname
command: uname -a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment