--- - hosts: terraform-master.e2m remote_user: hybris ########################################## ###### DEFINE YOUR MACHINES HERE vars: # libvirt host vars libvirt_host: [2001:470:6d:22c:1::1] libvirt_storage_pool: kubernetes libvirt_network_bridge: home-lan # ansible user vars # python -c 'import crypt; print crypt.crypt("This is my Password", "$1$SomeSalt$")' remote_user_pass: $1$tG6Uv4$BPCIRF6RFuLrJ.lQO1GB8. remote_user_ssh_pubkey: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDXh0iMMtbTEhRSgIbgCunAuE+Q1iKycRVRBYWDCQ45xE8nHsg7K98fdv6LqQwkTqlojEHKp2/TPawk8V6w3MTgOHXi/WO9FyvhMjUcfdxTvny1z3Pj1j0NglKjyQ3t30snwOBYJiC2qDDtvRYNJs+Re/aSdVbygOHMf0UqCyP8DL7Tcj5sNPgnleEC7jE+YNbyDJo2KtNFXy3+AMbwa742D5Ygi5FqaBO090gVQfb3hbnZLw9CNSK7vjo7k5hJo8d1kcPDth1Vo12IDejL8Al3ArfGSy5IqYXs8Stj4YVRW+78AOpQZiInCaFybqjsGG+5tezrXHrxhjJPHuSCuXk9vxkcUk7aC5eSDqoCP7RTB+iQCPJ1ZvkVbaebExZGgHpD9t2Xo2bd/3BRagIxPTzKo9q4+qCCClhWR4iUSOr/YKAZBFDdoVWg2IMqbUHzvHX7TE7I8hbAdg6CpgwBoJm8OWmfjkDU6aYnF8z9l36VV7xjvvuYbOrhpCJ9LGFSfmG3wswo8OH4XyRSHd3y7qrSYIGujtymrzozXo2MrMU3Rj2bW5MIEZSxleIVje4PHWOfZwwn3hwvqM/nyknzfNwPCidTsP3Q2FwfBtZYo1cIXH41bzjs4Bxb8+KJqwTcerzB1pT4qsoPnoYW0fnZE7NHVNhfNx53LdctclFerHTLMw== hybris@sparks ## does this make sense?? source_cloud_image_name: CentOS-7-x86_64-GenericCloud.qcow2 source_cloud_image_url: https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1503.qcow2 kubernetes: - hostname: k8s-master ipv6: 2001:470:6d:22c:42::1 mac_address: 52:54:00:b2:52:86 memory: 5072 vcpu: 2 - hostname: k8s-node-1 ipv6: 2001:470:6d:22c:42::10 mac_address: 52:54:00:52:b2:b2 memory: 5072 vcpu: 2 - hostname: k8s-node-2 ipv6: 2001:470:6d:22c:42::20 mac_address: 52:54:00:52:2f:86 memory: 5072 vcpu: 2 - hostname: k8s-node-3 ipv6: 2001:470:6d:22c:42::30 mac_address: 52:54:00:52:2f:b2 memory: 5072 vcpu: 2 - hostname: k8s-node-4 ipv6: 2001:470:6d:22c:42::40 mac_address: 52:54:00:b2:2f:86 memory: 5072 vcpu: 2 ###### ########################################## tasks: - name: download qcow2 cloud image uri: url: {{ source_cloud_image_url }} dest: /home/{{ remote_user }}/terraform/{{ source_cloud_image_name }} - name: create vm definitions template: src: "roles/terraform/files/cloud-init.tf.j2" dest: "/home/{{ remote_user }}/terraform/{{ item.hostname }}.tf" owner: {{ remote_user }} group: {{ remote_user }} with_items: "{{ kubernetes }}" - name: create cloud-init config template: src: "roles/terraform/files/cloud-init.cfg.j2" dest: "/home/{{ remote_user }}/terraform/{{ item.hostname }}.cloud_init.cfg" owner: {{ remote_user }} group: {{ remote_user }} with_items: "{{ kubernetes }}" - name: create libvirt_provider config copy: src: roles/terraform/files/libvirt_provider.tf dest: /home/{{ remote_user }}/terraform/libvirt_provider.tf - name: delete statefile if it exists file: path: /home/{{ remote_user }}/terraform/terraform.tfstate state: absent - name: initialize terraform shell: terraform init args: chdir: /home/{{ remote_user }}/terraform - name: plan terraform shell: terraform plan -out=cloud-init-plan args: chdir: /home/{{ remote_user }}/terraform - name: apply terraform shell: terraform apply "cloud-init-plan" args: chdir: /home/{{ remote_user }}/terraform []