diff options
25 files changed, 87 insertions, 95 deletions
diff --git a/chaos-at-home/ch-gw-lan.yml b/chaos-at-home/common.yml index a1d81d88..494f434f 100644 --- a/chaos-at-home/ch-gw-lan.yml +++ b/chaos-at-home/common.yml @@ -1,6 +1,6 @@ --- - name: Basic Setup - hosts: ch-gw-lan + hosts: "{{ install_hostname }}" roles: - role: base - role: sshd diff --git a/chaos-at-home/r3-cccamp19-feedcode.yml b/chaos-at-home/r3-cccamp19-feedcode.yml deleted file mode 100644 index 65485be7..00000000 --- a/chaos-at-home/r3-cccamp19-feedcode.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Basic Setup - hosts: r3-cccamp19-feedcode - roles: - - role: base - - role: sshd - - role: zsh diff --git a/common/cloud-install.yml b/common/cloud-install.yml index 57ebc9e6..e21d4bf1 100644 --- a/common/cloud-install.yml +++ b/common/cloud-install.yml @@ -29,7 +29,13 @@ roles: - role: cloud/post-install -- import_playbook: "../{{ install_environment }}/{{ hostvars[install_hostname].install_playbook | default(install_hostname) }}.yml" +- name: run host playbook + vars: + params: + files: + - "../{{ install_environment }}/{{ install_hostname }}.yml" + - "../{{ install_environment }}/{{ install_playbook | default('common') }}.yml" + import_playbook: "{{ q('first_found', params) | first }}" - name: reboot and wait for machine come back hosts: "{{ install_hostname }}" diff --git a/common/utils.sh b/common/utils.sh index 262926c7..bb14381e 100644 --- a/common/utils.sh +++ b/common/utils.sh @@ -19,8 +19,8 @@ ansible_variable__get() { local _var_name="$1" local _hosts="$2" - local _result=$(env ANSIBLE_STDOUT_CALLBACK="json" ansible "$_hosts" -m debug -a "var=$_var_name" | \ - jq -r ".plays[].tasks[].hosts[].$_var_name" | sort | uniq) + local _result=$(env ANSIBLE_STDOUT_CALLBACK="json" ansible "$_hosts" -m debug -a "msg={{ $_var_name }}" | \ + jq -r '.plays[].tasks[].hosts[] | select(.failed != true) | .msg' | sort | uniq) if [ $? -ne 0 ] || [ -z "$_result" ]; then print_error "failed to get value of variable '$_var_name' for host(s) '$_hosts'" return 1 diff --git a/common/vm-install.yml b/common/vm-install.yml index c3e7a25c..d449926e 100644 --- a/common/vm-install.yml +++ b/common/vm-install.yml @@ -58,7 +58,13 @@ - role: vm/guest when: install_distro in ['debian', 'ubuntu'] -- import_playbook: "../{{ install_environment }}/{{ hostvars[install_hostname].install_playbook | default(install_hostname) }}.yml" +- name: run host playbook + vars: + params: + files: + - "../{{ install_environment }}/{{ install_hostname }}.yml" + - "../{{ install_environment }}/{{ install_playbook | default('common') }}.yml" + import_playbook: "{{ q('first_found', params) | first }}" - name: reboot and wait for VM come back hosts: "{{ install_hostname }}" diff --git a/chaos-at-home/ch-router-obsd.yml b/dan/common.yml index 76b79316..494f434f 100644 --- a/chaos-at-home/ch-router-obsd.yml +++ b/dan/common.yml @@ -1,6 +1,6 @@ --- - name: Basic Setup - hosts: ch-router-obsd + hosts: "{{ install_hostname }}" roles: - role: base - role: sshd diff --git a/dan/emc-01.yml b/dan/emc-01.yml deleted file mode 100644 index d8582867..00000000 --- a/dan/emc-01.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -- name: Basic Setup - hosts: emc-01 - roles: - - role: base - - role: sshd - - role: zsh - - role: apt-repo/spreadspace - - role: acmetool/base - - role: acmetool/cert - acmetool_cert_name: "{{ host_name }}.{{ host_domain }}" diff --git a/dan/emc-02.yml b/dan/emc-02.yml deleted file mode 100644 index 78b4737a..00000000 --- a/dan/emc-02.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -- name: Basic Setup - hosts: emc-02 - roles: - - role: base - - role: sshd - - role: zsh - - role: apt-repo/spreadspace - - role: acmetool/base - - role: acmetool/cert - acmetool_cert_name: "{{ host_name }}.{{ host_domain }}" diff --git a/dan/emc-03.yml b/dan/emc-03.yml deleted file mode 100644 index 87814119..00000000 --- a/dan/emc-03.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -- name: Basic Setup - hosts: emc-03 - roles: - - role: base - - role: sshd - - role: zsh - - role: apt-repo/spreadspace - - role: acmetool/base - - role: acmetool/cert - acmetool_cert_name: "{{ host_name }}.{{ host_domain }}" diff --git a/dan/emc-dist.yml b/dan/emc-dist.yml deleted file mode 100644 index 0e2318f4..00000000 --- a/dan/emc-dist.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Basic Setup - hosts: emc-dist - roles: - - role: base - - role: sshd - - role: zsh diff --git a/dan/emc-dist0.yml b/dan/emc-dist0.yml deleted file mode 100644 index 9efb2731..00000000 --- a/dan/emc-dist0.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Basic Setup - hosts: emc-dist0 - roles: - - role: base - - role: sshd - - role: zsh diff --git a/dan/emc-xx.yml b/dan/emc-xx.yml index 7b80f76e..eb9586ac 100644 --- a/dan/emc-xx.yml +++ b/dan/emc-xx.yml @@ -1,6 +1,6 @@ --- - name: Basic Setup - hosts: emc-xx + hosts: "{{ install_hostname }}" roles: - role: base - role: sshd diff --git a/dan/sk-testvm.yml b/dan/sk-testvm.yml deleted file mode 100644 index 39c775aa..00000000 --- a/dan/sk-testvm.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Basic Setup - hosts: sk-testvm - roles: - - role: base - - role: sshd - - role: zsh @@ -26,4 +26,10 @@ rm -f ".cache/facts/$name" echo "" echo "######## running the install playbook ########" -exec ansible-playbook -e "install_hostname=$name" -e "install_distro=$distro" -e "install_codename=$codename" -e "install_environment=$env_group" $@ "$env_group/$(basename "$0" .sh).yml" +declare -a extra_vars +extra_vars+=(-e "install_hostname=$name") +extra_vars+=(-e "install_distro=$distro") +extra_vars+=(-e "install_codename=$codename") +extra_vars+=(-e "install_environment=$env_group") +ansible_variable__get install_playbook "$name" > /dev/null 2>&1 && extra_vars+=(-e "install_playbook=$install_playbook") +exec ansible-playbook ${extra_vars[@]} $@ "$env_group/$(basename "$0" .sh).yml" diff --git a/inventory/group_vars/emc-xx/main.yml b/inventory/group_vars/emc-xx/main.yml index c73b8962..1e0dd476 100644 --- a/inventory/group_vars/emc-xx/main.yml +++ b/inventory/group_vars/emc-xx/main.yml @@ -1,23 +1,5 @@ --- +acmetool_account_email: equinox@spreadspace.org acmetool_directory_server: "{{ acmetool_directory_server_le_live_v2 }}" -install: - cloud: - credentials: - token: "{{ vault_hcloud_api_token }}" - disks: - root_lvm_size: all - -network: {} - -docker_lvm: - vg: "{{ host_name }}" - lv: docker - size: 15G - fs: ext4 - -kubelet_lvm: - vg: "{{ host_name }}" - lv: kubelet - size: 10G - fs: ext4 +install_playbook: emc-xx diff --git a/inventory/group_vars/emc/main.yml b/inventory/group_vars/emc/main.yml index d3b3dc12..02a2e25c 100644 --- a/inventory/group_vars/emc/main.yml +++ b/inventory/group_vars/emc/main.yml @@ -1,4 +1,23 @@ --- zsh_banner: elevate -acmetool_account_email: equinox@spreadspace.org +install: + cloud: + credentials: + token: "{{ vault_hcloud_api_token }}" + disks: + root_lvm_size: all + +network: {} + +docker_lvm: + vg: "{{ host_name }}" + lv: docker + size: 15G + fs: ext4 + +kubelet_lvm: + vg: "{{ host_name }}" + lv: kubelet + size: 10G + fs: ext4 diff --git a/inventory/group_vars/lendwirbel-live-xx/main.yml b/inventory/group_vars/lendwirbel-live-xx/main.yml new file mode 100644 index 00000000..cf094bd1 --- /dev/null +++ b/inventory/group_vars/lendwirbel-live-xx/main.yml @@ -0,0 +1,5 @@ +--- +acmetool_account_email: equinox@spreadspace.org +# acmetool_directory_server: "{{ acmetool_directory_server_le_live_v2 }}" + +install_playbook: lendwirbel-live-xx diff --git a/inventory/group_vars/emc-dist.yml b/inventory/group_vars/lendwirbel-live/main.yml index e53a98ad..d3df4b61 100644 --- a/inventory/group_vars/emc-dist.yml +++ b/inventory/group_vars/lendwirbel-live/main.yml @@ -1,4 +1,6 @@ --- +zsh_banner: spreadspace + install: cloud: credentials: diff --git a/inventory/hosts.ini b/inventory/hosts.ini index 2be67e06..7aaf4c97 100644 --- a/inventory/hosts.ini +++ b/inventory/hosts.ini @@ -91,6 +91,21 @@ s2-dione host_name=dione s2-helene host_name=helene +[lendwirbel-live:vars] +host_domain=lndwrbl.live +env_group=spreadspace + +[lendwirbel-live:children] +lendwirbel-live-dist +lendwirbel-live-xx + +[lendwirbel-live-dist] +lw-live-dist0 host_name=cdn-dist0 + +[lendwirbel-live-xx] +lw-live-00 host_name=cdn-00 + + ############################### # environment: dan @@ -235,6 +250,8 @@ ele-lt [hcloud:children] emc-dist emc-xx +lendwirbel-live-dist +lendwirbel-live-xx [hetzner] emc-master diff --git a/roles/cloud/install/tasks/hcloud.yml b/roles/cloud/install/tasks/hcloud.yml index 983b3dec..b716f4ac 100644 --- a/roles/cloud/install/tasks/hcloud.yml +++ b/roles/cloud/install/tasks/hcloud.yml @@ -76,7 +76,7 @@ delay: 30 timeout: 120 -- import_tasks: hetzner_installimage.yml +- include_tasks: hetzner_installimage.yml - name: reboot shell: sleep 2 && shutdown -r now "triggered by ansible after running installimage" diff --git a/roles/cloud/install/tasks/hroot.yml b/roles/cloud/install/tasks/hroot.yml index b7d511a0..1ff4a55d 100644 --- a/roles/cloud/install/tasks/hroot.yml +++ b/roles/cloud/install/tasks/hroot.yml @@ -97,7 +97,7 @@ delay: 30 timeout: 120 -- import_tasks: hetzner_installimage.yml +- include_tasks: hetzner_installimage.yml - name: reboot shell: sleep 2 && shutdown -r now "triggered by ansible after running installimage" diff --git a/roles/cloud/install/templates/hetzner_installimage.conf.j2 b/roles/cloud/install/templates/hetzner_installimage.conf.j2 index a30fb94a..0881b110 100644 --- a/roles/cloud/install/templates/hetzner_installimage.conf.j2 +++ b/roles/cloud/install/templates/hetzner_installimage.conf.j2 @@ -1,4 +1,4 @@ -HOSTNAME {{ host_name }} +HOSTNAME {{ host_name }}{% if host_domain %}.{{ host_domain }}{% endif %}{{ '' }} {% if cloud_provider == "hroot" %} {% if install_cooked.disks.layout == "nvme_raid" %} DRIVE1 /dev/nvme0n1 diff --git a/chaos-at-home/ch-testvm.yml b/spreadspace/common.yml index c10c8b57..494f434f 100644 --- a/chaos-at-home/ch-testvm.yml +++ b/spreadspace/common.yml @@ -1,6 +1,6 @@ --- - name: Basic Setup - hosts: ch-testvm + hosts: "{{ install_hostname }}" roles: - role: base - role: sshd diff --git a/spreadspace/group_vars/lendwirbel-live.yml b/spreadspace/group_vars/lendwirbel-live.yml new file mode 100644 index 00000000..198d3cfe --- /dev/null +++ b/spreadspace/group_vars/lendwirbel-live.yml @@ -0,0 +1,10 @@ +$ANSIBLE_VAULT;1.2;AES256;spreadspace +34316134383639356635643636313263633466313436346232383263393736393961343764386662 +6336393866353663383330303030396534393362643631630a316334613635303364303134306435 +61623037663764376561383731343830346236613536326431383963303165303134326634613061 +3035323031303739380a383662383464323635363636386237313831643231346339353265336337 +30616664633066643739383132346537613165623339333037383062326234633137306535326534 +62393437643565616565613038396462643731333663363461636232346336323834616439346130 +34663966376433613335653039346362323332656238626237653533666332653164363531656435 +66326436626633636563646533326131303935623633633032333438613134373437663332356432 +3930 diff --git a/dan/emc-00.yml b/spreadspace/lendwirbel-live-xx.yml index 2238f0c4..eb9586ac 100644 --- a/dan/emc-00.yml +++ b/spreadspace/lendwirbel-live-xx.yml @@ -1,6 +1,6 @@ --- - name: Basic Setup - hosts: emc-00 + hosts: "{{ install_hostname }}" roles: - role: base - role: sshd |