|
12 | 12 | group: vagrant
|
13 | 13 |
|
14 | 14 | - name: setup libvirt
|
15 |
| - include: libvirt.yml |
| 15 | + include_tasks: libvirt.yml |
16 | 16 |
|
17 |
| -- name: install Packer |
18 |
| - apt: |
19 |
| - name: packer |
| 17 | +- name: Create temporary directory |
| 18 | + ansible.builtin.tempfile: |
| 19 | + state: directory |
| 20 | + suffix: packer |
| 21 | + register: temp_dir |
| 22 | + |
| 23 | +- name: Download Packer zip archive |
| 24 | + ansible.builtin.get_url: |
| 25 | + url: "https://releases.hashicorp.com/packer/1.6.0/packer_1.6.0_linux_amd64.zip" |
| 26 | + dest: "{{ temp_dir.path }}/packer.zip" |
| 27 | + mode: "0644" |
| 28 | + |
| 29 | +- name: Install unzip |
| 30 | + ansible.builtin.apt: |
| 31 | + name: unzip |
20 | 32 | state: present
|
| 33 | + become: true |
| 34 | + |
| 35 | +- name: Unzip Packer archive |
| 36 | + ansible.builtin.unarchive: |
| 37 | + src: "{{ temp_dir.path }}/packer.zip" |
| 38 | + dest: "{{ temp_dir.path }}" |
| 39 | + remote_src: true |
| 40 | + |
| 41 | +- name: Move Packer binary to /usr/local/bin |
| 42 | + ansible.builtin.copy: |
| 43 | + src: "{{ temp_dir.path }}/packer" |
| 44 | + dest: "/usr/local/bin/packer" |
| 45 | + mode: "0755" |
| 46 | + remote_src: true |
| 47 | + become: true |
| 48 | + |
| 49 | +- name: Clean up temporary directory |
| 50 | + ansible.builtin.file: |
| 51 | + path: "{{ temp_dir.path }}" |
| 52 | + state: absent |
21 | 53 |
|
22 | 54 | - name: upload templates
|
23 | 55 | synchronize:
|
|
33 | 65 | mode: 0666
|
34 | 66 |
|
35 | 67 | - name: setup Windows XP
|
36 |
| - include: setup.yml |
| 68 | + include_tasks: setup.yml |
37 | 69 | with_items:
|
38 | 70 | - {
|
39 |
| - name: 'winxp', |
40 |
| - ram: '512', |
41 |
| - packer_template: 'windows.json', |
42 |
| - packer_varfile: 'winxp.json', |
43 |
| - image_url: 'https://www.dropbox.com/s/0zycew5u3xnf8m7/winxp.qcow2?dl=1', |
44 |
| - checksum_url: 'sha1:8550675150ee1601859c4665d49eb29005065446' |
| 71 | + name: "winxp", |
| 72 | + ram: "512", |
| 73 | + packer_template: "windows.json", |
| 74 | + packer_varfile: "winxp.json", |
| 75 | + image_url: "https://www.dropbox.com/s/0zycew5u3xnf8m7/winxp.qcow2?dl=1", |
| 76 | + checksum_url: "sha1:8550675150ee1601859c4665d49eb29005065446", |
45 | 77 | }
|
46 | 78 | when: enabled_vms['winxp']
|
47 | 79 |
|
48 | 80 | - name: setup Windows 7
|
49 |
| - include: setup.yml |
| 81 | + include_tasks: setup.yml |
50 | 82 | with_items:
|
51 | 83 | - {
|
52 |
| - name: 'win7', |
53 |
| - ram: '1500', |
54 |
| - packer_template: 'windows.json', |
55 |
| - packer_varfile: 'win7.json', |
56 |
| - image_url: 'https://www.dropbox.com/s/x9uyexfbhumphe7/win7.qcow2?dl=1', |
57 |
| - checksum_url: 'sha1:64c1c051efa70c902b0fd4b10c7d8da90215bbca' |
| 84 | + name: "win7", |
| 85 | + ram: "1500", |
| 86 | + packer_template: "windows.json", |
| 87 | + packer_varfile: "win7.json", |
| 88 | + image_url: "https://www.dropbox.com/s/x9uyexfbhumphe7/win7.qcow2?dl=1", |
| 89 | + checksum_url: "sha1:64c1c051efa70c902b0fd4b10c7d8da90215bbca", |
58 | 90 | }
|
59 | 91 | when: enabled_vms['win7']
|
60 | 92 |
|
61 | 93 | - name: setup Ubuntu
|
62 |
| - include: setup.yml |
| 94 | + include_tasks: setup.yml |
63 | 95 | with_items:
|
64 |
| - - { name: 'ubuntu', ram: '1024', packer_template: 'ubuntu.json', packer_varfile: 'ubuntu-16.04-server-i386.json' } |
| 96 | + - { |
| 97 | + name: "ubuntu", |
| 98 | + ram: "1024", |
| 99 | + packer_template: "ubuntu.json", |
| 100 | + packer_varfile: "ubuntu-16.04-server-i386.json", |
| 101 | + } |
65 | 102 | when: enabled_vms['ubuntu']
|
66 | 103 |
|
67 | 104 | - name: refresh libvirt pool
|
|
0 commit comments