Merge "Option to upload Octavia amphora img in RAW format"
This commit is contained in:
commit
b5f6770b9e
@ -6,6 +6,7 @@
|
|||||||
amp_ssh_key_name: "{{ amp_ssh_key_name }}"
|
amp_ssh_key_name: "{{ amp_ssh_key_name }}"
|
||||||
amp_ssh_key_path: "{{ amp_ssh_key_path }}"
|
amp_ssh_key_path: "{{ amp_ssh_key_path }}"
|
||||||
amp_ssh_key_data: "{{ amp_ssh_key_data }}"
|
amp_ssh_key_data: "{{ amp_ssh_key_data }}"
|
||||||
|
amp_to_raw: "{{ amp_to_raw | bool }}"
|
||||||
auth_username: "{{ auth_username }}"
|
auth_username: "{{ auth_username }}"
|
||||||
auth_pasword: "{{ auth_password }}"
|
auth_pasword: "{{ auth_password }}"
|
||||||
auth_project_name: "{{ auth_project_name }}"
|
auth_project_name: "{{ auth_project_name }}"
|
||||||
|
@ -4,6 +4,7 @@ amp_image_filename: ""
|
|||||||
amp_image_tag: "amphora-image"
|
amp_image_tag: "amphora-image"
|
||||||
amp_ssh_key_name: "octavia-ssh-key"
|
amp_ssh_key_name: "octavia-ssh-key"
|
||||||
amp_ssh_key_path: ""
|
amp_ssh_key_path: ""
|
||||||
|
amp_to_raw: False
|
||||||
auth_username: "octavia"
|
auth_username: "octavia"
|
||||||
auth_project_name: "service"
|
auth_project_name: "service"
|
||||||
lb_mgmt_net_name: "lb-mgmt-net"
|
lb_mgmt_net_name: "lb-mgmt-net"
|
||||||
|
@ -48,10 +48,37 @@
|
|||||||
upload_image: true
|
upload_image: true
|
||||||
when: current_md5 is not defined or replace_image
|
when: current_md5 is not defined or replace_image
|
||||||
|
|
||||||
|
- block:
|
||||||
|
- name: create temporary directory
|
||||||
|
tempfile:
|
||||||
|
state: directory
|
||||||
|
register: amp_tmp_dir
|
||||||
|
|
||||||
|
- name: set RAW file name
|
||||||
|
set_fact:
|
||||||
|
raw_filename: "{{ amp_tmp_dir.path }}/{{ image_filename|splitext|first|basename }}.img"
|
||||||
|
|
||||||
|
- name: convert image from qcow2 to raw
|
||||||
|
shell: |
|
||||||
|
qemu-img convert -f qcow2 -O raw {{ image_filename }} {{ raw_filename }}
|
||||||
|
|
||||||
|
- name: setting amphora format to raw
|
||||||
|
set_fact:
|
||||||
|
raw_format: raw
|
||||||
|
when: amp_to_raw
|
||||||
|
|
||||||
- name: upload image to glance
|
- name: upload image to glance
|
||||||
shell: |
|
shell: |
|
||||||
openstack image create --disk-format qcow2 --container-format bare --tag {{ amp_image_tag }} \
|
openstack image create --disk-format {{ raw_format|default('qcow2') }} \
|
||||||
--file {{ image_filename }} {{ amphora_image }}
|
--container-format bare --tag {{ amp_image_tag }} \
|
||||||
|
--file {{ raw_filename|default(image_filename) }} \
|
||||||
|
{{ amphora_image }}
|
||||||
register: image_result
|
register: image_result
|
||||||
changed_when: "image_result.stdout != ''"
|
changed_when: "image_result.stdout != ''"
|
||||||
when: image_file_result.stat.exists and upload_image is defined
|
when: image_file_result.stat.exists and upload_image is defined
|
||||||
|
|
||||||
|
- name: delete converted raw image
|
||||||
|
file:
|
||||||
|
path: "{{ amp_tmp_dir.path }}"
|
||||||
|
state: absent
|
||||||
|
when: amp_to_raw
|
||||||
|
@ -14,6 +14,7 @@ workflows:
|
|||||||
- amp_ssh_key_name
|
- amp_ssh_key_name
|
||||||
- amp_ssh_key_path
|
- amp_ssh_key_path
|
||||||
- amp_ssh_key_data
|
- amp_ssh_key_data
|
||||||
|
- amp_to_raw
|
||||||
- auth_username
|
- auth_username
|
||||||
- auth_password
|
- auth_password
|
||||||
- auth_project_name
|
- auth_project_name
|
||||||
@ -103,6 +104,7 @@ workflows:
|
|||||||
amp_ssh_key_name: <% $.amp_ssh_key_name %>
|
amp_ssh_key_name: <% $.amp_ssh_key_name %>
|
||||||
amp_ssh_key_path: <% $.amp_ssh_key_path %>
|
amp_ssh_key_path: <% $.amp_ssh_key_path %>
|
||||||
amp_ssh_key_data: <% $.amp_ssh_key_data %>
|
amp_ssh_key_data: <% $.amp_ssh_key_data %>
|
||||||
|
amp_to_raw: <% $.amp_to_raw %>
|
||||||
auth_username: <% $.auth_username %>
|
auth_username: <% $.auth_username %>
|
||||||
auth_password: <% $.auth_password %>
|
auth_password: <% $.auth_password %>
|
||||||
auth_project_name: <% $.auth_project_name %>
|
auth_project_name: <% $.auth_project_name %>
|
||||||
|
Loading…
Reference in New Issue
Block a user