Skip to content

Instantly share code, notes, and snippets.

@jbrisbin
Created April 13, 2016 17:05
Show Gist options
  • Save jbrisbin/603789d39d0d242ecba67ae88d3e39f4 to your computer and use it in GitHub Desktop.
Save jbrisbin/603789d39d0d242ecba67ae88d3e39f4 to your computer and use it in GitHub Desktop.
#!/bin/bash
curl -sS master.mesos:5050/slaves/json | jq -r '.slaves[] | .hostname' >inventory.txt
---
- hosts: all
gather_facts: no
tasks:
- name: install weave
get_url: url=http://git.io/weave dest=/usr/local/bin/weave mode=0755
- name: find my ip
shell: ip addr show dev eth1 | egrep 'scope global' | cut -d\/ -f1 | awk '{print \$2}'
register: self_ip
- name: find slaves
shell: curl -sS master.mesos:5050/slaves/json | jq -r '.slaves[] | .hostname' | egrep -v {{self_ip.stdout}}
register: mesos_slaves
- name: stop weave
shell: weave stop
- name: start weave
shell: weave launch --ipalloc-range 192.168.0.0/16 {{ mesos_slaves.stdout_lines | join(' ') }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment