-
Notifications
You must be signed in to change notification settings - Fork 0
/
promote.yaml
56 lines (51 loc) · 2.31 KB
/
promote.yaml
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
48
49
50
51
52
53
54
55
56
---
- hosts: localhost
vars:
www_dir: /var/www/bsd-cloud-image.org/images
dest_dir: '{{ www_dir }}/{{ image_os }}/{{ image_version }}'
qcow2_swift_path: "images/{{ image_os }}/{{ image_version}}/{{ ansible_date_time.date }}/{{ root_fs }}/{{ final_name }}-{{ ansible_date_time.date }}.qcow2"
yaml_swift_path: "images/{{ image_os }}/{{ image_version}}/{{ ansible_date_time.date }}/{{ root_fs }}/{{ final_name }}-{{ ansible_date_time.date }}.yaml"
tasks:
- file:
path: '{{ dest_dir }}'
state: directory
recurse: true
become: true
- name: Promote the new image Virt-Lightning (1/4)
command: 'mv /var/lib/virt-lightning/pool/upstream/{{ final_name }}_exp.qcow2 {{ dest_dir }}/{{ final_name }}.qcow2'
become: true
- name: Promote the new image Virt-Lightning (yaml) (2/4)
command: 'mv /var/lib/virt-lightning/pool/upstream/{{ final_name }}_exp.yaml {{ dest_dir }}/{{ final_name }}.yaml'
become: true
- name: Promote the new image Virt-Lightning (3/4)
command: 'cp {{ dest_dir }}/{{ final_name }}.qcow2 /var/lib/virt-lightning/pool/upstream/{{ final_name }}.qcow2'
become: true
- name: Promote the new image Virt-Lightning (yaml) (4/4)
command: 'cp {{ dest_dir }}/{{ final_name }}.yaml /var/lib/virt-lightning/pool/upstream/{{ final_name }}.yaml'
become: true
- name: Fix the ownership of the target dir Virt-Lightning
file:
path: '{{ dest_dir }}'
state: directory
recurse: yes
owner: goneri
group: goneri
become: true
- name: upload the qcow2 file
openstack.cloud.object:
container: bsd-cloud-image.org
name: "{{ qcow2_swift_path }}"
filename: '/var/lib/virt-lightning/pool/upstream/{{ final_name }}.qcow2'
register: result
until: result is not failed
retries: 3
- name: upload the YAML file
openstack.cloud.object:
container: bsd-cloud-image.org
name: "{{ yaml_swift_path }}"
filename: '/var/lib/virt-lightning/pool/upstream/{{ final_name }}.yaml'
register: result
until: result is not failed
retries: 3
- debug:
msg: "Image availabe at: https://object-storage.public.mtl1.vexxhost.net/swift/v1/1dbafeefbd4f4c80864414a441e72dd2/bsd-cloud-image.org/{{ qcow2_swift_path }}"