summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--group_vars/all.yml19
-rw-r--r--hyperv.yml23
-rw-r--r--qemu.yml26
-rw-r--r--roles/attach-loop-device/tasks/main.yml12
-rw-r--r--roles/attach-loop-device/tests/inventory2
-rw-r--r--roles/attach-loop-device/tests/test.yml4
-rw-r--r--roles/common/tasks/get_latest_iso.yml9
-rw-r--r--roles/common/tasks/main.yml2
-rw-r--r--roles/create-disk/tasks/main.yml2
-rw-r--r--roles/create-disk/tests/inventory2
-rw-r--r--roles/create-disk/tests/test.yml4
-rwxr-xr-xroles/download-iso/library/latest_iso.py (renamed from library/latest_iso.py)0
-rw-r--r--roles/download-iso/tasks/main.yml38
-rw-r--r--roles/download-iso/tests/inventory2
-rw-r--r--roles/download-iso/tests/test.yml4
-rw-r--r--roles/get-version/tasks/main.yml10
-rw-r--r--roles/get-version/tests/inventory2
-rw-r--r--roles/get-version/tests/test.yml4
-rw-r--r--roles/hyperv-vhd/tasks/main.yml (renamed from roles/hyperv/tasks/convert.yml)0
-rw-r--r--roles/hyperv-vhd/tests/inventory2
-rw-r--r--roles/hyperv-vhd/tests/test.yml4
-rw-r--r--roles/hyperv/tasks/build_image.yml122
-rw-r--r--roles/hyperv/tasks/load_modules.yml2
-rw-r--r--roles/hyperv/tasks/main.yml6
-rw-r--r--roles/hyperv/tasks/release.yml6
-rw-r--r--roles/hyperv/tasks/setup_iso.yml57
-rw-r--r--roles/hyperv/tasks/unmount.yml66
-rw-r--r--roles/hyperv/templates/boot/grub/grub.cfg.j27
-rw-r--r--roles/hyperv/vars/main.yml2
-rw-r--r--roles/install-config/files/config.boot (renamed from roles/hyperv/files/config.boot)0
-rw-r--r--roles/install-config/tasks/main.yml12
-rw-r--r--roles/install-config/tests/inventory2
-rw-r--r--roles/install-config/tests/test.yml4
-rw-r--r--roles/install-grub/tasks/main.yml32
-rw-r--r--roles/install-grub/templates/boot/grub/device.map.j2 (renamed from roles/hyperv/templates/boot/grub/device.map.j2)0
-rw-r--r--roles/install-grub/templates/boot/grub/grub.cfg.j27
-rw-r--r--roles/install-grub/tests/inventory2
-rw-r--r--roles/install-grub/tests/test.yml4
-rw-r--r--roles/install-image/tasks/main.yml24
-rw-r--r--roles/install-image/tests/inventory2
-rw-r--r--roles/install-image/tests/test.yml4
-rw-r--r--roles/install-packages/tasks/main.yml (renamed from roles/common/tasks/install_packages.yml)4
-rw-r--r--roles/install-packages/tests/inventory2
-rw-r--r--roles/install-packages/tests/test.yml5
-rw-r--r--roles/install-persistence-conf/files/persistence.conf (renamed from roles/hyperv/files/persistence.conf)0
-rw-r--r--roles/install-persistence-conf/tasks/main.yml6
-rw-r--r--roles/install-persistence-conf/tests/inventory2
-rw-r--r--roles/install-persistence-conf/tests/test.yml4
-rw-r--r--roles/load-modules/tasks/main.yml5
-rw-r--r--roles/load-modules/tests/inventory2
-rw-r--r--roles/load-modules/tests/test.yml4
-rw-r--r--roles/mount-iso/tasks/main.yml23
-rw-r--r--roles/mount-iso/tests/inventory2
-rw-r--r--roles/mount-iso/tests/test.yml4
-rw-r--r--roles/mount-root-fs/tasks/main.yml17
-rw-r--r--roles/mount-root-fs/tests/inventory2
-rw-r--r--roles/mount-root-fs/tests/test.yml4
-rw-r--r--roles/qemu-qcow2/tasks/main.yml (renamed from roles/qemu/tasks/convert.yml)0
-rw-r--r--roles/qemu-qcow2/tests/inventory2
-rw-r--r--roles/qemu-qcow2/tests/test.yml5
-rw-r--r--roles/qemu/files/config.boot41
-rw-r--r--roles/qemu/files/persistence.conf1
-rw-r--r--roles/qemu/tasks/build_image.yml122
-rw-r--r--roles/qemu/tasks/load_modules.yml2
-rw-r--r--roles/qemu/tasks/main.yml6
-rw-r--r--roles/qemu/tasks/release.yml6
-rw-r--r--roles/qemu/tasks/setup_iso.yml57
-rw-r--r--roles/qemu/tasks/unmount.yml66
-rw-r--r--roles/qemu/templates/boot/grub/device.map.j21
-rw-r--r--roles/qemu/templates/boot/grub/grub.cfg.j27
-rw-r--r--roles/qemu/vars/main.yml2
-rw-r--r--roles/release/tasks/main.yml6
-rw-r--r--roles/release/tests/inventory2
-rw-r--r--roles/release/tests/test.yml4
-rw-r--r--roles/setup-root-partition/tasks/main.yml27
-rw-r--r--roles/setup-root-partition/tests/inventory2
-rw-r--r--roles/setup-root-partition/tests/test.yml5
-rw-r--r--roles/unmount-all/tasks/main.yml75
-rw-r--r--roles/unmount-all/tests/inventory2
-rw-r--r--roles/unmount-all/tests/test.yml4
-rw-r--r--roles/vagrant-libvirt-box/files/Vagrantfile (renamed from roles/vagrant-libvirt/files/Vagrantfile)0
-rw-r--r--roles/vagrant-libvirt-box/files/metadata.json (renamed from roles/vagrant-libvirt/files/metadata.json)0
-rw-r--r--roles/vagrant-libvirt-box/tasks/main.yml (renamed from roles/vagrant-libvirt/tasks/convert.yml)0
-rw-r--r--roles/vagrant-libvirt-box/tests/inventory2
-rw-r--r--roles/vagrant-libvirt-box/tests/test.yml4
-rw-r--r--roles/vagrant-libvirt-box/vars/main.yml (renamed from roles/vagrant-libvirt/vars/main.yml)2
-rw-r--r--roles/vagrant-libvirt/files/config.boot41
-rw-r--r--roles/vagrant-libvirt/files/persistence.conf1
-rw-r--r--roles/vagrant-libvirt/tasks/build_image.yml122
-rw-r--r--roles/vagrant-libvirt/tasks/load_modules.yml2
-rw-r--r--roles/vagrant-libvirt/tasks/main.yml6
-rw-r--r--roles/vagrant-libvirt/tasks/release.yml27
-rw-r--r--roles/vagrant-libvirt/tasks/setup_iso.yml57
-rw-r--r--roles/vagrant-libvirt/tasks/unmount.yml66
-rw-r--r--roles/vagrant-libvirt/templates/boot/grub/device.map.j21
-rw-r--r--roles/vagrant-libvirt/templates/boot/grub/grub.cfg.j27
-rw-r--r--roles/vmware-ova/tasks/main.yml (renamed from roles/vmware/tasks/convert.yml)0
-rw-r--r--roles/vmware-ova/templates/vyos_vmware_image.ovf.j2 (renamed from roles/vmware/templates/vyos_vmware_image.ovf.j2)5
-rw-r--r--roles/vmware-ova/tests/inventory2
-rw-r--r--roles/vmware-ova/tests/test.yml4
-rw-r--r--roles/vmware-ova/vars/main.yml (renamed from roles/vmware/vars/main.yml)1
-rw-r--r--roles/vmware/files/config.boot41
-rw-r--r--roles/vmware/files/persistence.conf1
-rw-r--r--roles/vmware/tasks/build_image.yml122
-rw-r--r--roles/vmware/tasks/install_open_vmdk.yml12
-rw-r--r--roles/vmware/tasks/load_modules.yml2
-rw-r--r--roles/vmware/tasks/main.yml7
-rw-r--r--roles/vmware/tasks/release.yml6
-rw-r--r--roles/vmware/tasks/setup_iso.yml57
-rw-r--r--roles/vmware/tasks/unmount.yml66
-rw-r--r--roles/vmware/templates/boot/grub/device.map.j21
-rw-r--r--roles/vmware/templates/boot/grub/grub.cfg.j27
-rw-r--r--vagrant-libvirt.yml23
-rw-r--r--vmware.yml27
115 files changed, 517 insertions, 1269 deletions
diff --git a/.gitignore b/.gitignore
index 8d39285..71edcaf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
# Ansible
*.retry
+*.log
# images
*.img
diff --git a/group_vars/all.yml b/group_vars/all.yml
index 83f730f..67bb89d 100644
--- a/group_vars/all.yml
+++ b/group_vars/all.yml
@@ -1,16 +1,19 @@
ansible_host_key_checking: False
-vyos_iso_url: "{{ iso }}"
+vyos_iso_url: ""
vyos_iso_local: /tmp/vyos.iso
vyos_key_url: http://packages.vyos.net/vyos-release.gpg
vyos_key_local: /tmp/vyos-release.gpg
-CD_ROOT: /mnt/cdrom
-CD_SQUASH_ROOT: /mnt/cdsquash
-SQUASHFS_IMAGE: "{{ CD_ROOT }}/live/filesystem.squashfs"
+vyos_cd_root: /mnt/cdrom
+vyos_cd_squash_root: /mnt/cdsquash
+vyos_squashfs_image: "{{ vyos_cd_root }}/live/filesystem.squashfs"
+vyos_write_root: /mnt/wroot
+vyos_read_root: /mnt/squashfs
+vyos_install_root: /mnt/inst_root
-ROOT_FSTYPE: ext4
+vyos_disk_size: 1
+vyos_root_fstype: ext4
-WRITE_ROOT: /mnt/wroot
-READ_ROOT: /mnt/squashfs
-INSTALL_ROOT: /mnt/inst_root
+vyos_target_drive: ""
+vyos_raw_img: /tmp/vyos_raw_image.img
diff --git a/hyperv.yml b/hyperv.yml
index e036322..46b5c0a 100644
--- a/hyperv.yml
+++ b/hyperv.yml
@@ -3,6 +3,25 @@
become: True
gather_facts: False
connection: local
+ vars:
+ vyos_platform: Hyper-V
+ vyos_format: vhd
+ vyos_hyperv_img: /tmp/vyos_hyperv_image.vhd
+ vyos_output_img: "{{ vyos_hyperv_img }}"
roles:
- - common
- - hyperv
+ - install-packages
+ - load-modules
+ - download-iso
+ - mount-iso
+ - get-version
+ - create-disk
+ - attach-loop-device
+ - setup-root-partition
+ - install-image
+ - mount-root-fs
+ - install-config
+ - install-grub
+ - install-persistence-conf
+ - unmount-all
+ - hyperv-vhd
+ - release
diff --git a/qemu.yml b/qemu.yml
index 59d067d..899a47a 100644
--- a/qemu.yml
+++ b/qemu.yml
@@ -1,8 +1,26 @@
---
- hosts: qemu
- become: True
- gather_facts: False
+ gather_facts: false
connection: local
+ vars:
+ vyos_platform: QEMU
+ vyos_format: qcow2
+ vyos_qemu_img: /tmp/vyos_qemu_image.qcow2
+ vyos_output_img: "{{ vyos_qemu_img }}"
roles:
- - common
- - qemu
+ - install-packages
+ - load-modules
+ - download-iso
+ - mount-iso
+ - get-version
+ - create-disk
+ - attach-loop-device
+ - setup-root-partition
+ - install-image
+ - mount-root-fs
+ - install-config
+ - install-grub
+ - install-persistence-conf
+ - unmount-all
+ - qemu-qcow2
+ - release
diff --git a/roles/attach-loop-device/tasks/main.yml b/roles/attach-loop-device/tasks/main.yml
new file mode 100644
index 0000000..8815910
--- /dev/null
+++ b/roles/attach-loop-device/tasks/main.yml
@@ -0,0 +1,12 @@
+- name: Find the first unused loop device.
+ become: true
+ shell: losetup -f
+ register: result
+
+- name: Set up a loop device.
+ become: true
+ command: "losetup {{ result.stdout }} {{ vyos_raw_img }}"
+
+- name: Set vyos_target_drive.
+ set_fact:
+ vyos_target_drive: "{{ result.stdout }}"
diff --git a/roles/attach-loop-device/tests/inventory b/roles/attach-loop-device/tests/inventory
new file mode 100644
index 0000000..878877b
--- /dev/null
+++ b/roles/attach-loop-device/tests/inventory
@@ -0,0 +1,2 @@
+localhost
+
diff --git a/roles/attach-loop-device/tests/test.yml b/roles/attach-loop-device/tests/test.yml
new file mode 100644
index 0000000..2864e74
--- /dev/null
+++ b/roles/attach-loop-device/tests/test.yml
@@ -0,0 +1,4 @@
+---
+- hosts: localhost
+ roles:
+ - attach-loop-device
diff --git a/roles/common/tasks/get_latest_iso.yml b/roles/common/tasks/get_latest_iso.yml
deleted file mode 100644
index 82d07f8..0000000
--- a/roles/common/tasks/get_latest_iso.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-- name: get latest_iso if iso is not defined
- latest_iso:
- when: iso is not defined
- register: latest_iso
-
-- name: set latest_iso as vyos_iso_url
- set_fact:
- vyos_iso_url: "{{ latest_iso.latest_iso }}"
- when: latest_iso is defined
diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml
deleted file mode 100644
index f3f1395..0000000
--- a/roles/common/tasks/main.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-- include_tasks: install_packages.yml
-- include_tasks: get_latest_iso.yml
diff --git a/roles/create-disk/tasks/main.yml b/roles/create-disk/tasks/main.yml
new file mode 100644
index 0000000..8089870
--- /dev/null
+++ b/roles/create-disk/tasks/main.yml
@@ -0,0 +1,2 @@
+- name: Create the target disk image
+ command: qemu-img create -f raw "{{ vyos_raw_img }}" "{{ vyos_disk_size }}"G
diff --git a/roles/create-disk/tests/inventory b/roles/create-disk/tests/inventory
new file mode 100644
index 0000000..878877b
--- /dev/null
+++ b/roles/create-disk/tests/inventory
@@ -0,0 +1,2 @@
+localhost
+
diff --git a/roles/create-disk/tests/test.yml b/roles/create-disk/tests/test.yml
new file mode 100644
index 0000000..754fc63
--- /dev/null
+++ b/roles/create-disk/tests/test.yml
@@ -0,0 +1,4 @@
+---
+- hosts: localhost
+ roles:
+ - create-disk
diff --git a/library/latest_iso.py b/roles/download-iso/library/latest_iso.py
index b55ea98..b55ea98 100755
--- a/library/latest_iso.py
+++ b/roles/download-iso/library/latest_iso.py
diff --git a/roles/download-iso/tasks/main.yml b/roles/download-iso/tasks/main.yml
new file mode 100644
index 0000000..dc71771
--- /dev/null
+++ b/roles/download-iso/tasks/main.yml
@@ -0,0 +1,38 @@
+- name: get latest_iso if iso is not defined
+ latest_iso:
+ when: vyos_iso_url == ""
+ register: latest_iso_result
+
+- name: set latest_iso as vyos_iso_url
+ set_fact:
+ vyos_iso_url: "{{ latest_iso_result.latest_iso }}"
+ when: latest_iso_result is defined
+
+- name: Fetch VyOS ISO GPG signature
+ uri:
+ url: "{{ vyos_iso_url }}.asc"
+ dest: "{{ vyos_iso_local }}.asc"
+ status_code: 200,404,403
+ tags: verify
+ register: gpg_uri
+
+- name: Download VyOS ISO release
+ get_url:
+ url: "{{ vyos_iso_url }}"
+ dest: "{{ vyos_iso_local }}"
+
+- name: Fetch the VyOS release GPG key
+ get_url:
+ url: "{{ vyos_key_url}}"
+ dest: "{{ vyos_key_local }}"
+ tags: verify
+
+- name: Install the VyOS release GPG key
+ command: gpg --import {{ vyos_key_local }}
+ when: gpg_uri.status == 200
+ tags: verify
+
+- name: Validate ISO GPG signature
+ command: gpg --verify {{ vyos_iso_local }}.asc {{ vyos_iso_local }}
+ when: gpg_uri.status == 200
+ tags: verify
diff --git a/roles/download-iso/tests/inventory b/roles/download-iso/tests/inventory
new file mode 100644
index 0000000..878877b
--- /dev/null
+++ b/roles/download-iso/tests/inventory
@@ -0,0 +1,2 @@
+localhost
+
diff --git a/roles/download-iso/tests/test.yml b/roles/download-iso/tests/test.yml
new file mode 100644
index 0000000..9de4d5c
--- /dev/null
+++ b/roles/download-iso/tests/test.yml
@@ -0,0 +1,4 @@
+---
+- hosts: localhost
+ roles:
+ - download-iso
diff --git a/roles/get-version/tasks/main.yml b/roles/get-version/tasks/main.yml
new file mode 100644
index 0000000..f5dc1fc
--- /dev/null
+++ b/roles/get-version/tasks/main.yml
@@ -0,0 +1,10 @@
+- name: Read version string from iso packages
+ shell: cat {{ vyos_cd_squash_root }}/opt/vyatta/etc/version | awk '{print $2}' | tr + -
+ register: result
+
+- name: Set vyos_version
+ set_fact:
+ vyos_version: "{{ result.stdout }}"
+
+- name: Debug version string as read from ISO
+ debug: msg="This is version {{ vyos_version }}"
diff --git a/roles/get-version/tests/inventory b/roles/get-version/tests/inventory
new file mode 100644
index 0000000..878877b
--- /dev/null
+++ b/roles/get-version/tests/inventory
@@ -0,0 +1,2 @@
+localhost
+
diff --git a/roles/get-version/tests/test.yml b/roles/get-version/tests/test.yml
new file mode 100644
index 0000000..c1f63d8
--- /dev/null
+++ b/roles/get-version/tests/test.yml
@@ -0,0 +1,4 @@
+---
+- hosts: localhost
+ roles:
+ - get-version
diff --git a/roles/hyperv/tasks/convert.yml b/roles/hyperv-vhd/tasks/main.yml
index 7d118f7..7d118f7 100644
--- a/roles/hyperv/tasks/convert.yml
+++ b/roles/hyperv-vhd/tasks/main.yml
diff --git a/roles/hyperv-vhd/tests/inventory b/roles/hyperv-vhd/tests/inventory
new file mode 100644
index 0000000..878877b
--- /dev/null
+++ b/roles/hyperv-vhd/tests/inventory
@@ -0,0 +1,2 @@
+localhost
+
diff --git a/roles/hyperv-vhd/tests/test.yml b/roles/hyperv-vhd/tests/test.yml
new file mode 100644
index 0000000..2c483dc
--- /dev/null
+++ b/roles/hyperv-vhd/tests/test.yml
@@ -0,0 +1,4 @@
+---
+- hosts: localhost
+ roles:
+ - hyperv-vhd
diff --git a/roles/hyperv/tasks/build_image.yml b/roles/hyperv/tasks/build_image.yml
deleted file mode 100644
index 135d8de..0000000
--- a/roles/hyperv/tasks/build_image.yml
+++ /dev/null
@@ -1,122 +0,0 @@
-- name: Create the target disk image
- command: qemu-img create -f raw "{{ vyos_raw_img }}" 1G
-
-- name: Find loopback
- shell: losetup -f
- register: loopback
-
-- name: Loopback attach
- command: "losetup {{ loopback.stdout }} {{ vyos_raw_img }}"
-
-- name: Partition the target drive
- parted:
- device: "{{ loopback.stdout }}"
- state: present
- label: msdos
- number: 1
- part_type: primary
- part_start: 0%
- part_end: 100%
- align: optimal
- flags: [boot]
-
-- name: Create a filesystem on root partition
- filesystem:
- fstype: "{{ ROOT_FSTYPE }}"
- device: "{{ loopback.stdout }}"
- opts: "-L persistence"
-
-- name: Mount root partition
- mount:
- name: "{{ WRITE_ROOT }}"
- src: "{{ loopback.stdout }}"
- fstype: "{{ ROOT_FSTYPE }}"
- state: mounted
-
-# ---- Install image from ISO ----
-- name: Create {{ WRITE_ROOT }} directories
- file:
- path: "{{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/rw"
- state: directory
- register: RW_DIR
-
-- name: Create the work directory
- file:
- path: "{{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/work/work"
- state: directory
-
-- name: Copy squashfs image from ISO to root partition
- command: cp -p {{ SQUASHFS_IMAGE }} {{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/{{ version_string.stdout }}.squashfs
- args:
- creates: "{{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/{{ version_string.stdout }}.squashfs"
-
-- name: Copy boot files (kernel and initrd images) from ISO to root partition
- shell: find {{ CD_SQUASH_ROOT }}/boot -maxdepth 1 \( -type f -o -type l \) -print -exec cp -dp {} {{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/ \;
- args:
- creates: "{{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/vmlinuz"
-
-- name: Mount squashfs image from root partition
- mount:
- name: "{{ READ_ROOT }}"
- src: "{{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/{{ version_string.stdout }}.squashfs"
- fstype: squashfs
- opts: loop,ro
- state: mounted
-
-- name: Set up union root for post installation tasks
- mount:
- name: "{{ INSTALL_ROOT }}"
- src: none
- fstype: aufs
- opts: "noatime,dirs={{ RW_DIR.path }}=rw:{{ READ_ROOT }}=rr"
- state: mounted
-
-# ---- Post image installation tasks ----
-
-## ---- VyOS configuration ----
-- name: Make sure that config partition marker exists
- file:
- path: "{{ INSTALL_ROOT }}/opt/vyatta/etc/config/.vyatta_config"
- state: touch
-
-- name: Copy the default config for QEMU to the installed image
- copy:
- src: files/config.boot
- dest: "{{ INSTALL_ROOT }}/opt/vyatta/etc/config/config.boot"
- mode: 0755
-
-## ---- Install GRUB boot loader ----
-- name: Create GRUB directory
- file:
- path: "{{ WRITE_ROOT }}/boot/grub"
- state: directory
-
-# It is necessary to mount and bind /dev, /proc, /sys and /boot in order to execute grub-install
-# and install GRUB correctly within the {{ volume_drive }} using chroot
-
-# XXX: ansible mount module requires fstype so it cannot be used for binding an already
-# mounted location, we get to use mount directly at least for /boot
-- name: Mount and bind /dev /proc /sys and {{ WRITE_ROOT }}/boot to {{ INSTALL_ROOT }}
- shell: mount --bind /dev {{ INSTALL_ROOT }}/dev &&
- mount --bind /proc {{ INSTALL_ROOT }}/proc &&
- mount --bind /sys {{ INSTALL_ROOT }}/sys &&
- mount --bind {{ WRITE_ROOT }} {{ INSTALL_ROOT }}/boot
- args:
- warn: no
-
-- name: Install GRUB in the boot sector of {{ loopback.stdout }}
- command: chroot {{ INSTALL_ROOT }} grub-install --no-floppy --root-directory=/boot {{ loopback.stdout }} --force
- args:
- creates: "{{ INSTALL_ROOT }}/boot/grub/grubenv"
-
-- name: Configure GRUB
- template:
- src: templates/boot/grub/grub.cfg.j2
- dest: "{{ WRITE_ROOT }}/boot/grub/grub.cfg"
- mode: 0644
-
-- name: Create the persistence config
- copy:
- src: files/persistence.conf
- dest: "{{ WRITE_ROOT }}/persistence.conf"
- mode: 0644
diff --git a/roles/hyperv/tasks/load_modules.yml b/roles/hyperv/tasks/load_modules.yml
deleted file mode 100644
index 44295fe..0000000
--- a/roles/hyperv/tasks/load_modules.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-- name: Load aufs module
- shell: modprobe aufs
diff --git a/roles/hyperv/tasks/main.yml b/roles/hyperv/tasks/main.yml
deleted file mode 100644
index c2a1b28..0000000
--- a/roles/hyperv/tasks/main.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-- include_tasks: load_modules.yml
-- include_tasks: setup_iso.yml
-- include_tasks: build_image.yml
-- include_tasks: unmount.yml
-- include_tasks: convert.yml
-- include_tasks: release.yml
diff --git a/roles/hyperv/tasks/release.yml b/roles/hyperv/tasks/release.yml
deleted file mode 100644
index 4ad34c6..0000000
--- a/roles/hyperv/tasks/release.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-- name: Release image
- become: false
- copy:
- src: "{{ vyos_hyperv_img }}"
- dest: "{{ vyos_images_dir }}/vyos-{{ version_string.stdout }}-hyperv.vhd"
- when: vyos_images_dir is defined
diff --git a/roles/hyperv/tasks/setup_iso.yml b/roles/hyperv/tasks/setup_iso.yml
deleted file mode 100644
index 18f1f5e..0000000
--- a/roles/hyperv/tasks/setup_iso.yml
+++ /dev/null
@@ -1,57 +0,0 @@
-- name: Fetch VyOS ISO GPG signature
- uri:
- url: "{{ vyos_iso_url }}.asc"
- dest: "{{ vyos_iso_local }}.asc"
- status_code: 200,404,403
- tags: verify
- register: gpg_uri
-
-- name: Download VyOS ISO release
- get_url:
- url: "{{ vyos_iso_url }}"
- dest: "{{ vyos_iso_local }}"
-
-- name: Fetch the VyOS release GPG key
- get_url:
- url: "{{ vyos_key_url}}"
- dest: "{{ vyos_key_local }}"
- tags: verify
-
-- name: Install the VyOS release GPG key
- command: gpg --import {{ vyos_key_local }}
- when: gpg_uri.status == 200
- tags: verify
-
-- name: Validate ISO GPG signature
- command: gpg --verify {{ vyos_iso_local }}.asc {{ vyos_iso_local }}
- when: gpg_uri.status == 200
- tags: verify
-
-- name: Mount ISO
- mount:
- name: "{{ CD_ROOT }}"
- src: "{{ vyos_iso_local }}"
- fstype: iso9660
- opts: loop,ro
- state: mounted
-
-- name: Verify checksums of all the files in the ISO image
- command: md5sum -c md5sum.txt
- args:
- chdir: "{{ CD_ROOT }}"
- changed_when: False
-
-- name: Mount squashfs image from ISO
- mount:
- name: "{{ CD_SQUASH_ROOT }}"
- src: "{{ SQUASHFS_IMAGE }}"
- fstype: squashfs
- opts: loop,ro
- state: mounted
-
-- name: Read version string from iso packages
- shell: cat {{ CD_SQUASH_ROOT }}/opt/vyatta/etc/version | awk '{print $2}' | tr + -
- register: version_string
-
-- name: Debug version string as read from ISO
- debug: msg="This is version {{ version_string.stdout }}"
diff --git a/roles/hyperv/tasks/unmount.yml b/roles/hyperv/tasks/unmount.yml
deleted file mode 100644
index 39c3d52..0000000
--- a/roles/hyperv/tasks/unmount.yml
+++ /dev/null
@@ -1,66 +0,0 @@
-# Unmount all mounts
-# If remove unmounted before absent, cannot unmount INSTALL_ROOT...
-- name: Unmount {{ INSTALL_ROOT }}/boot
- mount:
- name: "{{ INSTALL_ROOT }}/boot"
- src: "{{ WRITE_ROOT }}"
- fstype: none
- state: unmounted
-
-- name: Unmount {{ INSTALL_ROOT }}/boot
- mount:
- name: "{{ INSTALL_ROOT }}/boot"
- src: "{{ WRITE_ROOT }}"
- fstype: none
- state: absent
-
-- name: Unmount {{ INSTALL_ROOT }}/sys, {{ INSTALL_ROOT }}/proc, {{ INSTALL_ROOT }}/dev
- mount:
- name: "{{ INSTALL_ROOT }}/{{ item }}"
- src: "/{{ item }}"
- fstype: none
- state: unmounted
- with_items: [ 'sys', 'proc', 'dev' ]
-
-- name: Unmount {{ INSTALL_ROOT }}/sys, {{ INSTALL_ROOT }}/proc, {{ INSTALL_ROOT }}/dev
- mount:
- name: "{{ INSTALL_ROOT }}/{{ item }}"
- src: "/{{ item }}"
- fstype: none
- state: absent
- with_items: [ 'sys', 'proc', 'dev' ]
-
-- name: Unmount {{ INSTALL_ROOT }}
- mount:
- name: "{{ INSTALL_ROOT }}"
- src: overlayfs
- fstype: overlayfs
- state: absent
-
-- name: Unmount {{ READ_ROOT }}
- mount:
- name: "{{ READ_ROOT }}"
- src: "{{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/{{ version_string.stdout }}.squashfs"
- fstype: squashfs
- state: absent
-
-- name: Unmount {{ WRITE_ROOT }}
- mount:
- name: "{{ WRITE_ROOT }}"
- src: "{{ loopback.stdout }}"
- fstype: "{{ ROOT_FSTYPE }}"
- state: absent
-
-- name: Unmount {{ CD_SQUASH_ROOT }}
- mount:
- name: "{{ CD_SQUASH_ROOT }}"
- src: "{{ SQUASHFS_IMAGE }}"
- fstype: squashfs
- state: absent
-
-- name: Unmount {{ CD_ROOT }}
- mount:
- name: "{{ CD_ROOT }}"
- src: "{{ vyos_iso_local }}"
- fstype: iso9660
- state: absent
diff --git a/roles/hyperv/templates/boot/grub/grub.cfg.j2 b/roles/hyperv/templates/boot/grub/grub.cfg.j2
deleted file mode 100644
index 49b9bf3..0000000
--- a/roles/hyperv/templates/boot/grub/grub.cfg.j2
+++ /dev/null
@@ -1,7 +0,0 @@
-set default=0
-set timeout=0
-
-menuentry "VyOS Hyper-V Image {{ version_string.stdout }}" {
- linux /boot/{{ version_string.stdout }}/vmlinuz boot=live selinux=0 vyos-union=/boot/{{ version_string.stdout }} console=tty1
- initrd /boot/{{ version_string.stdout }}/initrd.img
-}
diff --git a/roles/hyperv/vars/main.yml b/roles/hyperv/vars/main.yml
deleted file mode 100644
index a1e1bae..0000000
--- a/roles/hyperv/vars/main.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-vyos_raw_img: /tmp/vyos_raw_image.img
-vyos_hyperv_img: /tmp/vyos_hyperv_image.vhd
diff --git a/roles/hyperv/files/config.boot b/roles/install-config/files/config.boot
index f1ec4f5..f1ec4f5 100644
--- a/roles/hyperv/files/config.boot
+++ b/roles/install-config/files/config.boot
diff --git a/roles/install-config/tasks/main.yml b/roles/install-config/tasks/main.yml
new file mode 100644
index 0000000..4447f87
--- /dev/null
+++ b/roles/install-config/tasks/main.yml
@@ -0,0 +1,12 @@
+- name: Make sure that config partition marker exists
+ become: true
+ file:
+ path: "{{ vyos_install_root }}/opt/vyatta/etc/config/.vyatta_config"
+ state: touch
+
+- name: Copy the default config for QEMU to the installed image
+ become: true
+ copy:
+ src: files/config.boot
+ dest: "{{ vyos_install_root }}/opt/vyatta/etc/config/config.boot"
+ mode: 0755
diff --git a/roles/install-config/tests/inventory b/roles/install-config/tests/inventory
new file mode 100644
index 0000000..878877b
--- /dev/null
+++ b/roles/install-config/tests/inventory
@@ -0,0 +1,2 @@
+localhost
+
diff --git a/roles/install-config/tests/test.yml b/roles/install-config/tests/test.yml
new file mode 100644
index 0000000..c0b6814
--- /dev/null
+++ b/roles/install-config/tests/test.yml
@@ -0,0 +1,4 @@
+---
+- hosts: localhost
+ roles:
+ - install-config
diff --git a/roles/install-grub/tasks/main.yml b/roles/install-grub/tasks/main.yml
new file mode 100644
index 0000000..2a20271
--- /dev/null
+++ b/roles/install-grub/tasks/main.yml
@@ -0,0 +1,32 @@
+- name: Create GRUB directory
+ become: true
+ file:
+ path: "{{ vyos_write_root }}/boot/grub"
+ state: directory
+
+# It is necessary to mount and bind /dev, /proc, /sys and /boot in order to execute grub-install
+# and install GRUB correctly within the {{ volume_drive }} using chroot
+
+# XXX: ansible mount module requires fstype so it cannot be used for binding an already
+# mounted location, we get to use mount directly at least for /boot
+- name: Mount and bind /dev /proc /sys and {{ vyos_write_root }}/boot to {{ vyos_install_root }}
+ become: true
+ shell: mount --bind /dev {{ vyos_install_root }}/dev &&
+ mount --bind /proc {{ vyos_install_root }}/proc &&
+ mount --bind /sys {{ vyos_install_root }}/sys &&
+ mount --bind {{ vyos_write_root }} {{ vyos_install_root }}/boot
+ args:
+ warn: no
+
+- name: Install GRUB in the boot sector of {{ vyos_target_drive }}
+ become: true
+ command: chroot {{ vyos_install_root }} grub-install --no-floppy --root-directory=/boot {{ vyos_target_drive }} --force
+ args:
+ creates: "{{ vyos_install_root }}/boot/grub/grubenv"
+
+- name: Configure GRUB
+ become: true
+ template:
+ src: templates/boot/grub/grub.cfg.j2
+ dest: "{{ vyos_write_root }}/boot/grub/grub.cfg"
+ mode: 0644
diff --git a/roles/hyperv/templates/boot/grub/device.map.j2 b/roles/install-grub/templates/boot/grub/device.map.j2
index e14205e..e14205e 100644
--- a/roles/hyperv/templates/boot/grub/device.map.j2
+++ b/roles/install-grub/templates/boot/grub/device.map.j2
diff --git a/roles/install-grub/templates/boot/grub/grub.cfg.j2 b/roles/install-grub/templates/boot/grub/grub.cfg.j2
new file mode 100644
index 0000000..45f48ab
--- /dev/null
+++ b/roles/install-grub/templates/boot/grub/grub.cfg.j2
@@ -0,0 +1,7 @@
+set default=0
+set timeout=0
+
+menuentry "VyOS {{ vyos_platform }} Image {{ vyos_version }}" {
+ linux /boot/{{ vyos_version }}/vmlinuz boot=live selinux=0 vyos-union=/boot/{{ vyos_version }} console=tty1
+ initrd /boot/{{ vyos_version }}/initrd.img
+}
diff --git a/roles/install-grub/tests/inventory b/roles/install-grub/tests/inventory
new file mode 100644
index 0000000..878877b
--- /dev/null
+++ b/roles/install-grub/tests/inventory
@@ -0,0 +1,2 @@
+localhost
+
diff --git a/roles/install-grub/tests/test.yml b/roles/install-grub/tests/test.yml
new file mode 100644
index 0000000..87330dd
--- /dev/null
+++ b/roles/install-grub/tests/test.yml
@@ -0,0 +1,4 @@
+---
+- hosts: localhost
+ roles:
+ - install-grub
diff --git a/roles/install-image/tasks/main.yml b/roles/install-image/tasks/main.yml
new file mode 100644
index 0000000..ee99705
--- /dev/null
+++ b/roles/install-image/tasks/main.yml
@@ -0,0 +1,24 @@
+- name: Create {{ vyos_write_root }} directories
+ become: true
+ file:
+ path: "{{ vyos_write_root }}/boot/{{ vyos_version }}/rw"
+ state: directory
+ register: vyos_rw_dir
+
+- name: Create the work directory
+ become: true
+ file:
+ path: "{{ vyos_write_root }}/boot/{{ vyos_version }}/work/work"
+ state: directory
+
+- name: Copy squashfs image from ISO to root partition
+ become: true
+ command: cp -p {{ vyos_squashfs_image }} {{ vyos_write_root }}/boot/{{ vyos_version }}/{{ vyos_version }}.squashfs
+ args:
+ creates: "{{ vyos_write_root }}/boot/{{ vyos_version }}/{{ vyos_version }}.squashfs"
+
+- name: Copy boot files (kernel and initrd images) from ISO to root partition
+ become: true
+ shell: find {{ vyos_cd_squash_root }}/boot -maxdepth 1 \( -type f -o -type l \) -print -exec cp -dp {} {{ vyos_write_root }}/boot/{{ vyos_version }}/ \;
+ args:
+ creates: "{{ vyos_write_root }}/boot/{{ vyos_version }}/vmlinuz"
diff --git a/roles/install-image/tests/inventory b/roles/install-image/tests/inventory
new file mode 100644
index 0000000..878877b
--- /dev/null
+++ b/roles/install-image/tests/inventory
@@ -0,0 +1,2 @@
+localhost
+
diff --git a/roles/install-image/tests/test.yml b/roles/install-image/tests/test.yml
new file mode 100644
index 0000000..96c69cb
--- /dev/null
+++ b/roles/install-image/tests/test.yml
@@ -0,0 +1,4 @@
+---
+- hosts: localhost
+ roles:
+ - install-image
diff --git a/roles/common/tasks/install_packages.yml b/roles/install-packages/tasks/main.yml
index c5a2dbe..ffb0bbf 100644
--- a/roles/common/tasks/install_packages.yml
+++ b/roles/install-packages/tasks/main.yml
@@ -1,7 +1,7 @@
- name: Install required packages
- become: yes
+ become: true
apt:
- update_cache: yes
+ update_cache: true
name:
- parted
- e2fsprogs
diff --git a/roles/install-packages/tests/inventory b/roles/install-packages/tests/inventory
new file mode 100644
index 0000000..878877b
--- /dev/null
+++ b/roles/install-packages/tests/inventory
@@ -0,0 +1,2 @@
+localhost
+
diff --git a/roles/install-packages/tests/test.yml b/roles/install-packages/tests/test.yml
new file mode 100644
index 0000000..4160f6c
--- /dev/null
+++ b/roles/install-packages/tests/test.yml
@@ -0,0 +1,5 @@
+---
+- hosts: localhost
+ remote_user: root
+ roles:
+ - install-packages \ No newline at end of file
diff --git a/roles/hyperv/files/persistence.conf b/roles/install-persistence-conf/files/persistence.conf
index f500aef..f500aef 100644
--- a/roles/hyperv/files/persistence.conf
+++ b/roles/install-persistence-conf/files/persistence.conf
diff --git a/roles/install-persistence-conf/tasks/main.yml b/roles/install-persistence-conf/tasks/main.yml
new file mode 100644
index 0000000..3cb266b
--- /dev/null
+++ b/roles/install-persistence-conf/tasks/main.yml
@@ -0,0 +1,6 @@
+- name: Create the persistence config
+ become: true
+ copy:
+ src: files/persistence.conf
+ dest: "{{ vyos_write_root }}/persistence.conf"
+ mode: 0644
diff --git a/roles/install-persistence-conf/tests/inventory b/roles/install-persistence-conf/tests/inventory
new file mode 100644
index 0000000..878877b
--- /dev/null
+++ b/roles/install-persistence-conf/tests/inventory
@@ -0,0 +1,2 @@
+localhost
+
diff --git a/roles/install-persistence-conf/tests/test.yml b/roles/install-persistence-conf/tests/test.yml
new file mode 100644
index 0000000..7bb82d0
--- /dev/null
+++ b/roles/install-persistence-conf/tests/test.yml
@@ -0,0 +1,4 @@
+---
+- hosts: localhost
+ roles:
+ - install-persistence-conf
diff --git a/roles/load-modules/tasks/main.yml b/roles/load-modules/tasks/main.yml
new file mode 100644
index 0000000..c0d93cc
--- /dev/null
+++ b/roles/load-modules/tasks/main.yml
@@ -0,0 +1,5 @@
+- name: modprobe aufs
+ become: true
+ modprobe:
+ name: aufs
+ state: present
diff --git a/roles/load-modules/tests/inventory b/roles/load-modules/tests/inventory
new file mode 100644
index 0000000..878877b
--- /dev/null
+++ b/roles/load-modules/tests/inventory
@@ -0,0 +1,2 @@
+localhost
+
diff --git a/roles/load-modules/tests/test.yml b/roles/load-modules/tests/test.yml
new file mode 100644
index 0000000..13fbf1f
--- /dev/null
+++ b/roles/load-modules/tests/test.yml
@@ -0,0 +1,4 @@
+---
+- hosts: localhost
+ roles:
+ - load-modules
diff --git a/roles/mount-iso/tasks/main.yml b/roles/mount-iso/tasks/main.yml
new file mode 100644
index 0000000..6e6b09d
--- /dev/null
+++ b/roles/mount-iso/tasks/main.yml
@@ -0,0 +1,23 @@
+- name: Mount ISO
+ become: true
+ mount:
+ name: "{{ vyos_cd_root }}"
+ src: "{{ vyos_iso_local }}"
+ fstype: iso9660
+ opts: loop,ro
+ state: mounted
+
+- name: Verify checksums of all the files in the ISO image
+ command: md5sum -c md5sum.txt
+ args:
+ chdir: "{{ vyos_cd_root }}"
+ changed_when: False
+
+- name: Mount squashfs image from ISO
+ become: true
+ mount:
+ name: "{{ vyos_cd_squash_root }}"
+ src: "{{ vyos_squashfs_image }}"
+ fstype: squashfs
+ opts: loop,ro
+ state: mounted
diff --git a/roles/mount-iso/tests/inventory b/roles/mount-iso/tests/inventory
new file mode 100644
index 0000000..878877b
--- /dev/null
+++ b/roles/mount-iso/tests/inventory
@@ -0,0 +1,2 @@
+localhost
+
diff --git a/roles/mount-iso/tests/test.yml b/roles/mount-iso/tests/test.yml
new file mode 100644
index 0000000..987ef49
--- /dev/null
+++ b/roles/mount-iso/tests/test.yml
@@ -0,0 +1,4 @@
+---
+- hosts: localhost
+ roles:
+ - mount-iso
diff --git a/roles/mount-root-fs/tasks/main.yml b/roles/mount-root-fs/tasks/main.yml
new file mode 100644
index 0000000..67d036d
--- /dev/null
+++ b/roles/mount-root-fs/tasks/main.yml
@@ -0,0 +1,17 @@
+- name: Mount squashfs image from root partition
+ become: true
+ mount:
+ name: "{{ vyos_read_root }}"
+ src: "{{ vyos_write_root }}/boot/{{ vyos_version }}/{{ vyos_version }}.squashfs"
+ fstype: squashfs
+ opts: loop,ro
+ state: mounted
+
+- name: Set up union root for post installation tasks
+ become: true
+ mount:
+ name: "{{ vyos_install_root }}"
+ src: none
+ fstype: aufs
+ opts: "noatime,dirs={{ vyos_write_root }}/boot/{{ vyos_version }}/rw=rw:{{ vyos_read_root }}=rr"
+ state: mounted
diff --git a/roles/mount-root-fs/tests/inventory b/roles/mount-root-fs/tests/inventory
new file mode 100644
index 0000000..878877b
--- /dev/null
+++ b/roles/mount-root-fs/tests/inventory
@@ -0,0 +1,2 @@
+localhost
+
diff --git a/roles/mount-root-fs/tests/test.yml b/roles/mount-root-fs/tests/test.yml
new file mode 100644
index 0000000..caa3777
--- /dev/null
+++ b/roles/mount-root-fs/tests/test.yml
@@ -0,0 +1,4 @@
+---
+- hosts: localhost
+ roles:
+ - mount-root-fs
diff --git a/roles/qemu/tasks/convert.yml b/roles/qemu-qcow2/tasks/main.yml
index c91c75b..c91c75b 100644
--- a/roles/qemu/tasks/convert.yml
+++ b/roles/qemu-qcow2/tasks/main.yml
diff --git a/roles/qemu-qcow2/tests/inventory b/roles/qemu-qcow2/tests/inventory
new file mode 100644
index 0000000..878877b
--- /dev/null
+++ b/roles/qemu-qcow2/tests/inventory
@@ -0,0 +1,2 @@
+localhost
+
diff --git a/roles/qemu-qcow2/tests/test.yml b/roles/qemu-qcow2/tests/test.yml
new file mode 100644
index 0000000..7ff2941
--- /dev/null
+++ b/roles/qemu-qcow2/tests/test.yml
@@ -0,0 +1,5 @@
+---
+- hosts: localhost
+ remote_user: root
+ roles:
+ - qemu-qcow2 \ No newline at end of file
diff --git a/roles/qemu/files/config.boot b/roles/qemu/files/config.boot
deleted file mode 100644
index f1ec4f5..0000000
--- a/roles/qemu/files/config.boot
+++ /dev/null
@@ -1,41 +0,0 @@
-service {
- ssh {
- port 22
- }
-}
-system {
- host-name vyos
- login {
- user vyos {
- authentication {
- encrypted-password "$6$MjV2YvKQ56q$QbL562qhRoyUu8OaqrXagicvcsNpF1HssCY06ZxxghDJkBCfSfTE/4FlFB41xZcd/HqYyVBuRt8Zyq3ozJ0dc."
- plaintext-password ""
- }
- level admin
- }
- }
- syslog {
- global {
- facility all {
- level notice
- }
- facility protocols {
- level debug
- }
- }
- }
- ntp {
- server "0.pool.ntp.org"
- server "1.pool.ntp.org"
- server "2.pool.ntp.org"
- }
- config-management {
- commit-revisions 100
- }
-}
-interfaces {
- ethernet eth0 {
- address dhcp
- }
- loopback lo
-}
diff --git a/roles/qemu/files/persistence.conf b/roles/qemu/files/persistence.conf
deleted file mode 100644
index f500aef..0000000
--- a/roles/qemu/files/persistence.conf
+++ /dev/null
@@ -1 +0,0 @@
-/ union
diff --git a/roles/qemu/tasks/build_image.yml b/roles/qemu/tasks/build_image.yml
deleted file mode 100644
index 135d8de..0000000
--- a/roles/qemu/tasks/build_image.yml
+++ /dev/null
@@ -1,122 +0,0 @@
-- name: Create the target disk image
- command: qemu-img create -f raw "{{ vyos_raw_img }}" 1G
-
-- name: Find loopback
- shell: losetup -f
- register: loopback
-
-- name: Loopback attach
- command: "losetup {{ loopback.stdout }} {{ vyos_raw_img }}"
-
-- name: Partition the target drive
- parted:
- device: "{{ loopback.stdout }}"
- state: present
- label: msdos
- number: 1
- part_type: primary
- part_start: 0%
- part_end: 100%
- align: optimal
- flags: [boot]
-
-- name: Create a filesystem on root partition
- filesystem:
- fstype: "{{ ROOT_FSTYPE }}"
- device: "{{ loopback.stdout }}"
- opts: "-L persistence"
-
-- name: Mount root partition
- mount:
- name: "{{ WRITE_ROOT }}"
- src: "{{ loopback.stdout }}"
- fstype: "{{ ROOT_FSTYPE }}"
- state: mounted
-
-# ---- Install image from ISO ----
-- name: Create {{ WRITE_ROOT }} directories
- file:
- path: "{{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/rw"
- state: directory
- register: RW_DIR
-
-- name: Create the work directory
- file:
- path: "{{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/work/work"
- state: directory
-
-- name: Copy squashfs image from ISO to root partition
- command: cp -p {{ SQUASHFS_IMAGE }} {{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/{{ version_string.stdout }}.squashfs
- args:
- creates: "{{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/{{ version_string.stdout }}.squashfs"
-
-- name: Copy boot files (kernel and initrd images) from ISO to root partition
- shell: find {{ CD_SQUASH_ROOT }}/boot -maxdepth 1 \( -type f -o -type l \) -print -exec cp -dp {} {{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/ \;
- args:
- creates: "{{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/vmlinuz"
-
-- name: Mount squashfs image from root partition
- mount:
- name: "{{ READ_ROOT }}"
- src: "{{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/{{ version_string.stdout }}.squashfs"
- fstype: squashfs
- opts: loop,ro
- state: mounted
-
-- name: Set up union root for post installation tasks
- mount:
- name: "{{ INSTALL_ROOT }}"
- src: none
- fstype: aufs
- opts: "noatime,dirs={{ RW_DIR.path }}=rw:{{ READ_ROOT }}=rr"
- state: mounted
-
-# ---- Post image installation tasks ----
-
-## ---- VyOS configuration ----
-- name: Make sure that config partition marker exists
- file:
- path: "{{ INSTALL_ROOT }}/opt/vyatta/etc/config/.vyatta_config"
- state: touch
-
-- name: Copy the default config for QEMU to the installed image
- copy:
- src: files/config.boot
- dest: "{{ INSTALL_ROOT }}/opt/vyatta/etc/config/config.boot"
- mode: 0755
-
-## ---- Install GRUB boot loader ----
-- name: Create GRUB directory
- file:
- path: "{{ WRITE_ROOT }}/boot/grub"
- state: directory
-
-# It is necessary to mount and bind /dev, /proc, /sys and /boot in order to execute grub-install
-# and install GRUB correctly within the {{ volume_drive }} using chroot
-
-# XXX: ansible mount module requires fstype so it cannot be used for binding an already
-# mounted location, we get to use mount directly at least for /boot
-- name: Mount and bind /dev /proc /sys and {{ WRITE_ROOT }}/boot to {{ INSTALL_ROOT }}
- shell: mount --bind /dev {{ INSTALL_ROOT }}/dev &&
- mount --bind /proc {{ INSTALL_ROOT }}/proc &&
- mount --bind /sys {{ INSTALL_ROOT }}/sys &&
- mount --bind {{ WRITE_ROOT }} {{ INSTALL_ROOT }}/boot
- args:
- warn: no
-
-- name: Install GRUB in the boot sector of {{ loopback.stdout }}
- command: chroot {{ INSTALL_ROOT }} grub-install --no-floppy --root-directory=/boot {{ loopback.stdout }} --force
- args:
- creates: "{{ INSTALL_ROOT }}/boot/grub/grubenv"
-
-- name: Configure GRUB
- template:
- src: templates/boot/grub/grub.cfg.j2
- dest: "{{ WRITE_ROOT }}/boot/grub/grub.cfg"
- mode: 0644
-
-- name: Create the persistence config
- copy:
- src: files/persistence.conf
- dest: "{{ WRITE_ROOT }}/persistence.conf"
- mode: 0644
diff --git a/roles/qemu/tasks/load_modules.yml b/roles/qemu/tasks/load_modules.yml
deleted file mode 100644
index 44295fe..0000000
--- a/roles/qemu/tasks/load_modules.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-- name: Load aufs module
- shell: modprobe aufs
diff --git a/roles/qemu/tasks/main.yml b/roles/qemu/tasks/main.yml
deleted file mode 100644
index c2a1b28..0000000
--- a/roles/qemu/tasks/main.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-- include_tasks: load_modules.yml
-- include_tasks: setup_iso.yml
-- include_tasks: build_image.yml
-- include_tasks: unmount.yml
-- include_tasks: convert.yml
-- include_tasks: release.yml
diff --git a/roles/qemu/tasks/release.yml b/roles/qemu/tasks/release.yml
deleted file mode 100644
index 1d4d325..0000000
--- a/roles/qemu/tasks/release.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-- name: Release image
- become: false
- copy:
- src: "{{ vyos_qemu_img }}"
- dest: "{{ vyos_images_dir }}/vyos-{{ version_string.stdout }}-qemu.qcow2"
- when: vyos_images_dir is defined
diff --git a/roles/qemu/tasks/setup_iso.yml b/roles/qemu/tasks/setup_iso.yml
deleted file mode 100644
index 18f1f5e..0000000
--- a/roles/qemu/tasks/setup_iso.yml
+++ /dev/null
@@ -1,57 +0,0 @@
-- name: Fetch VyOS ISO GPG signature
- uri:
- url: "{{ vyos_iso_url }}.asc"
- dest: "{{ vyos_iso_local }}.asc"
- status_code: 200,404,403
- tags: verify
- register: gpg_uri
-
-- name: Download VyOS ISO release
- get_url:
- url: "{{ vyos_iso_url }}"
- dest: "{{ vyos_iso_local }}"
-
-- name: Fetch the VyOS release GPG key
- get_url:
- url: "{{ vyos_key_url}}"
- dest: "{{ vyos_key_local }}"
- tags: verify
-
-- name: Install the VyOS release GPG key
- command: gpg --import {{ vyos_key_local }}
- when: gpg_uri.status == 200
- tags: verify
-
-- name: Validate ISO GPG signature
- command: gpg --verify {{ vyos_iso_local }}.asc {{ vyos_iso_local }}
- when: gpg_uri.status == 200
- tags: verify
-
-- name: Mount ISO
- mount:
- name: "{{ CD_ROOT }}"
- src: "{{ vyos_iso_local }}"
- fstype: iso9660
- opts: loop,ro
- state: mounted
-
-- name: Verify checksums of all the files in the ISO image
- command: md5sum -c md5sum.txt
- args:
- chdir: "{{ CD_ROOT }}"
- changed_when: False
-
-- name: Mount squashfs image from ISO
- mount:
- name: "{{ CD_SQUASH_ROOT }}"
- src: "{{ SQUASHFS_IMAGE }}"
- fstype: squashfs
- opts: loop,ro
- state: mounted
-
-- name: Read version string from iso packages
- shell: cat {{ CD_SQUASH_ROOT }}/opt/vyatta/etc/version | awk '{print $2}' | tr + -
- register: version_string
-
-- name: Debug version string as read from ISO
- debug: msg="This is version {{ version_string.stdout }}"
diff --git a/roles/qemu/tasks/unmount.yml b/roles/qemu/tasks/unmount.yml
deleted file mode 100644
index 39c3d52..0000000
--- a/roles/qemu/tasks/unmount.yml
+++ /dev/null
@@ -1,66 +0,0 @@
-# Unmount all mounts
-# If remove unmounted before absent, cannot unmount INSTALL_ROOT...
-- name: Unmount {{ INSTALL_ROOT }}/boot
- mount:
- name: "{{ INSTALL_ROOT }}/boot"
- src: "{{ WRITE_ROOT }}"
- fstype: none
- state: unmounted
-
-- name: Unmount {{ INSTALL_ROOT }}/boot
- mount:
- name: "{{ INSTALL_ROOT }}/boot"
- src: "{{ WRITE_ROOT }}"
- fstype: none
- state: absent
-
-- name: Unmount {{ INSTALL_ROOT }}/sys, {{ INSTALL_ROOT }}/proc, {{ INSTALL_ROOT }}/dev
- mount:
- name: "{{ INSTALL_ROOT }}/{{ item }}"
- src: "/{{ item }}"
- fstype: none
- state: unmounted
- with_items: [ 'sys', 'proc', 'dev' ]
-
-- name: Unmount {{ INSTALL_ROOT }}/sys, {{ INSTALL_ROOT }}/proc, {{ INSTALL_ROOT }}/dev
- mount:
- name: "{{ INSTALL_ROOT }}/{{ item }}"
- src: "/{{ item }}"
- fstype: none
- state: absent
- with_items: [ 'sys', 'proc', 'dev' ]
-
-- name: Unmount {{ INSTALL_ROOT }}
- mount:
- name: "{{ INSTALL_ROOT }}"
- src: overlayfs
- fstype: overlayfs
- state: absent
-
-- name: Unmount {{ READ_ROOT }}
- mount:
- name: "{{ READ_ROOT }}"
- src: "{{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/{{ version_string.stdout }}.squashfs"
- fstype: squashfs
- state: absent
-
-- name: Unmount {{ WRITE_ROOT }}
- mount:
- name: "{{ WRITE_ROOT }}"
- src: "{{ loopback.stdout }}"
- fstype: "{{ ROOT_FSTYPE }}"
- state: absent
-
-- name: Unmount {{ CD_SQUASH_ROOT }}
- mount:
- name: "{{ CD_SQUASH_ROOT }}"
- src: "{{ SQUASHFS_IMAGE }}"
- fstype: squashfs
- state: absent
-
-- name: Unmount {{ CD_ROOT }}
- mount:
- name: "{{ CD_ROOT }}"
- src: "{{ vyos_iso_local }}"
- fstype: iso9660
- state: absent
diff --git a/roles/qemu/templates/boot/grub/device.map.j2 b/roles/qemu/templates/boot/grub/device.map.j2
deleted file mode 100644
index e14205e..0000000
--- a/roles/qemu/templates/boot/grub/device.map.j2
+++ /dev/null
@@ -1 +0,0 @@
-(hd0) /dev/sda
diff --git a/roles/qemu/templates/boot/grub/grub.cfg.j2 b/roles/qemu/templates/boot/grub/grub.cfg.j2
deleted file mode 100644
index cf126ab..0000000
--- a/roles/qemu/templates/boot/grub/grub.cfg.j2
+++ /dev/null
@@ -1,7 +0,0 @@
-set default=0
-set timeout=0
-
-menuentry "VyOS VM Image {{ version_string.stdout }}" {
- linux /boot/{{ version_string.stdout }}/vmlinuz boot=live selinux=0 vyos-union=/boot/{{ version_string.stdout }} console=tty1
- initrd /boot/{{ version_string.stdout }}/initrd.img
-}
diff --git a/roles/qemu/vars/main.yml b/roles/qemu/vars/main.yml
deleted file mode 100644
index 838a6cb..0000000
--- a/roles/qemu/vars/main.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-vyos_raw_img: /tmp/vyos_raw_image.img
-vyos_qemu_img: /tmp/vyos_qemu_image.qcow2
diff --git a/roles/release/tasks/main.yml b/roles/release/tasks/main.yml
new file mode 100644
index 0000000..6449e9d
--- /dev/null
+++ b/roles/release/tasks/main.yml
@@ -0,0 +1,6 @@
+- name: Release image
+ become: false
+ copy:
+ src: "{{ vyos_output_img }}"
+ dest: "{{ vyos_images_dir }}/vyos-{{ vyos_version }}-{{ vyos_platform | lower }}.{{ vyos_format }}"
+ when: vyos_images_dir is defined
diff --git a/roles/release/tests/inventory b/roles/release/tests/inventory
new file mode 100644
index 0000000..878877b
--- /dev/null
+++ b/roles/release/tests/inventory
@@ -0,0 +1,2 @@
+localhost
+
diff --git a/roles/release/tests/test.yml b/roles/release/tests/test.yml
new file mode 100644
index 0000000..3b30c72
--- /dev/null
+++ b/roles/release/tests/test.yml
@@ -0,0 +1,4 @@
+---
+- hosts: localhost
+ roles:
+ - release
diff --git a/roles/setup-root-partition/tasks/main.yml b/roles/setup-root-partition/tasks/main.yml
new file mode 100644
index 0000000..d6729f2
--- /dev/null
+++ b/roles/setup-root-partition/tasks/main.yml
@@ -0,0 +1,27 @@
+- name: Partition the target drive
+ become: true
+ parted:
+ device: "{{ vyos_target_drive }}"
+ state: present
+ label: msdos
+ number: 1
+ part_type: primary
+ part_start: 0%
+ part_end: 100%
+ align: optimal
+ flags: [boot]
+
+- name: Create a filesystem on root partition
+ become: true
+ filesystem:
+ fstype: "{{ vyos_root_fstype }}"
+ device: "{{ vyos_target_drive }}"
+ opts: "-L persistence"
+
+- name: Mount root partition
+ become: true
+ mount:
+ name: "{{ vyos_write_root }}"
+ src: "{{ vyos_target_drive }}"
+ fstype: "{{ vyos_root_fstype }}"
+ state: mounted
diff --git a/roles/setup-root-partition/tests/inventory b/roles/setup-root-partition/tests/inventory
new file mode 100644
index 0000000..878877b
--- /dev/null
+++ b/roles/setup-root-partition/tests/inventory
@@ -0,0 +1,2 @@
+localhost
+
diff --git a/roles/setup-root-partition/tests/test.yml b/roles/setup-root-partition/tests/test.yml
new file mode 100644
index 0000000..ddf6cc8
--- /dev/null
+++ b/roles/setup-root-partition/tests/test.yml
@@ -0,0 +1,5 @@
+---
+- hosts: localhost
+ remote_user: root
+ roles:
+ - setup-root-partition \ No newline at end of file
diff --git a/roles/unmount-all/tasks/main.yml b/roles/unmount-all/tasks/main.yml
new file mode 100644
index 0000000..1ff6daa
--- /dev/null
+++ b/roles/unmount-all/tasks/main.yml
@@ -0,0 +1,75 @@
+# Unmount all mounts
+# If remove unmounted before absent, cannot unmount vyos_install_root...
+- name: Unmount {{ vyos_install_root }}/boot
+ become: true
+ mount:
+ name: "{{ vyos_install_root }}/boot"
+ src: "{{ vyos_write_root }}"
+ fstype: none
+ state: unmounted
+
+- name: Unmount {{ vyos_install_root }}/boot
+ become: true
+ mount:
+ name: "{{ vyos_install_root }}/boot"
+ src: "{{ vyos_write_root }}"
+ fstype: none
+ state: absent
+
+- name: Unmount {{ vyos_install_root }}/sys, {{ vyos_install_root }}/proc, {{ vyos_install_root }}/dev
+ become: true
+ mount:
+ name: "{{ vyos_install_root }}/{{ item }}"
+ src: "/{{ item }}"
+ fstype: none
+ state: unmounted
+ with_items: [ 'sys', 'proc', 'dev' ]
+
+- name: Unmount {{ vyos_install_root }}/sys, {{ vyos_install_root }}/proc, {{ vyos_install_root }}/dev
+ become: true
+ mount:
+ name: "{{ vyos_install_root }}/{{ item }}"
+ src: "/{{ item }}"
+ fstype: none
+ state: absent
+ with_items: [ 'sys', 'proc', 'dev' ]
+
+- name: Unmount {{ vyos_install_root }}
+ become: true
+ mount:
+ name: "{{ vyos_install_root }}"
+ src: overlayfs
+ fstype: overlayfs
+ state: absent
+
+- name: Unmount {{ vyos_read_root }}
+ become: true
+ mount:
+ name: "{{ vyos_read_root }}"
+ src: "{{ vyos_write_root }}/boot/{{ vyos_version }}/{{ vyos_version }}.squashfs"
+ fstype: squashfs
+ state: absent
+
+- name: Unmount {{ vyos_write_root }}
+ become: true
+ mount:
+ name: "{{ vyos_write_root }}"
+ src: "{{ vyos_target_drive }}"
+ fstype: "{{ vyos_root_fstype }}"
+ state: absent
+
+- name: Unmount {{ vyos_cd_squash_root }}
+ become: true
+ mount:
+ name: "{{ vyos_cd_squash_root }}"
+ src: "{{ vyos_squashfs_image }}"
+ fstype: squashfs
+ state: absent
+
+- name: Unmount {{ vyos_cd_root }}
+ become: true
+ mount:
+ name: "{{ vyos_cd_root }}"
+ src: "{{ vyos_iso_local }}"
+ fstype: iso9660
+ state: absent
diff --git a/roles/unmount-all/tests/inventory b/roles/unmount-all/tests/inventory
new file mode 100644
index 0000000..878877b
--- /dev/null
+++ b/roles/unmount-all/tests/inventory
@@ -0,0 +1,2 @@
+localhost
+
diff --git a/roles/unmount-all/tests/test.yml b/roles/unmount-all/tests/test.yml
new file mode 100644
index 0000000..cde7071
--- /dev/null
+++ b/roles/unmount-all/tests/test.yml
@@ -0,0 +1,4 @@
+---
+- hosts: localhost
+ roles:
+ - unmount-all
diff --git a/roles/vagrant-libvirt/files/Vagrantfile b/roles/vagrant-libvirt-box/files/Vagrantfile
index 7c89422..7c89422 100644
--- a/roles/vagrant-libvirt/files/Vagrantfile
+++ b/roles/vagrant-libvirt-box/files/Vagrantfile
diff --git a/roles/vagrant-libvirt/files/metadata.json b/roles/vagrant-libvirt-box/files/metadata.json
index a502c63..a502c63 100644
--- a/roles/vagrant-libvirt/files/metadata.json
+++ b/roles/vagrant-libvirt-box/files/metadata.json
diff --git a/roles/vagrant-libvirt/tasks/convert.yml b/roles/vagrant-libvirt-box/tasks/main.yml
index ede229a..ede229a 100644
--- a/roles/vagrant-libvirt/tasks/convert.yml
+++ b/roles/vagrant-libvirt-box/tasks/main.yml
diff --git a/roles/vagrant-libvirt-box/tests/inventory b/roles/vagrant-libvirt-box/tests/inventory
new file mode 100644
index 0000000..878877b
--- /dev/null
+++ b/roles/vagrant-libvirt-box/tests/inventory
@@ -0,0 +1,2 @@
+localhost
+
diff --git a/roles/vagrant-libvirt-box/tests/test.yml b/roles/vagrant-libvirt-box/tests/test.yml
new file mode 100644
index 0000000..3fcaf21
--- /dev/null
+++ b/roles/vagrant-libvirt-box/tests/test.yml
@@ -0,0 +1,4 @@
+---
+- hosts: localhost
+ roles:
+ - vagrant-libvirt-box
diff --git a/roles/vagrant-libvirt/vars/main.yml b/roles/vagrant-libvirt-box/vars/main.yml
index 1fe0af8..b262127 100644
--- a/roles/vagrant-libvirt/vars/main.yml
+++ b/roles/vagrant-libvirt-box/vars/main.yml
@@ -1,6 +1,4 @@
-vyos_raw_img: /tmp/vyos_raw_image.img
vyos_vagrant_libvirt_box_img: /tmp/box.img
-vyos_vagrant_libvirt_box: /tmp/vyos_vagrant_libvirt_image.box
vyos_vagrant_libvirt_metadata: files/metadata.json
vyos_vagrant_libvirt_vagrantfile: files/Vagrantfile
vyos_vagrant_libvirt_tmp_metadata: /tmp/metadata.json
diff --git a/roles/vagrant-libvirt/files/config.boot b/roles/vagrant-libvirt/files/config.boot
deleted file mode 100644
index f1ec4f5..0000000
--- a/roles/vagrant-libvirt/files/config.boot
+++ /dev/null
@@ -1,41 +0,0 @@
-service {
- ssh {
- port 22
- }
-}
-system {
- host-name vyos
- login {
- user vyos {
- authentication {
- encrypted-password "$6$MjV2YvKQ56q$QbL562qhRoyUu8OaqrXagicvcsNpF1HssCY06ZxxghDJkBCfSfTE/4FlFB41xZcd/HqYyVBuRt8Zyq3ozJ0dc."
- plaintext-password ""
- }
- level admin
- }
- }
- syslog {
- global {
- facility all {
- level notice
- }
- facility protocols {
- level debug
- }
- }
- }
- ntp {
- server "0.pool.ntp.org"
- server "1.pool.ntp.org"
- server "2.pool.ntp.org"
- }
- config-management {
- commit-revisions 100
- }
-}
-interfaces {
- ethernet eth0 {
- address dhcp
- }
- loopback lo
-}
diff --git a/roles/vagrant-libvirt/files/persistence.conf b/roles/vagrant-libvirt/files/persistence.conf
deleted file mode 100644
index f500aef..0000000
--- a/roles/vagrant-libvirt/files/persistence.conf
+++ /dev/null
@@ -1 +0,0 @@
-/ union
diff --git a/roles/vagrant-libvirt/tasks/build_image.yml b/roles/vagrant-libvirt/tasks/build_image.yml
deleted file mode 100644
index 135d8de..0000000
--- a/roles/vagrant-libvirt/tasks/build_image.yml
+++ /dev/null
@@ -1,122 +0,0 @@
-- name: Create the target disk image
- command: qemu-img create -f raw "{{ vyos_raw_img }}" 1G
-
-- name: Find loopback
- shell: losetup -f
- register: loopback
-
-- name: Loopback attach
- command: "losetup {{ loopback.stdout }} {{ vyos_raw_img }}"
-
-- name: Partition the target drive
- parted:
- device: "{{ loopback.stdout }}"
- state: present
- label: msdos
- number: 1
- part_type: primary
- part_start: 0%
- part_end: 100%
- align: optimal
- flags: [boot]
-
-- name: Create a filesystem on root partition
- filesystem:
- fstype: "{{ ROOT_FSTYPE }}"
- device: "{{ loopback.stdout }}"
- opts: "-L persistence"
-
-- name: Mount root partition
- mount:
- name: "{{ WRITE_ROOT }}"
- src: "{{ loopback.stdout }}"
- fstype: "{{ ROOT_FSTYPE }}"
- state: mounted
-
-# ---- Install image from ISO ----
-- name: Create {{ WRITE_ROOT }} directories
- file:
- path: "{{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/rw"
- state: directory
- register: RW_DIR
-
-- name: Create the work directory
- file:
- path: "{{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/work/work"
- state: directory
-
-- name: Copy squashfs image from ISO to root partition
- command: cp -p {{ SQUASHFS_IMAGE }} {{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/{{ version_string.stdout }}.squashfs
- args:
- creates: "{{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/{{ version_string.stdout }}.squashfs"
-
-- name: Copy boot files (kernel and initrd images) from ISO to root partition
- shell: find {{ CD_SQUASH_ROOT }}/boot -maxdepth 1 \( -type f -o -type l \) -print -exec cp -dp {} {{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/ \;
- args:
- creates: "{{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/vmlinuz"
-
-- name: Mount squashfs image from root partition
- mount:
- name: "{{ READ_ROOT }}"
- src: "{{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/{{ version_string.stdout }}.squashfs"
- fstype: squashfs
- opts: loop,ro
- state: mounted
-
-- name: Set up union root for post installation tasks
- mount:
- name: "{{ INSTALL_ROOT }}"
- src: none
- fstype: aufs
- opts: "noatime,dirs={{ RW_DIR.path }}=rw:{{ READ_ROOT }}=rr"
- state: mounted
-
-# ---- Post image installation tasks ----
-
-## ---- VyOS configuration ----
-- name: Make sure that config partition marker exists
- file:
- path: "{{ INSTALL_ROOT }}/opt/vyatta/etc/config/.vyatta_config"
- state: touch
-
-- name: Copy the default config for QEMU to the installed image
- copy:
- src: files/config.boot
- dest: "{{ INSTALL_ROOT }}/opt/vyatta/etc/config/config.boot"
- mode: 0755
-
-## ---- Install GRUB boot loader ----
-- name: Create GRUB directory
- file:
- path: "{{ WRITE_ROOT }}/boot/grub"
- state: directory
-
-# It is necessary to mount and bind /dev, /proc, /sys and /boot in order to execute grub-install
-# and install GRUB correctly within the {{ volume_drive }} using chroot
-
-# XXX: ansible mount module requires fstype so it cannot be used for binding an already
-# mounted location, we get to use mount directly at least for /boot
-- name: Mount and bind /dev /proc /sys and {{ WRITE_ROOT }}/boot to {{ INSTALL_ROOT }}
- shell: mount --bind /dev {{ INSTALL_ROOT }}/dev &&
- mount --bind /proc {{ INSTALL_ROOT }}/proc &&
- mount --bind /sys {{ INSTALL_ROOT }}/sys &&
- mount --bind {{ WRITE_ROOT }} {{ INSTALL_ROOT }}/boot
- args:
- warn: no
-
-- name: Install GRUB in the boot sector of {{ loopback.stdout }}
- command: chroot {{ INSTALL_ROOT }} grub-install --no-floppy --root-directory=/boot {{ loopback.stdout }} --force
- args:
- creates: "{{ INSTALL_ROOT }}/boot/grub/grubenv"
-
-- name: Configure GRUB
- template:
- src: templates/boot/grub/grub.cfg.j2
- dest: "{{ WRITE_ROOT }}/boot/grub/grub.cfg"
- mode: 0644
-
-- name: Create the persistence config
- copy:
- src: files/persistence.conf
- dest: "{{ WRITE_ROOT }}/persistence.conf"
- mode: 0644
diff --git a/roles/vagrant-libvirt/tasks/load_modules.yml b/roles/vagrant-libvirt/tasks/load_modules.yml
deleted file mode 100644
index 44295fe..0000000
--- a/roles/vagrant-libvirt/tasks/load_modules.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-- name: Load aufs module
- shell: modprobe aufs
diff --git a/roles/vagrant-libvirt/tasks/main.yml b/roles/vagrant-libvirt/tasks/main.yml
deleted file mode 100644
index c2a1b28..0000000
--- a/roles/vagrant-libvirt/tasks/main.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-- include_tasks: load_modules.yml
-- include_tasks: setup_iso.yml
-- include_tasks: build_image.yml
-- include_tasks: unmount.yml
-- include_tasks: convert.yml
-- include_tasks: release.yml
diff --git a/roles/vagrant-libvirt/tasks/release.yml b/roles/vagrant-libvirt/tasks/release.yml
deleted file mode 100644
index bfb9a63..0000000
--- a/roles/vagrant-libvirt/tasks/release.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-- name: Release image
- become: false
- copy:
- src: "{{ vyos_vagrant_libvirt_box }}"
- dest: "{{ vyos_images_dir }}/vyos-{{ version_string.stdout }}-vagrant-libvirt.box"
- when: vyos_images_dir is defined
-- name: Set box version
- set_fact:
- box_version: "{{ version_string.stdout.split('-')[2][0:8] }}.{{ version_string.stdout.split('-')[2][8:10] }}.{{ version_string.stdout.split('-')[2][10:12] }}"
- when: vyos_images_dir is defined and vyos_vagrant_box_base_url is defined
-- name: Create the box version
- uri:
- url: "https://app.vagrantup.com/api/v1/box/{{ vyos_vagrant_box_name }}/versions?access_token={{ vyos_vagrant_cloud_access_token }}"
- method: POST
- body: "version[version]={{ box_version }}"
- when: vyos_images_dir is defined and vyos_vagrant_box_base_url is defined and vyos_vagrant_cloud_access_token is defined
-- name: Create the box provider
- uri:
- url: "https://app.vagrantup.com/api/v1/box/{{ vyos_vagrant_box_name }}/version/{{ box_version }}/providers?access_token={{ vyos_vagrant_cloud_access_token }}"
- method: POST
- body: "provider[name]=libvirt&provider[url]={{ vyos_vagrant_box_base_url }}/vyos-{{ version_string.stdout }}-vagrant-libvirt.box"
- when: vyos_images_dir is defined and vyos_vagrant_box_base_url is defined and vyos_vagrant_cloud_access_token is defined
-- name: Release the box
- uri:
- url: "https://app.vagrantup.com/api/v1/box/{{ vyos_vagrant_box_name }}/version/{{ box_version }}/release?access_token={{ vyos_vagrant_cloud_access_token }}"
- method: PUT
- when: vyos_images_dir is defined and vyos_vagrant_box_base_url is defined and vyos_vagrant_cloud_access_token is defined
diff --git a/roles/vagrant-libvirt/tasks/setup_iso.yml b/roles/vagrant-libvirt/tasks/setup_iso.yml
deleted file mode 100644
index 18f1f5e..0000000
--- a/roles/vagrant-libvirt/tasks/setup_iso.yml
+++ /dev/null
@@ -1,57 +0,0 @@
-- name: Fetch VyOS ISO GPG signature
- uri:
- url: "{{ vyos_iso_url }}.asc"
- dest: "{{ vyos_iso_local }}.asc"
- status_code: 200,404,403
- tags: verify
- register: gpg_uri
-
-- name: Download VyOS ISO release
- get_url:
- url: "{{ vyos_iso_url }}"
- dest: "{{ vyos_iso_local }}"
-
-- name: Fetch the VyOS release GPG key
- get_url:
- url: "{{ vyos_key_url}}"
- dest: "{{ vyos_key_local }}"
- tags: verify
-
-- name: Install the VyOS release GPG key
- command: gpg --import {{ vyos_key_local }}
- when: gpg_uri.status == 200
- tags: verify
-
-- name: Validate ISO GPG signature
- command: gpg --verify {{ vyos_iso_local }}.asc {{ vyos_iso_local }}
- when: gpg_uri.status == 200
- tags: verify
-
-- name: Mount ISO
- mount:
- name: "{{ CD_ROOT }}"
- src: "{{ vyos_iso_local }}"
- fstype: iso9660
- opts: loop,ro
- state: mounted
-
-- name: Verify checksums of all the files in the ISO image
- command: md5sum -c md5sum.txt
- args:
- chdir: "{{ CD_ROOT }}"
- changed_when: False
-
-- name: Mount squashfs image from ISO
- mount:
- name: "{{ CD_SQUASH_ROOT }}"
- src: "{{ SQUASHFS_IMAGE }}"
- fstype: squashfs
- opts: loop,ro
- state: mounted
-
-- name: Read version string from iso packages
- shell: cat {{ CD_SQUASH_ROOT }}/opt/vyatta/etc/version | awk '{print $2}' | tr + -
- register: version_string
-
-- name: Debug version string as read from ISO
- debug: msg="This is version {{ version_string.stdout }}"
diff --git a/roles/vagrant-libvirt/tasks/unmount.yml b/roles/vagrant-libvirt/tasks/unmount.yml
deleted file mode 100644
index 39c3d52..0000000
--- a/roles/vagrant-libvirt/tasks/unmount.yml
+++ /dev/null
@@ -1,66 +0,0 @@
-# Unmount all mounts
-# If remove unmounted before absent, cannot unmount INSTALL_ROOT...
-- name: Unmount {{ INSTALL_ROOT }}/boot
- mount:
- name: "{{ INSTALL_ROOT }}/boot"
- src: "{{ WRITE_ROOT }}"
- fstype: none
- state: unmounted
-
-- name: Unmount {{ INSTALL_ROOT }}/boot
- mount:
- name: "{{ INSTALL_ROOT }}/boot"
- src: "{{ WRITE_ROOT }}"
- fstype: none
- state: absent
-
-- name: Unmount {{ INSTALL_ROOT }}/sys, {{ INSTALL_ROOT }}/proc, {{ INSTALL_ROOT }}/dev
- mount:
- name: "{{ INSTALL_ROOT }}/{{ item }}"
- src: "/{{ item }}"
- fstype: none
- state: unmounted
- with_items: [ 'sys', 'proc', 'dev' ]
-
-- name: Unmount {{ INSTALL_ROOT }}/sys, {{ INSTALL_ROOT }}/proc, {{ INSTALL_ROOT }}/dev
- mount:
- name: "{{ INSTALL_ROOT }}/{{ item }}"
- src: "/{{ item }}"
- fstype: none
- state: absent
- with_items: [ 'sys', 'proc', 'dev' ]
-
-- name: Unmount {{ INSTALL_ROOT }}
- mount:
- name: "{{ INSTALL_ROOT }}"
- src: overlayfs
- fstype: overlayfs
- state: absent
-
-- name: Unmount {{ READ_ROOT }}
- mount:
- name: "{{ READ_ROOT }}"
- src: "{{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/{{ version_string.stdout }}.squashfs"
- fstype: squashfs
- state: absent
-
-- name: Unmount {{ WRITE_ROOT }}
- mount:
- name: "{{ WRITE_ROOT }}"
- src: "{{ loopback.stdout }}"
- fstype: "{{ ROOT_FSTYPE }}"
- state: absent
-
-- name: Unmount {{ CD_SQUASH_ROOT }}
- mount:
- name: "{{ CD_SQUASH_ROOT }}"
- src: "{{ SQUASHFS_IMAGE }}"
- fstype: squashfs
- state: absent
-
-- name: Unmount {{ CD_ROOT }}
- mount:
- name: "{{ CD_ROOT }}"
- src: "{{ vyos_iso_local }}"
- fstype: iso9660
- state: absent
diff --git a/roles/vagrant-libvirt/templates/boot/grub/device.map.j2 b/roles/vagrant-libvirt/templates/boot/grub/device.map.j2
deleted file mode 100644
index e14205e..0000000
--- a/roles/vagrant-libvirt/templates/boot/grub/device.map.j2
+++ /dev/null
@@ -1 +0,0 @@
-(hd0) /dev/sda
diff --git a/roles/vagrant-libvirt/templates/boot/grub/grub.cfg.j2 b/roles/vagrant-libvirt/templates/boot/grub/grub.cfg.j2
deleted file mode 100644
index cf126ab..0000000
--- a/roles/vagrant-libvirt/templates/boot/grub/grub.cfg.j2
+++ /dev/null
@@ -1,7 +0,0 @@
-set default=0
-set timeout=0
-
-menuentry "VyOS VM Image {{ version_string.stdout }}" {
- linux /boot/{{ version_string.stdout }}/vmlinuz boot=live selinux=0 vyos-union=/boot/{{ version_string.stdout }} console=tty1
- initrd /boot/{{ version_string.stdout }}/initrd.img
-}
diff --git a/roles/vmware/tasks/convert.yml b/roles/vmware-ova/tasks/main.yml
index 53c4989..53c4989 100644
--- a/roles/vmware/tasks/convert.yml
+++ b/roles/vmware-ova/tasks/main.yml
diff --git a/roles/vmware/templates/vyos_vmware_image.ovf.j2 b/roles/vmware-ova/templates/vyos_vmware_image.ovf.j2
index 50fbb35..b6b7fa7 100644
--- a/roles/vmware/templates/vyos_vmware_image.ovf.j2
+++ b/roles/vmware-ova/templates/vyos_vmware_image.ovf.j2
@@ -5,7 +5,7 @@
</References>
<DiskSection>
<Info>Virtual disk information</Info>
- <Disk ovf:capacity="4" ovf:capacityAllocationUnits="byte * 2^30" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" ovf:populatedSize="{{ vmdk_populated_size }}"/>
+ <Disk ovf:capacity="{{ vyos_vmdk_size }}" ovf:capacityAllocationUnits="byte * 2^30" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" ovf:populatedSize="{{ vmdk_populated_size }}"/>
</DiskSection>
<NetworkSection>
<Info>The list of logical networks</Info>
@@ -107,6 +107,7 @@
</Item>
<vmw:Config ovf:required="false" vmw:key="cpuHotAddEnabled" vmw:value="true"/>
<vmw:Config ovf:required="false" vmw:key="memoryHotAddEnabled" vmw:value="true"/>
+ <vmw:Config ovf:required="false" vmw:key="cpuHotRemoveEnabled" vmw:value="false"/>
<vmw:Config ovf:required="false" vmw:key="powerOpInfo.powerOffType" vmw:value="soft"/>
<vmw:Config ovf:required="false" vmw:key="powerOpInfo.resetType" vmw:value="soft"/>
<vmw:Config ovf:required="false" vmw:key="powerOpInfo.suspendType" vmw:value="soft"/>
@@ -115,7 +116,7 @@
<Info>VyOS is a Linux-based network operating system that provides software-based network routing, firewall, and VPN functionality.</Info>
<Product>VyOS</Product>
<Vendor>VyOS maintainers and contributors</Vendor>
- <Version>{{ version_string.stdout }}</Version>
+ <Version>{{ vyos_version }}</Version>
</ProductSection>
</VirtualSystem>
</Envelope>
diff --git a/roles/vmware-ova/tests/inventory b/roles/vmware-ova/tests/inventory
new file mode 100644
index 0000000..878877b
--- /dev/null
+++ b/roles/vmware-ova/tests/inventory
@@ -0,0 +1,2 @@
+localhost
+
diff --git a/roles/vmware-ova/tests/test.yml b/roles/vmware-ova/tests/test.yml
new file mode 100644
index 0000000..58552e3
--- /dev/null
+++ b/roles/vmware-ova/tests/test.yml
@@ -0,0 +1,4 @@
+---
+- hosts: localhost
+ roles:
+ - vmware-ova
diff --git a/roles/vmware/vars/main.yml b/roles/vmware-ova/vars/main.yml
index 70eea54..176f25c 100644
--- a/roles/vmware/vars/main.yml
+++ b/roles/vmware-ova/vars/main.yml
@@ -1,4 +1,3 @@
-vyos_raw_img: /tmp/vyos_raw_image.img
vyos_vmware_ovf: /tmp/vyos_vmware_image.ovf
vyos_vmware_tmp_vmdk: /tmp/vyos_vmware_image_tmp.vmdk
vyos_vmware_mf: /tmp/vyos_vmware_image.mf
diff --git a/roles/vmware/files/config.boot b/roles/vmware/files/config.boot
deleted file mode 100644
index f1ec4f5..0000000
--- a/roles/vmware/files/config.boot
+++ /dev/null
@@ -1,41 +0,0 @@
-service {
- ssh {
- port 22
- }
-}
-system {
- host-name vyos
- login {
- user vyos {
- authentication {
- encrypted-password "$6$MjV2YvKQ56q$QbL562qhRoyUu8OaqrXagicvcsNpF1HssCY06ZxxghDJkBCfSfTE/4FlFB41xZcd/HqYyVBuRt8Zyq3ozJ0dc."
- plaintext-password ""
- }
- level admin
- }
- }
- syslog {
- global {
- facility all {
- level notice
- }
- facility protocols {
- level debug
- }
- }
- }
- ntp {
- server "0.pool.ntp.org"
- server "1.pool.ntp.org"
- server "2.pool.ntp.org"
- }
- config-management {
- commit-revisions 100
- }
-}
-interfaces {
- ethernet eth0 {
- address dhcp
- }
- loopback lo
-}
diff --git a/roles/vmware/files/persistence.conf b/roles/vmware/files/persistence.conf
deleted file mode 100644
index f500aef..0000000
--- a/roles/vmware/files/persistence.conf
+++ /dev/null
@@ -1 +0,0 @@
-/ union
diff --git a/roles/vmware/tasks/build_image.yml b/roles/vmware/tasks/build_image.yml
deleted file mode 100644
index 135d8de..0000000
--- a/roles/vmware/tasks/build_image.yml
+++ /dev/null
@@ -1,122 +0,0 @@
-- name: Create the target disk image
- command: qemu-img create -f raw "{{ vyos_raw_img }}" 1G
-
-- name: Find loopback
- shell: losetup -f
- register: loopback
-
-- name: Loopback attach
- command: "losetup {{ loopback.stdout }} {{ vyos_raw_img }}"
-
-- name: Partition the target drive
- parted:
- device: "{{ loopback.stdout }}"
- state: present
- label: msdos
- number: 1
- part_type: primary
- part_start: 0%
- part_end: 100%
- align: optimal
- flags: [boot]
-
-- name: Create a filesystem on root partition
- filesystem:
- fstype: "{{ ROOT_FSTYPE }}"
- device: "{{ loopback.stdout }}"
- opts: "-L persistence"
-
-- name: Mount root partition
- mount:
- name: "{{ WRITE_ROOT }}"
- src: "{{ loopback.stdout }}"
- fstype: "{{ ROOT_FSTYPE }}"
- state: mounted
-
-# ---- Install image from ISO ----
-- name: Create {{ WRITE_ROOT }} directories
- file:
- path: "{{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/rw"
- state: directory
- register: RW_DIR
-
-- name: Create the work directory
- file:
- path: "{{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/work/work"
- state: directory
-
-- name: Copy squashfs image from ISO to root partition
- command: cp -p {{ SQUASHFS_IMAGE }} {{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/{{ version_string.stdout }}.squashfs
- args:
- creates: "{{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/{{ version_string.stdout }}.squashfs"
-
-- name: Copy boot files (kernel and initrd images) from ISO to root partition
- shell: find {{ CD_SQUASH_ROOT }}/boot -maxdepth 1 \( -type f -o -type l \) -print -exec cp -dp {} {{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/ \;
- args:
- creates: "{{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/vmlinuz"
-
-- name: Mount squashfs image from root partition
- mount:
- name: "{{ READ_ROOT }}"
- src: "{{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/{{ version_string.stdout }}.squashfs"
- fstype: squashfs
- opts: loop,ro
- state: mounted
-
-- name: Set up union root for post installation tasks
- mount:
- name: "{{ INSTALL_ROOT }}"
- src: none
- fstype: aufs
- opts: "noatime,dirs={{ RW_DIR.path }}=rw:{{ READ_ROOT }}=rr"
- state: mounted
-
-# ---- Post image installation tasks ----
-
-## ---- VyOS configuration ----
-- name: Make sure that config partition marker exists
- file:
- path: "{{ INSTALL_ROOT }}/opt/vyatta/etc/config/.vyatta_config"
- state: touch
-
-- name: Copy the default config for QEMU to the installed image
- copy:
- src: files/config.boot
- dest: "{{ INSTALL_ROOT }}/opt/vyatta/etc/config/config.boot"
- mode: 0755
-
-## ---- Install GRUB boot loader ----
-- name: Create GRUB directory
- file:
- path: "{{ WRITE_ROOT }}/boot/grub"
- state: directory
-
-# It is necessary to mount and bind /dev, /proc, /sys and /boot in order to execute grub-install
-# and install GRUB correctly within the {{ volume_drive }} using chroot
-
-# XXX: ansible mount module requires fstype so it cannot be used for binding an already
-# mounted location, we get to use mount directly at least for /boot
-- name: Mount and bind /dev /proc /sys and {{ WRITE_ROOT }}/boot to {{ INSTALL_ROOT }}
- shell: mount --bind /dev {{ INSTALL_ROOT }}/dev &&
- mount --bind /proc {{ INSTALL_ROOT }}/proc &&
- mount --bind /sys {{ INSTALL_ROOT }}/sys &&
- mount --bind {{ WRITE_ROOT }} {{ INSTALL_ROOT }}/boot
- args:
- warn: no
-
-- name: Install GRUB in the boot sector of {{ loopback.stdout }}
- command: chroot {{ INSTALL_ROOT }} grub-install --no-floppy --root-directory=/boot {{ loopback.stdout }} --force
- args:
- creates: "{{ INSTALL_ROOT }}/boot/grub/grubenv"
-
-- name: Configure GRUB
- template:
- src: templates/boot/grub/grub.cfg.j2
- dest: "{{ WRITE_ROOT }}/boot/grub/grub.cfg"
- mode: 0644
-
-- name: Create the persistence config
- copy:
- src: files/persistence.conf
- dest: "{{ WRITE_ROOT }}/persistence.conf"
- mode: 0644
diff --git a/roles/vmware/tasks/install_open_vmdk.yml b/roles/vmware/tasks/install_open_vmdk.yml
deleted file mode 100644
index 87c54c2..0000000
--- a/roles/vmware/tasks/install_open_vmdk.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-- name: Download open-vmdk
- get_url:
- url: https://github.com/vmware/open-vmdk/archive/master.zip
- dest: /tmp/master.zip
-- name: Extract master.zip into /var/lib/foo
- unarchive:
- src: /tmp/master.zip
- dest: /tmp
-- name: Install open-vmdk
- make:
- chdir: /tmp/open-vmdk-master
- target: install
diff --git a/roles/vmware/tasks/load_modules.yml b/roles/vmware/tasks/load_modules.yml
deleted file mode 100644
index 44295fe..0000000
--- a/roles/vmware/tasks/load_modules.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-- name: Load aufs module
- shell: modprobe aufs
diff --git a/roles/vmware/tasks/main.yml b/roles/vmware/tasks/main.yml
deleted file mode 100644
index 00492a9..0000000
--- a/roles/vmware/tasks/main.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-- include_tasks: install_open_vmdk.yml
-- include_tasks: load_modules.yml
-- include_tasks: setup_iso.yml
-- include_tasks: build_image.yml
-- include_tasks: unmount.yml
-- include_tasks: convert.yml
-- include_tasks: release.yml
diff --git a/roles/vmware/tasks/release.yml b/roles/vmware/tasks/release.yml
deleted file mode 100644
index 9487848..0000000
--- a/roles/vmware/tasks/release.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-- name: Release image
- become: false
- copy:
- src: "{{ vyos_vmware_ova }}"
- dest: "{{ vyos_images_dir }}/vyos-{{ version_string.stdout }}-vmware.ova"
- when: vyos_images_dir is defined
diff --git a/roles/vmware/tasks/setup_iso.yml b/roles/vmware/tasks/setup_iso.yml
deleted file mode 100644
index 18f1f5e..0000000
--- a/roles/vmware/tasks/setup_iso.yml
+++ /dev/null
@@ -1,57 +0,0 @@
-- name: Fetch VyOS ISO GPG signature
- uri:
- url: "{{ vyos_iso_url }}.asc"
- dest: "{{ vyos_iso_local }}.asc"
- status_code: 200,404,403
- tags: verify
- register: gpg_uri
-
-- name: Download VyOS ISO release
- get_url:
- url: "{{ vyos_iso_url }}"
- dest: "{{ vyos_iso_local }}"
-
-- name: Fetch the VyOS release GPG key
- get_url:
- url: "{{ vyos_key_url}}"
- dest: "{{ vyos_key_local }}"
- tags: verify
-
-- name: Install the VyOS release GPG key
- command: gpg --import {{ vyos_key_local }}
- when: gpg_uri.status == 200
- tags: verify
-
-- name: Validate ISO GPG signature
- command: gpg --verify {{ vyos_iso_local }}.asc {{ vyos_iso_local }}
- when: gpg_uri.status == 200
- tags: verify
-
-- name: Mount ISO
- mount:
- name: "{{ CD_ROOT }}"
- src: "{{ vyos_iso_local }}"
- fstype: iso9660
- opts: loop,ro
- state: mounted
-
-- name: Verify checksums of all the files in the ISO image
- command: md5sum -c md5sum.txt
- args:
- chdir: "{{ CD_ROOT }}"
- changed_when: False
-
-- name: Mount squashfs image from ISO
- mount:
- name: "{{ CD_SQUASH_ROOT }}"
- src: "{{ SQUASHFS_IMAGE }}"
- fstype: squashfs
- opts: loop,ro
- state: mounted
-
-- name: Read version string from iso packages
- shell: cat {{ CD_SQUASH_ROOT }}/opt/vyatta/etc/version | awk '{print $2}' | tr + -
- register: version_string
-
-- name: Debug version string as read from ISO
- debug: msg="This is version {{ version_string.stdout }}"
diff --git a/roles/vmware/tasks/unmount.yml b/roles/vmware/tasks/unmount.yml
deleted file mode 100644
index 39c3d52..0000000
--- a/roles/vmware/tasks/unmount.yml
+++ /dev/null
@@ -1,66 +0,0 @@
-# Unmount all mounts
-# If remove unmounted before absent, cannot unmount INSTALL_ROOT...
-- name: Unmount {{ INSTALL_ROOT }}/boot
- mount:
- name: "{{ INSTALL_ROOT }}/boot"
- src: "{{ WRITE_ROOT }}"
- fstype: none
- state: unmounted
-
-- name: Unmount {{ INSTALL_ROOT }}/boot
- mount:
- name: "{{ INSTALL_ROOT }}/boot"
- src: "{{ WRITE_ROOT }}"
- fstype: none
- state: absent
-
-- name: Unmount {{ INSTALL_ROOT }}/sys, {{ INSTALL_ROOT }}/proc, {{ INSTALL_ROOT }}/dev
- mount:
- name: "{{ INSTALL_ROOT }}/{{ item }}"
- src: "/{{ item }}"
- fstype: none
- state: unmounted
- with_items: [ 'sys', 'proc', 'dev' ]
-
-- name: Unmount {{ INSTALL_ROOT }}/sys, {{ INSTALL_ROOT }}/proc, {{ INSTALL_ROOT }}/dev
- mount:
- name: "{{ INSTALL_ROOT }}/{{ item }}"
- src: "/{{ item }}"
- fstype: none
- state: absent
- with_items: [ 'sys', 'proc', 'dev' ]
-
-- name: Unmount {{ INSTALL_ROOT }}
- mount:
- name: "{{ INSTALL_ROOT }}"
- src: overlayfs
- fstype: overlayfs
- state: absent
-
-- name: Unmount {{ READ_ROOT }}
- mount:
- name: "{{ READ_ROOT }}"
- src: "{{ WRITE_ROOT }}/boot/{{ version_string.stdout }}/{{ version_string.stdout }}.squashfs"
- fstype: squashfs
- state: absent
-
-- name: Unmount {{ WRITE_ROOT }}
- mount:
- name: "{{ WRITE_ROOT }}"
- src: "{{ loopback.stdout }}"
- fstype: "{{ ROOT_FSTYPE }}"
- state: absent
-
-- name: Unmount {{ CD_SQUASH_ROOT }}
- mount:
- name: "{{ CD_SQUASH_ROOT }}"
- src: "{{ SQUASHFS_IMAGE }}"
- fstype: squashfs
- state: absent
-
-- name: Unmount {{ CD_ROOT }}
- mount:
- name: "{{ CD_ROOT }}"
- src: "{{ vyos_iso_local }}"
- fstype: iso9660
- state: absent
diff --git a/roles/vmware/templates/boot/grub/device.map.j2 b/roles/vmware/templates/boot/grub/device.map.j2
deleted file mode 100644
index e14205e..0000000
--- a/roles/vmware/templates/boot/grub/device.map.j2
+++ /dev/null
@@ -1 +0,0 @@
-(hd0) /dev/sda
diff --git a/roles/vmware/templates/boot/grub/grub.cfg.j2 b/roles/vmware/templates/boot/grub/grub.cfg.j2
deleted file mode 100644
index cf126ab..0000000
--- a/roles/vmware/templates/boot/grub/grub.cfg.j2
+++ /dev/null
@@ -1,7 +0,0 @@
-set default=0
-set timeout=0
-
-menuentry "VyOS VM Image {{ version_string.stdout }}" {
- linux /boot/{{ version_string.stdout }}/vmlinuz boot=live selinux=0 vyos-union=/boot/{{ version_string.stdout }} console=tty1
- initrd /boot/{{ version_string.stdout }}/initrd.img
-}
diff --git a/vagrant-libvirt.yml b/vagrant-libvirt.yml
index d20d98d..c7ea6c7 100644
--- a/vagrant-libvirt.yml
+++ b/vagrant-libvirt.yml
@@ -3,6 +3,25 @@
become: True
gather_facts: False
connection: local
+ vars:
+ vyos_platform: vagrant-libvirt
+ vyos_format: box
+ vyos_vagrant_libvirt_box: /tmp/vyos_vagrant_libvirt_image.box
+ vyos_output_img: "{{ vyos_vagrant_libvirt_box }}"
roles:
- - common
- - vagrant-libvirt
+ - install-packages
+ - load-modules
+ - download-iso
+ - mount-iso
+ - get-version
+ - create-disk
+ - attach-loop-device
+ - setup-root-partition
+ - install-image
+ - mount-root-fs
+ - install-config
+ - install-grub
+ - install-persistence-conf
+ - unmount-all
+ - vagrant-libvirt-box
+ - release
diff --git a/vmware.yml b/vmware.yml
index 6095e7b..d0f6afe 100644
--- a/vmware.yml
+++ b/vmware.yml
@@ -1,8 +1,27 @@
---
- hosts: vmware
- become: True
- gather_facts: False
+ gather_facts: false
connection: local
+ vars:
+ vyos_platform: VMware
+ vyos_format: ova
+ vyos_vmdk_size: 10
+ vyos_vmware_ova: /tmp/vyos_vmware_image.ova
+ vyos_output_img: "{{ vyos_vmware_ova }}"
roles:
- - common
- - vmware
+ - install-packages
+ - load-modules
+ - download-iso
+ - mount-iso
+ - get-version
+ - create-disk
+ - attach-loop-device
+ - setup-root-partition
+ - install-image
+ - mount-root-fs
+ - install-config
+ - install-grub
+ - install-persistence-conf
+ - unmount-all
+ - vmware-ova
+ - release