Zack Williams | 8625d04 | 2016-02-26 14:32:43 -0700 | [diff] [blame] | 1 | --- |
| 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 Williams | 573bafc | 2016-02-26 16:35:42 -0700 | [diff] [blame] | 16 | become: yes |
Zack Williams | 8625d04 | 2016-02-26 14:32:43 -0700 | [diff] [blame] | 17 | template: |
| 18 | src=hosts.j2 |
| 19 | dest=/etc/hosts |
Zack Williams | 573bafc | 2016-02-26 16:35:42 -0700 | [diff] [blame] | 20 | |
| 21 | - name: Create /etc/ansible/hosts file |
| 22 | become: yes |
| 23 | template: |
| 24 | src=ansible_hosts.j2 |
| 25 | dest=/etc/ansible/hosts |
| 26 | |