summaryrefslogtreecommitdiffstats
path: root/lib/ansible/playbooks/prepare_overcloud_containers.yml
blob: db1bff89ea9fc51a1839215c00b35d9142576804 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
---
- hosts: all
  tasks:
    - name: Upload container patches archive
      copy:
        src: "{{ apex_temp_dir }}/docker_patches.tar.gz"
        dest: "/home/stack/docker_patches.tar.gz"
        owner: stack
        group: stack
        mode: 0644
      when: patched_docker_services|length > 0
    - name: Unpack container patches archive
      unarchive:
        src: /home/stack/docker_patches.tar.gz
        remote_src: yes
        list_files: yes
        group: stack
        owner: stack
        dest: /home/stack/
      when: patched_docker_services|length > 0
    - name: Prepare generic docker registry image file
      shell: >
        sudo openstack tripleo container image prepare
        -e /home/stack/containers-prepare-parameter.yaml
        --output-env-file docker-images.yaml
    - name: Collect docker images in registry
      uri:
        url: http://{{ undercloud_ip }}:8787/v2/_catalog
        body_format: json
      register: response
    - include_tasks: patch_containers.yml
      with_items: "{{ patched_docker_services }}"
      loop_control:
        loop_var: item
      when:
        - patched_docker_services|length > 0
        - item in (response.json)['repositories']|join(" ")
    - name: Push patched docker images to local registry
      shell: docker push {{ undercloud_ip }}:8787/tripleo{{ os_version }}/centos-binary-{{ item }}:apex
      when:
        - patched_docker_services|length > 0
        - item in (response.json)['repositories']|join(" ")
      with_items: "{{ patched_docker_services }}"
    - name: Modify Images with Apex tag
      replace:
        path: "/home/stack/docker-images.yaml"
        regexp: "(\\s*Docker.*?:.*?centos-binary-{{ item }}):.*"
        replace: '\1:apex'
      with_items: "{{ patched_docker_services }}"
      become: yes