summaryrefslogtreecommitdiff
path: root/common/vm-install.yml
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2020-04-23 01:24:38 +0200
committerChristian Pointner <equinox@spreadspace.org>2020-04-23 01:24:38 +0200
commit17077868e615fa7115abdb03a5af4662ab0a3679 (patch)
tree22cb752792c3410bcfe8ce856b9746cad1ccf8d3 /common/vm-install.yml
parentremove spreadspace k8s-test cluster (diff)
refactor all install roles ans playbooks to work with new variable install_hostname
Diffstat (limited to 'common/vm-install.yml')
-rw-r--r--common/vm-install.yml24
1 files changed, 12 insertions, 12 deletions
diff --git a/common/vm-install.yml b/common/vm-install.yml
index cb3b86f0..c3e7a25c 100644
--- a/common/vm-install.yml
+++ b/common/vm-install.yml
@@ -1,17 +1,11 @@
---
- name: preperations and sanity checks
- hosts: "{{ hostname }}"
+ hosts: "{{ install_hostname }}"
gather_facts: no
tasks:
- - name: create temporary host group for vm host
- add_host:
- name: "{{ vm_host }}"
- inventory_dir: "{{ inventory_dir }}"
- group: _vmhost_
-
- name: check if the installee belongs to the kvmguests group
fail:
- msg: "the host '{{ hostname }}' does not belong to the group 'kvmguests'"
+ msg: "the host '{{ install_hostname }}' does not belong to the group 'kvmguests'"
when:
- "'kvmguests' not in group_names"
@@ -23,6 +17,12 @@
# TODO: add some more sanity checks
+ - name: create temporary host group for vm host
+ add_host:
+ name: "{{ vm_host }}"
+ inventory_dir: "{{ inventory_dir }}"
+ group: _vmhost_
+
- name: basic installation
hosts: _vmhost_
@@ -30,7 +30,7 @@
- role: vm/install
- name: wait for new vm to start up
- hosts: "{{ hostname }}"
+ hosts: "{{ install_hostname }}"
gather_facts: no
tasks:
## TODO: find a better way to fetch host key of new VMs
@@ -46,7 +46,7 @@
ansible_ssh_extra_args: ""
- name: apply basic VM configuration roles
- hosts: "{{ hostname }}"
+ hosts: "{{ install_hostname }}"
pre_tasks:
- name: make sure to update cached facts
setup:
@@ -58,10 +58,10 @@
- role: vm/guest
when: install_distro in ['debian', 'ubuntu']
-- import_playbook: "../{{ hostenv }}/{{ hostname }}.yml"
+- import_playbook: "../{{ install_environment }}/{{ hostvars[install_hostname].install_playbook | default(install_hostname) }}.yml"
- name: reboot and wait for VM come back
- hosts: "{{ hostname }}"
+ hosts: "{{ install_hostname }}"
gather_facts: no
roles:
- role: reboot-and-wait