Skip to content

Instantly share code, notes, and snippets.

@banyek
Created February 25, 2016 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save banyek/fb551e276c2c8ee88ada to your computer and use it in GitHub Desktop.
Save banyek/fb551e276c2c8ee88ada to your computer and use it in GitHub Desktop.
- hosts: "{{ host_to_rebuild }}"
gather_facts: False
user: root
serial: 1
tasks:
- name: Set PXE boot
shell: ipmitool chassis bootdev pxe
- name: Reset host
shell: service ipmitool power reset
- hosts: "admin_host"
gather_facts: False
user: root
serial: 1
tasks:
- name: Clearing the known hosts for jenkins
shell: echo -n > /usr/share/tomcat/.ssh/known_hosts
- name: Clean the puppet cert
shell: puppet cert clean {{ host_to_rebuild }}.kinja-ops.com'
- name: Sleep for 240 seconds so server can pxe boot
action: command /bin/sleep 240
- name: Waiting for port 22 to become available
shell: 'while ! nc -v {{ host_to_rebuild }}.kinja-ops.com 22; do /bin/sleep 10; done'
- hosts: "{{ host_to_rebuild }}"
gather_facts: False
user: root
serial: 1
- name: run puppet
shell: 'ssh -o StrictHostKeyChecking=no root@{{ server }}.{{ datacenter }}.kinja-ops.com puppet agent -tv >> /var/log/messages"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment