Move fast and break things

This commit is contained in:
Florian Obser 2023-02-02 09:02:48 +01:00
parent 3b37bcafc2
commit e2ab675a8f

View File

@ -0,0 +1,58 @@
#+TITLE: Move fast and break things
#+DATE: 2023-02-02
I just leave this here...
#+begin_src yaml
#! /usr/bin/env ansible-playbook
- hosts: OpenBSD:!gb-lon2.tlakh.xyz:!vultr.tlakh.xyz
gather_facts: False
tasks:
- name: run sysupgrade
ansible.builtin.command:
cmd: 'sysupgrade -s'
ignore_errors: yes
async: 3600
poll: 0
- hosts: gb-lon2.tlakh.xyz:!vultr.tlakh.xyz
gather_facts: False
tasks:
- name: run sysupgrade -n
ansible.builtin.command:
cmd: 'sysupgrade -ns'
- name: check for /bsd.upgrade
ansible.builtin.stat:
path: /bsd.upgrade
register: upgrade_pending
- name: reboot and wait for host to return
block:
- name: schedule reboot in 1 minute
ansible.builtin.command:
cmd: 'shutdown -r +1'
- name: wait for ssh to go away
ansible.builtin.wait_for:
host: '{{ (ansible_ssh_host|default(ansible_host))|default(inventory_hostname) }}'
port: 22
state: stopped
delay: 10
vars:
ansible_connection: local
- name: wait for DNS to come back.
ansible.builtin.wait_for:
state: started
host: '{{ (ansible_ssh_host|default(ansible_host))|default(inventory_hostname) }}'
port: 53
delay: 10
vars:
ansible_connection: local
when: upgrade_pending.stat.exists
- hosts: vultr.tlakh.xyz
gather_facts: False
tasks:
- name: run sysupgrade
ansible.builtin.command:
cmd: 'sysupgrade -s'
ignore_errors: yes
#+end_src