-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
routeros_template.yml
47 lines (45 loc) · 1.23 KB
/
routeros_template.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
- name: Download the disk image
hosts: main_pve
vars_files:
- vars/main-pve.yml
- vaults/vault.yml
- vars/routeros.yml
vars:
version: '{{ routeros_template_version }}'
download: true
tasks:
- name: Install unzip
ansible.builtin.apt:
name: unzip
- name: Get the image
ansible.builtin.unarchive:
remote_src: true
src: 'https://download.mikrotik.com/routeros/{{ version }}/chr-{{ version }}.img.zip'
dest: /tmp
when: download
- name: Create the RouterOS template
hosts:
- localhost
connection: local
gather_facts: false
vars_files:
- vars/main-pve.yml
- vaults/vault.yml
- vars/routeros.yml
vars:
template_name: '{{ routeros_template_name }}'
vmid: '{{ routeros_template_vmid }}'
version: '{{ routeros_template_version }}'
disk_image: '/tmp/chr-{{ version }}.img'
memory: '{{ routeros_template_memory }}'
interfaces: '{{ rotueros_template_interfaces }}'
resize: '{{ routeros_template_disk_resize }}'
disk: '{{ routeros_template_disk_device }}'
storage: '{{ routeros_template_disk_storage }}'
recreate: true
roles:
- role: pve_purge
when: recreate
- role: pve_vm_template
when: recreate