blob: a63715305b90a235a9e506e7dfc64230c7392eb4 [file] [log] [blame]
Zack Williams8625d042016-02-26 14:32:43 -07001---
2# roles/create-vms/tasks/main.yml
3
4- name: create Virtual Machines with uvt-kvm
5 shell: uvt-kvm create {{ item.name }} --cpu={{ item.cpu }} --memory={{ item.memMB }} --disk={{ item.diskGB }}; \
6 uvt-kvm wait --insecure {{ item.name }}
7 creates=/var/lib/uvtool/libvirt/images/{{ item.name }}.qcow
8 with_items: head_vm_list
9
10- name: discover VM IP addresses
11 shell: uvt-kvm ip {{ item.name }}
12 with_items: head_vm_list
13 register: vm_ip
14
15- name: Create /etc/hosts with VM IP addresses
Zack Williams573bafc2016-02-26 16:35:42 -070016 become: yes
Zack Williams8625d042016-02-26 14:32:43 -070017 template:
18 src=hosts.j2
19 dest=/etc/hosts
Zack Williams573bafc2016-02-26 16:35:42 -070020
21- name: Create /etc/ansible/hosts file
22 become: yes
23 template:
24 src=ansible_hosts.j2
25 dest=/etc/ansible/hosts
26