Skip to content

Commit

Permalink
Update to use workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenrlouie authored Nov 15, 2016
2 parents 99e322c + e9d0a8b commit ee14e9b
Show file tree
Hide file tree
Showing 16 changed files with 195 additions and 137 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,22 @@ coreos:

etcd2:
proxy: on
# cluster endpoints
listen-client-urls: http://0.0.0.0:2379
initial-cluster: etcd-n1=http://<%= @host.params['etcd-n1'] %>:2380,etcd-n2=http://<%= @host.params['etcd-n2'] %>:2380,etcd-n3=http://<%= @host.params['etcd-n3'] -%>:2380
initial-cluster: {{ .env.md.etcd_initial_cluster }}

fleet:
metadata: "role=<%= @role %>,vlan=<%= @host.primary_interface.vlanid %>"
metadata: "{{ .boot.md.fleet_metadata }},vlan={{ .interface.subnet.vlan }}"

units:
- name: down-interfaces.service
command: start
content: |
[Service]
Type=oneshot
ExecStart=/usr/bin/ip link set <%= @host.interfaces.first.identifier %> down
ExecStart=/usr/bin/ip addr flush dev <%= @host.interfaces.first.identifier %>
ExecStart=/usr/bin/ip link set <%= @host.interfaces.second.identifier %> down
ExecStart=/usr/bin/ip addr flush dev <%= @host.interfaces.second.identifier %>
{{- range $iface := .host.interfaces }}
ExecStart=/usr/bin/ip link set {{ $iface.identifier }} down
ExecStart=/usr/bin/ip addr flush dev {{ $iface.identifier }}
{{ end }}
- name: systemd-networkd.service
command: restart
- name: etcd2.service
Expand Down Expand Up @@ -60,26 +59,26 @@ write_files:
Name=po0
[Link]
MACAddress=<%= @host.interfaces.first.mac %>
MACAddress={{ index .host "interfaces" 0 "mac"}}
[Network]
DHCP=ipv4
BindCarrier=<%= @host.interfaces.first.identifier %> <%= @host.interfaces.second.identifier %>
- path: /etc/systemd/network/<%= @host.interfaces.first.identifier %>.network
BindCarrier={{ index .host "interfaces" 0 "identifier" }} {{ index .host "interfaces" 1 "identifier" }}
- path: /etc/systemd/network/{{ index .host "interfaces" 0 "identifier" }}.network
permissions: 0644
owner: root
content: |
[Match]
Name=<%= @host.interfaces.first.identifier %>
Name={{ index .host "interfaces" 0 "identifier" }}
[Network]
Bond=po0
- path: /etc/systemd/network/<%= @host.interfaces.second.identifier %>.network
- path: /etc/systemd/network/{{ index .host "interfaces" 1 "identifier" }}.network
permissions: 0644
owner: root
content: |
[Match]
Name=<%= @host.interfaces.second.identifier %>
Name={{ index .host "interfaces" 1 "identifier" }}
[Network]
Bond=po0
28 changes: 0 additions & 28 deletions assets/ignition/etcd-proxy.yaml

This file was deleted.

42 changes: 0 additions & 42 deletions assets/ignition/etcd.yaml

This file was deleted.

26 changes: 26 additions & 0 deletions assets/ignition/etcd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
networkd:
units:
- name: 10-static.network
contents: |
[Match]
MACAddress={{.interface.mac}}
[Network]
Gateway={{.interface.subnet.gateway}}
DNS={{ index .interface.subnet.dns 0 }}
Address={{ .interface.ipv4 }}
systemd:
units:
{{- template "etcd2" .}}


{{ if index .env "ssh_authorized_keys" }}
passwd:
users:
- name: core
ssh_authorized_keys:
{{ range $element := .env.ssh_authorized_keys }}
- {{$element}}
{{end}}
{{end}}
15 changes: 15 additions & 0 deletions assets/ignition/snippets/etcd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{ define "etcd2" }}
- name: etcd2.service
enable: true
dropins:
- name: 40-etcd-cluster.conf
contents: |
[Service]
Environment="ETCD_NAME={{.host.md.etcd_name}}"
Environment="ETCD_ADVERTISE_CLIENT_URLS=http://{{.interface.ipv4}}:2379"
Environment="ETCD_INITIAL_ADVERTISE_PEER_URLS=http://{{.interface.ipv4}}:2380"
Environment="ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379"
Environment="ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380"
Environment="ETCD_INITIAL_CLUSTER={{.env.md.etcd_initial_cluster}}"
Environment="ETCD_STRICT_RECONFIG_CHECK=true"
{{ end }}
23 changes: 17 additions & 6 deletions assets/untyped/clevos-answers.provision
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,25 @@ confirm = false
reboot = true

[post]
script: channel data port p6p1, p7p1
script: channel data port p6p1, p6p2
channel data bonding balanced
channel data bond_xmit_policy layer2
channel data ip {{.host.ipv4_address}}
channel data netmask {{.env.subnet.netmask}}
channel data gateway {{.env.subnet.gateway}}
system hostname {{.host.clever_name}}
{{ with index .host.interfaces 0 }}
channel data ip {{ .ipv4 }}
channel data netmask {{ .subnet.netmask }}
{{ end }}
channel client port em1, em2
channel client bonding balanced
{{ with index .host.interfaces 1 }}
channel client ip {{ .ipv4 }}
channel client netmask {{ .subnet.netmask }}
channel client gateway {{ .subnet.gateway }}
{{ end }}
system hostname {{ .host.name }}
system organization cdvr
system city philadelphia
system state pa
system country us
system dns {{ range $i, $dns := .interface.subnet.dns }}{{ if $i }},{{ end }}{{ $dns }}{{ end }}
system ntpservers {{ range $i, $ntp := .interface.subnet.ntp }}{{ if $i }},{{ end }}{{ $ntp }}{{ end }}
manager ip {{ .host.metadata.manager }}
password {{ .boot.metadata.root_pass }}
3 changes: 3 additions & 0 deletions host_groups/clevos.yml → boot/clevos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ operating_system: clevos-basic # TODO: actually create a ClevOS object
unattended:
type: untyped
use: clevos-answers.provision

metadata:
root_pass: cisco123
6 changes: 3 additions & 3 deletions host_groups/etcd-cluster.yml → boot/etcd-master.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
id: etcd-cluster
name: Etcd Cluster
id: etcd-master
name: Etcd Master

operating_system: coreos-1053.2.0-stable

unattended:
type: ignition
use: etcd.yaml
use: etcd.yml

metadata:
fleet_role: etcd
2 changes: 1 addition & 1 deletion host_groups/etcd-proxy.yml → boot/etcd-proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ operating_system: coreos-1053.2.0-stable

unattended:
type: cloud-config
use: etcd-proxy.yaml
use: etcd-proxy.yml

metadata:
fleet_metadata: role=etcd-proxy
6 changes: 3 additions & 3 deletions os/clevos-basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ minor_version: '7.2'
os_family: ClevOS
release_name: acc
boot:
kernel: "{{.agent.url}}/files/boot/accclevos.vmlinuz"
kernel: "{{.env.agentURL}}/files/boot/accclevos.vmlinuz"
initrd:
- "{{.agent.url}}/files/boot/acc/clevos.initrd"
- "{{.env.agentURL}}/files/boot/acc/clevos.initrd"
cmdline:
# Have to manually specify 'untyped' kernel opts
lang: ' '
Expand All @@ -23,7 +23,7 @@ cmdline:
ethdevice-timeout: '300'
clevos.runinstall:
noprompt:
clevos.installer.answers: "{{.host.configUrl}}" # configUrl is the full URL (with selectors) for this host's unattened config script
clevos.installer.answers: "{{.boot.configURL}}" # configUrl is the full URL (with selectors) for this host's unattened config script
dhcp:
config:
fetch:
4 changes: 2 additions & 2 deletions os/coreos-pxe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ minor_version: '2.0'
os_family: CoreOS
release_name: stable
boot:
kernel: "{{.agent.url}}/files/coreos_production_pxe.vmlinuz"
kernel: "{{.env.agentURL}}/files/{{.boot.os.release_name}}/{{.boot.os.major_version}}/{{.boot.os.minor_version}}/coreos_production_pxe.vmlinuz"
initrd:
- "{{.agent.url}}/files/coreos_production_pxe_image.cpio.gz"
- "{{.env.agentURL}}/files/coreos_production_pxe_image.cpio.gz"
cmdline:
coreos.autologin: ''
31 changes: 25 additions & 6 deletions sites/test-site/env.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,41 @@
---
name: Virtualenv Dev
id: test-site
subnets:
- id: default
cidr: 10.10.10.0/24
domain: foo.bar.com
gateway: 10.10.10.1
dns:
- 8.8.8.8
ntp:
- 10.10.10.1
- id: clevos
cidr: 192.168.1.0/24
domain: foo.bar.com
gateway: 192.168.1.1
dns:
- 8.8.8.8
- id: mgmt-subnet
cidr: 10.9.9.0/24
dns:
- 8.8.8.8
ntp:
- 10.10.10.1
# <AMS> Let's eventually replace this
agent:
url: "http://127.0.0.1"
port: 24602
secure_url: "https://some.proper.domainname.com"
secure_port: 443
cert_path: /etc/vaquero/certs/test-site.crt
# <AMS> With this
#agent: id-for-agent-on-controller # gain this ID from the registration process

metadata:
name: detroit-preprod
kind: pre-prod

etcd_initial_cluster: node1=http://10.10.10.10:2380,node2=http://10.10.10.11:2380,node3=http://10.10.10.12:2380
networkd_gateway: 172.15.0.1
networkd_dns: 172.15.0.3

subnet:
gateway: 192.168.1.1
netmask: 255.255.255.0

ssh_authorized_keys: []
Loading

0 comments on commit ee14e9b

Please sign in to comment.