aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/glance/tasks/glance_config.yml
blob: e2390d0eded83c3163ea23dd8144ec8799d232a9 (plain)
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
---
- name: init glance db version
  shell: glance-manage db_version_control 0
  run_once: True
  when: ansible_os_family == "Debian"

- name: sync glance db
  shell: sleep 15; su -s /bin/sh -c "glance-manage db_sync" glance
  run_once: True
  register: result
  until: result.rc == 0
  retries: 5
  delay: 3
  notify:
    - restart glance services

- meta: flush_handlers

- name: place image upload script
  template: src=image_upload.sh dest=/opt/image_upload.sh mode=0744

- name: get image http server
  shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf
  register: http_server

- name: download cirros image file
  get_url: url="http://{{ http_server.stdout_lines[0] }}/image/{{ build_in_image_name }}"  dest=/opt/{{ build_in_image_name }}

- name: wait for 9292 port to become available
  wait_for: host={{ image_host }} port=9292 delay=5

- name: run image upload
  run_once: True
  shell: for i in {0..5}; do /opt/image_upload.sh && touch image_upload_completed; if [ $? != 0 ] ;then sleep 5; else break;fi;done
  args:
    creates: image_upload_completed