--- - hosts: terraform-master.e2m remote_user: hybris ########################################## ###### DEFINE YOUR MACHINES HERE vars: kubernetes: - hostname: k8s-master ipv6: 2001:470:6d:22c:42::1 mac_address: 52:54:00:b2:52:86 - hostname: k8s-node-1 ipv6: 2001:470:6d:22c:42::10 mac_address: 52:54:00:52:b2:b2 - hostname: k8s-node-2 ipv6: 2001:470:6d:22c:42::20 mac_address: 52:54:00:52:2f:86 - hostname: k8s-node-3 ipv6: 2001:470:6d:22c:42::30 mac_address: 52:54:00:52:2f:b2 - hostname: k8s-node-4 ipv6: 2001:470:6d:22c:42::40 mac_address: 52:54:00:b2:2f:86 ###### ########################################## tasks: # - name: download qcow2 cloud image # uri: # url: # dest: - name: create vm definitions template: src: "roles/terraform/files/cloud-init.tf.j2" dest: "/home/hybris/terraform/{{ item.hostname }}.tf" owner: hybris group: hybris with_items: "{{ kubernetes }}" - name: create cloud-init config template: src: "roles/terraform/files/cloud-init.cfg.j2" dest: "/home/hybris/terraform/{{ item.hostname }}.cloud_init.cfg" owner: hybris group: hybris with_items: "{{ kubernetes }}" - name: create libvirt_provider config copy: src: roles/terraform/files/libvirt_provider.tf dest: /home/hybris/terraform/libvirt_provider.tf - name: delete statefile if it exists file: path: /home/hybris/terraform/terraform.tfstate state: absent - name: initialize terraform shell: terraform init args: chdir: /home/hybris/terraform - name: plan terraform shell: terraform plan -out=cloud-init-plan args: chdir: /home/hybris/terraform - name: apply terraform shell: terraform apply "cloud-init-plan" args: chdir: /home/hybris/terraform