Skip to content

Instantly share code, notes, and snippets.

@palmerabollo
Created September 7, 2016 09:42
Show Gist options
  • Select an option

  • Save palmerabollo/9db23359d11290765a8e40b7bf2ac367 to your computer and use it in GitHub Desktop.

Select an option

Save palmerabollo/9db23359d11290765a8e40b7bf2ac367 to your computer and use it in GitHub Desktop.
- name: Release chaos monkey
hosts: localhost
gather_facts: true
connection: local
vars:
probability: 5
tasks:
- name: Kill random instances belonging to hostgroups with multiple instances
os_server:
name: "{{ item.key }}-{{ deployment_group_env }}-{{ item.value | length | random + 1 }}"
state: absent
when: |
100 | random < probability and
item.key not in ['all', 'localhost', 'ungrouped'] and
item.value | length > 1
with_dict: "{{ groups }}"
- name: Show hostgroups information after chaosmonkey
debug: var={{ groups }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment