| 1 | --- |
| 2 | - name: Manage AWX Container Images |
| 3 | block: |
| 4 | - name: Export Docker AWX image if it isn't local and there isn't a registry defined |
| 5 | docker_image: |
| 6 | name: "{{ awx_image }}" |
| 7 | tag: "{{ awx_version }}" |
| 8 | archive_path: "{{ awx_local_base_config_path|default('/tmp') }}/{{ awx_image }}_{{ awx_version }}.tar" |
| 9 | when: inventory_hostname != "localhost" and docker_registry is not defined |
| 10 | delegate_to: localhost |
| 11 | |
| 12 | - name: Set docker base path |
| 13 | set_fact: |
| 14 | docker_deploy_base_path: "{{ awx_base_path|default('/tmp') }}/docker_deploy" |
| 15 | when: ansible_connection != "local" and docker_registry is not defined |
| 16 | |
| 17 | - name: Ensure directory exists |
| 18 | file: |
| 19 | path: "{{ docker_deploy_base_path }}" |
| 20 | state: directory |
| 21 | when: ansible_connection != "local" and docker_registry is not defined |
| 22 | |
| 23 | - name: Copy awx image to docker execution |
| 24 | copy: |
| 25 | src: "{{ awx_local_base_config_path|default('/tmp') }}/{{ awx_image }}_{{ awx_version }}.tar" |
| 26 | dest: "{{ docker_deploy_base_path }}/{{ awx_image }}_{{ awx_version }}.tar" |
| 27 | when: ansible_connection != "local" and docker_registry is not defined |
| 28 | |
| 29 | - name: Load awx image |
| 30 | docker_image: |
| 31 | name: "{{ awx_image }}" |
| 32 | tag: "{{ awx_version }}" |
| 33 | load_path: "{{ docker_deploy_base_path }}/{{ awx_image }}_{{ awx_version }}.tar" |
| 34 | timeout: 300 |
| 35 | when: ansible_connection != "local" and docker_registry is not defined |
| 36 | |
| 37 | - name: Set full image path for local install |
| 38 | set_fact: |
| 39 | awx_docker_actual_image: "{{ awx_image }}:{{ awx_version }}" |
| 40 | when: docker_registry is not defined |
| 41 | when: dockerhub_base is not defined |
| 42 | |
| 43 | - name: Set DockerHub Image Paths |
| 44 | set_fact: |
| 45 | awx_docker_actual_image: "{{ dockerhub_base }}/awx:{{ dockerhub_version }}" |
| 46 | when: dockerhub_base is defined |