diff options
author | Yuya Kusakabe <yuya.kusakabe@gmail.com> | 2018-06-22 00:06:14 +0900 |
---|---|---|
committer | Yuya Kusakabe <yuya.kusakabe@gmail.com> | 2018-06-22 00:06:14 +0900 |
commit | a941d7972609f859f4de6d3fd6f6ceb6c065a94b (patch) | |
tree | 1a92c0a55d3b10c5d77b08e9e389b9251d4262f4 | |
parent | 82bf954d00bcf4c875996db86a4963cf2026c8ac (diff) | |
download | vyos-vm-images-a941d7972609f859f4de6d3fd6f6ceb6c065a94b.tar.gz vyos-vm-images-a941d7972609f859f4de6d3fd6f6ceb6c065a94b.zip |
Add release tasks
-rw-r--r-- | library/hosts | 5 | ||||
-rw-r--r-- | roles/hyperv/tasks/convert.yml | 3 | ||||
-rw-r--r-- | roles/hyperv/tasks/main.yml | 2 | ||||
-rw-r--r-- | roles/hyperv/tasks/release.yml | 6 | ||||
-rw-r--r-- | roles/qemu/tasks/convert.yml | 3 | ||||
-rw-r--r-- | roles/qemu/tasks/main.yml | 2 | ||||
-rw-r--r-- | roles/qemu/tasks/release.yml | 6 | ||||
-rw-r--r-- | roles/vagrant-libvirt/tasks/convert.yml | 5 | ||||
-rw-r--r-- | roles/vagrant-libvirt/tasks/main.yml | 2 | ||||
-rw-r--r-- | roles/vagrant-libvirt/tasks/release.yml | 29 | ||||
-rw-r--r-- | roles/vagrant-libvirt/vars/main.yml | 1 | ||||
-rw-r--r-- | roles/vmware/tasks/convert.yml | 4 | ||||
-rw-r--r-- | roles/vmware/tasks/main.yml | 2 | ||||
-rw-r--r-- | roles/vmware/tasks/release.yml | 6 |
14 files changed, 54 insertions, 22 deletions
diff --git a/library/hosts b/library/hosts deleted file mode 100644 index 5fd0150..0000000 --- a/library/hosts +++ /dev/null @@ -1,5 +0,0 @@ -[local] -localhost - -[qemu] -localhost diff --git a/roles/hyperv/tasks/convert.yml b/roles/hyperv/tasks/convert.yml index 99af9c1..7d118f7 100644 --- a/roles/hyperv/tasks/convert.yml +++ b/roles/hyperv/tasks/convert.yml @@ -1,5 +1,2 @@ - name: Convert raw to vhd command: qemu-img convert -f raw "{{ vyos_raw_img }}" -O vpc "{{ vyos_hyperv_img }}" -- name: Copy image - become: false - command: cp "{{ vyos_hyperv_img }}" . diff --git a/roles/hyperv/tasks/main.yml b/roles/hyperv/tasks/main.yml index 611a6d3..e857382 100644 --- a/roles/hyperv/tasks/main.yml +++ b/roles/hyperv/tasks/main.yml @@ -4,4 +4,4 @@ - 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 new file mode 100644 index 0000000..4ad34c6 --- /dev/null +++ b/roles/hyperv/tasks/release.yml @@ -0,0 +1,6 @@ +- 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/qemu/tasks/convert.yml b/roles/qemu/tasks/convert.yml index 7ed4ce9..c91c75b 100644 --- a/roles/qemu/tasks/convert.yml +++ b/roles/qemu/tasks/convert.yml @@ -1,5 +1,2 @@ - name: Convert raw to qcow2 command: qemu-img convert -f raw "{{ vyos_raw_img }}" -O qcow2 "{{ vyos_qemu_img }}" -- name: Copy image - become: false - command: cp "{{ vyos_qemu_img }}" . diff --git a/roles/qemu/tasks/main.yml b/roles/qemu/tasks/main.yml index 611a6d3..e857382 100644 --- a/roles/qemu/tasks/main.yml +++ b/roles/qemu/tasks/main.yml @@ -4,4 +4,4 @@ - 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 new file mode 100644 index 0000000..ea0412f --- /dev/null +++ b/roles/qemu/tasks/release.yml @@ -0,0 +1,6 @@ +- name: Release image + become: false + copy: + src: "{{ vyos_qemu_img }}" + dest: "{{ vyos_images_dir }}/vyos-{{ version_string.stdout }}-qemu-image.box" + when: vyos_images_dir is defined diff --git a/roles/vagrant-libvirt/tasks/convert.yml b/roles/vagrant-libvirt/tasks/convert.yml index d6de82f..ede229a 100644 --- a/roles/vagrant-libvirt/tasks/convert.yml +++ b/roles/vagrant-libvirt/tasks/convert.yml @@ -10,7 +10,7 @@ copy: src: "{{ vyos_vagrant_libvirt_vagrantfile }}" dest: "{{ vyos_vagrant_libvirt_tmp_vagrantfile }}" -- name: Create OVA with private key +- name: Create Vagrant box become: false archive: path: @@ -19,6 +19,3 @@ - "{{ vyos_vagrant_libvirt_tmp_vagrantfile }}" dest: "{{ vyos_vagrant_libvirt_box }}" format: tar -- name: Copy image - become: false - command: cp "{{ vyos_vagrant_libvirt_box }}" . diff --git a/roles/vagrant-libvirt/tasks/main.yml b/roles/vagrant-libvirt/tasks/main.yml index 611a6d3..e857382 100644 --- a/roles/vagrant-libvirt/tasks/main.yml +++ b/roles/vagrant-libvirt/tasks/main.yml @@ -4,4 +4,4 @@ - 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 new file mode 100644 index 0000000..7d2ca47 --- /dev/null +++ b/roles/vagrant-libvirt/tasks/release.yml @@ -0,0 +1,29 @@ +- 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 }}" + status_code: 201 + 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" + status_code: 201 + 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/vars/main.yml b/roles/vagrant-libvirt/vars/main.yml index e5c1712..1fe0af8 100644 --- a/roles/vagrant-libvirt/vars/main.yml +++ b/roles/vagrant-libvirt/vars/main.yml @@ -5,3 +5,4 @@ vyos_vagrant_libvirt_metadata: files/metadata.json vyos_vagrant_libvirt_vagrantfile: files/Vagrantfile vyos_vagrant_libvirt_tmp_metadata: /tmp/metadata.json vyos_vagrant_libvirt_tmp_vagrantfile: /tmp/Vagrantfile +vyos_vagrant_box_name: vyos/current diff --git a/roles/vmware/tasks/convert.yml b/roles/vmware/tasks/convert.yml index 39f4e8b..53c4989 100644 --- a/roles/vmware/tasks/convert.yml +++ b/roles/vmware/tasks/convert.yml @@ -53,6 +53,7 @@ content: | {{ signature.stdout }} {{ certificate.stdout }} + when: vyos_vmware_private_key_path is defined - name: Create OVA with private key become: false archive: @@ -64,6 +65,3 @@ dest: "{{ vyos_vmware_ova }}" format: tar when: vyos_vmware_private_key_path is defined -- name: Copy image - become: false - command: cp "{{ vyos_vmware_ova }}" . diff --git a/roles/vmware/tasks/main.yml b/roles/vmware/tasks/main.yml index 611a6d3..e857382 100644 --- a/roles/vmware/tasks/main.yml +++ b/roles/vmware/tasks/main.yml @@ -4,4 +4,4 @@ - 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 new file mode 100644 index 0000000..9487848 --- /dev/null +++ b/roles/vmware/tasks/release.yml @@ -0,0 +1,6 @@ +- 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 |