Browse Source

Add weave

master
Sean Johnson 4 years ago
parent
commit
c76f9b549e
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG Key ID: 9FA15B87469EA850
  1. 2
      app/weave/defaults.yaml
  2. 41
      app/weave/init.sls
  3. 3
      app/weave/map.jinja
  4. 2
      app/weave/templates/weave.j2
  5. 15
      app/weave/templates/weave.service.j2
  6. 2
      base/package_map.yaml
  7. 4
      base/packages.sls
  8. 4
      top.sls

2
app/weave/defaults.yaml

@ -0,0 +1,2 @@
---
{}

41
app/weave/init.sls

@ -0,0 +1,41 @@
---
{% from "app/weave/map.jinja" import secrets with context %}
{% set peer_ipaddrs = salt["mine.get"]("datacenter:"~grains["dataceter"], public_ipaddrs, tgt_type="grain") %}
fetch latest weave-net release:
file.managed:
- source: https://git.io/weave
- name: /usr/local/bin/weave
- skip_verify: true
- user: root
- group: root
- mode: 0755
write systemd weave.service:
file.managed:
- source: salt://app/weave/templates/weave.service.j2
- name: /lib/systemd/system/weave.service
- user: root
- group: root
- mode: 0643
- template: jinja
systemctl drop-in weave.service.d:
file.directory:
- name: /lib/systemd/system/weave.service.d
- user: root
- group: root
- mode: 0644
write envfile weave:
file.managed:
- source: salt://app/weave/templates/weave.j2
- name: /etc/default/weave
- user: root
- group: root
- mode: 0755
- template: jinja
- context:
secrets: {{ secrets | tojson | yaml_squote }}
peers: {{ peer_ipaddrs | tojson | yaml_squote }}

3
app/weave/map.jinja

@ -0,0 +1,3 @@
{% import_yaml "app/weave/defaults.yaml" as defaults %}
{% set secrets = salt.pillar.get("weave") %}}

2
app/weave/templates/weave.j2

@ -0,0 +1,2 @@
WEAVE_PASSWORD="{{ secrets.weave_password }}"
PEERS="{{ peers.values() | join(" ") }}"

15
app/weave/templates/weave.service.j2

@ -0,0 +1,15 @@
[Unit]
Description=Weave Network
Documentation=http://docs.weave.works/weave/latest_release/
Requires=docker.service
After=docker.service
[Service]
EnvironmentFile=-/etc/default/weave
ExecStartPre=/usr/local/bin/weave launch --no-restart $PEERS
ExecStart=/usr/bin/docker attach weave
ExecStop=/usr/local/bin/weave stop
[Install]
WantedBy=multi-user.target

2
base/package_map.yaml

@ -1,6 +1,8 @@
---
Debian:
curl:
name: curl
pip:
name: python-pip
python_requests:

4
base/packages.sls

@ -7,6 +7,10 @@
include:
- "base.{{ osname }}_packages"
curl:
pkg.installed:
- name: "{{ packages.curl.name }}"
tmux:
pkg.installed:
- name: "{{ packages.tmux.name }}"

4
top.sls

@ -34,6 +34,10 @@ base:
- match: grain
- app.saltbot
'roles:weave_net':
- match: grain
- app.weave
'G@roles:consul_server or G@roles:consul_agent':
- match: compound
- app.consul.tls

Loading…
Cancel
Save