summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2018-09-13 18:19:40 +0300
committerLars Wirzenius <liw@liw.fi>2018-09-13 18:19:40 +0300
commite96f3a688ef60b737d93c1650048d1344b76c991 (patch)
treef537757dadd6e4c4038b489b53f910982353da17
parent61c12b7938bd8fd8c17155b646b08fd1caf3cd6c (diff)
downloadick2-ansible-e96f3a688ef60b737d93c1650048d1344b76c991.tar.gz
Change: split workers off main playbook
-rw-r--r--ci-prep.hz5
-rw-r--r--ci-prod-workers.hz6
-rw-r--r--ci-prod.hz6
-rw-r--r--demo-workers.hz6
-rw-r--r--demo.hz6
-rw-r--r--group_vars/ickhost.yml4
-rw-r--r--ick-cluster.yml11
-rw-r--r--ick-workers.yml10
-rw-r--r--ickdev.hz6
-rw-r--r--ickweb.hz5
-rwxr-xr-xrun-workers.sh52
11 files changed, 103 insertions, 14 deletions
diff --git a/ci-prep.hz b/ci-prep.hz
new file mode 100644
index 0000000..3b86c64
--- /dev/null
+++ b/ci-prep.hz
@@ -0,0 +1,5 @@
+defaults:
+ type: cx31
+ image: debian-9
+hosts:
+ - name: ick
diff --git a/ci-prod-workers.hz b/ci-prod-workers.hz
new file mode 100644
index 0000000..abd0f8f
--- /dev/null
+++ b/ci-prod-workers.hz
@@ -0,0 +1,6 @@
+defaults:
+ type: cx11
+ image: debian-9
+hosts:
+ - name: worker1
+ - name: worker2
diff --git a/ci-prod.hz b/ci-prod.hz
new file mode 100644
index 0000000..cfb74b9
--- /dev/null
+++ b/ci-prod.hz
@@ -0,0 +1,6 @@
+defaults:
+ type: cx11
+ image: debian-9
+hosts:
+ - name: controller
+ type: cx21
diff --git a/demo-workers.hz b/demo-workers.hz
new file mode 100644
index 0000000..abd0f8f
--- /dev/null
+++ b/demo-workers.hz
@@ -0,0 +1,6 @@
+defaults:
+ type: cx11
+ image: debian-9
+hosts:
+ - name: worker1
+ - name: worker2
diff --git a/demo.hz b/demo.hz
new file mode 100644
index 0000000..cfb74b9
--- /dev/null
+++ b/demo.hz
@@ -0,0 +1,6 @@
+defaults:
+ type: cx11
+ image: debian-9
+hosts:
+ - name: controller
+ type: cx21
diff --git a/group_vars/ickhost.yml b/group_vars/ickhost.yml
index a92b3a2..c46c6b6 100644
--- a/group_vars/ickhost.yml
+++ b/group_vars/ickhost.yml
@@ -10,10 +10,8 @@ ci_prefix: ""
sources_lists:
- repo: "deb http://deb.debian.org/debian stretch-backports main"
- repo: "deb http://code.liw.fi/debian stretch main ickhost"
- keyring_package: code.liw.fi-keyring
signing_key: "{{ code_liw_fi_signing_key }}"
- - repo: "deb http://ick-controller.h.qvarnlabs.eu/debian stretch-ci main"
- signing_key: "{{ ql_ick_apt_signing_key }}"
+ - repo: "deb http://code.liw.fi/debian stretch-ci main ickhost"
controller_port: 12765
artifact_store_port: 12766
diff --git a/ick-cluster.yml b/ick-cluster.yml
index fb8fa7f..d23a82c 100644
--- a/ick-cluster.yml
+++ b/ick-cluster.yml
@@ -1,14 +1,3 @@
-- hosts: workers
- remote_user: root
- become: yes
- roles:
- - sane_debian_system
- - comfortable
- - unix_users
- - ick-worker
- vars:
- verify_tls: yes
-
- hosts: ick
remote_user: root
become: yes
diff --git a/ick-workers.yml b/ick-workers.yml
new file mode 100644
index 0000000..9cda47c
--- /dev/null
+++ b/ick-workers.yml
@@ -0,0 +1,10 @@
+- hosts: workers
+ remote_user: root
+ become: yes
+ roles:
+ - sane_debian_system
+ - comfortable
+ - unix_users
+ - ick-worker
+ vars:
+ verify_tls: yes
diff --git a/ickdev.hz b/ickdev.hz
new file mode 100644
index 0000000..18742b3
--- /dev/null
+++ b/ickdev.hz
@@ -0,0 +1,6 @@
+defaults:
+ type: cx11
+ image: debian-9
+hosts:
+ - name: ick
+ type: cx51
diff --git a/ickweb.hz b/ickweb.hz
new file mode 100644
index 0000000..0f8c8f5
--- /dev/null
+++ b/ickweb.hz
@@ -0,0 +1,5 @@
+defaults:
+ type: cx11
+ image: debian-9
+hosts:
+ - name: demo
diff --git a/run-workers.sh b/run-workers.sh
new file mode 100755
index 0000000..0332027
--- /dev/null
+++ b/run-workers.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+set -eu
+
+
+getaddr()
+{
+ awk -v "name=$1" '$1 == name { print $2 }' "$hosts_in" |
+ sed 's/ansible_ssh_host=//'
+}
+
+
+count_workers()
+{
+ grep -Ec '^worker[[:digit:]]+' "$1"
+}
+
+
+mkhosts()
+{
+ local n="$1"
+ for i in $(seq "$n")
+ do
+ echo "worker$i hostname=worker$i ansible_ssh_host=$(getaddr worker$i)"
+ done
+ echo
+
+ echo "[ickhost]"
+ for i in $(seq "$n")
+ do
+ echo "worker$i"
+ done
+ echo
+
+ echo "[workers]"
+ for i in $(seq "$n")
+ do
+ echo "worker$i"
+ done
+}
+
+hosts_in="$1"
+controller_domain="$2"
+apt_domain="$controller_domain"
+shift 2
+
+nw="$(count_workers "$hosts_in")"
+mkhosts "$nw" > hosts.tmp
+ansible-playbook -i hosts.tmp ick-workers.yml \
+ -e "controller_domain=$controller_domain" \
+ -e "apt_domain=$apt_domain)" \
+ "$@"