summaryrefslogtreecommitdiffstats
path: root/installer/roles/local_docker/tasks/set_image.yml
blob: 4442da16176009e7df7c72d0fa3659e796bbdc6e (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
---
- name: Manage AWX Container Images
  block:
    - name: Export Docker web image if it isnt local and there isnt a registry defined
      docker_image:
        name: "{{ web_image }}"
        tag: "{{ awx_version }}"
        archive_path: "{{ awx_local_base_config_path|default('/tmp') }}/{{ web_image }}_{{ awx_version }}.tar"
      when: inventory_hostname != "localhost" and docker_registry is not defined
      delegate_to: localhost

    - name: Export Docker task image if it isnt local and there isnt a registry defined
      docker_image:
        name: "{{ task_image }}"
        tag: "{{ awx_version }}"
        archive_path: "{{ awx_local_base_config_path|default('/tmp') }}/{{ task_image }}_{{ awx_version }}.tar"
      when: inventory_hostname != "localhost" and docker_registry is not defined
      delegate_to: localhost

    - name: Set docker base path
      set_fact:
        docker_deploy_base_path: "{{ awx_base_path|default('/tmp') }}/docker_deploy"
      when: ansible_connection != "local" and docker_registry is not defined

    - name: Ensure directory exists
      file:
        path: "{{ docker_deploy_base_path }}"
        state: directory
      when: ansible_connection != "local" and docker_registry is not defined

    - name: Copy web image to docker execution
      copy:
        src: "{{ awx_local_base_config_path|default('/tmp') }}/{{ web_image }}_{{ awx_version }}.tar"
        dest: "{{ docker_deploy_base_path }}/{{ web_image }}_{{ awx_version }}.tar"
      when: ansible_connection != "local" and docker_registry is not defined

    - name: Copy task image to docker execution
      copy:
        src: "{{ awx_local_base_config_path|default('/tmp') }}/{{ task_image }}_{{ awx_version }}.tar"
        dest: "{{ docker_deploy_base_path }}"
      when: ansible_connection != "local" and docker_registry is not defined

    - name: Load web image
      docker_image:
        name: "{{ web_image }}"
        tag: "{{ awx_version }}"
        load_path: "{{ docker_deploy_base_path }}/{{ web_image }}_{{ awx_version }}.tar"
        timeout: 300
      when: ansible_connection != "local" and docker_registry is not defined

    - name: Load task image
      docker_image:
        name: "{{ task_image }}"
        tag: "{{ awx_version }}"
        load_path: "{{ docker_deploy_base_path }}/{{ task_image }}_{{ awx_version }}.tar"
        timeout: 300
      when: ansible_connection != "local" and docker_registry is not defined

    - name: Set full image path for local install
      set_fact:
        awx_web_docker_actual_image: "{{ web_image }}:{{ awx_version }}"
        awx_task_docker_actual_image: "{{ task_image }}:{{ awx_version }}"
      when: docker_registry is not defined
  when: dockerhub_base is not defined

- name: Set DockerHub Image Paths
  set_fact:
    awx_web_docker_actual_image: "{{ dockerhub_base }}/awx_web:{{ dockerhub_version }}"
    awx_task_docker_actual_image: "{{ dockerhub_base }}/awx_task:{{ dockerhub_version }}"
  when: dockerhub_base is defined