Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor image_build and image_push roles
Primary changes are: - Generalized variable names (remove "docker") - Add explicit "push" variable rather than checking if the "registry" variable is defined. - Allow for passing in version as build arg
- Loading branch information
Showing
8 changed files
with
68 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
awx/ui/node_modules | ||
Dockerfile | ||
.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
--- | ||
awx_image: quay.io/ansible/awx | ||
awx_image: ansible/awx | ||
awx_image_tag: "{{ awx_version }}" | ||
dockerfile_name: 'Dockerfile' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
registry: quay.io | ||
awx_image: ansible/awx | ||
awx_image_tag: "{{ awx_version }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,22 @@ | ||
--- | ||
- name: Authenticate with Docker registry if registry password given | ||
docker_login: | ||
registry: "{{ docker_registry }}" | ||
username: "{{ docker_registry_username }}" | ||
password: "{{ docker_registry_password }}" | ||
registry: "{{ registry }}" | ||
username: "{{ registry_username }}" | ||
password: "{{ registry_password }}" | ||
reauthorize: true | ||
when: docker_registry is defined and docker_registry_password is defined | ||
|
||
- name: Remove local images to ensure proper push behavior | ||
block: | ||
- name: Remove awx image | ||
docker_image: | ||
name: "{{ docker_registry }}/{{ docker_registry_repository }}/{{ awx_image }}" | ||
tag: "{{ awx_version }}" | ||
state: absent | ||
when: | ||
- registry is defined | ||
- registry_username is defined | ||
- registry_password is defined | ||
|
||
- name: Tag and Push Container Images | ||
block: | ||
- name: Tag and push awx image to registry | ||
docker_image: | ||
name: "{{ awx_image }}" | ||
repository: "{{ docker_registry }}/{{ docker_registry_repository }}/{{ awx_image }}" | ||
tag: "{{ item }}" | ||
push: true | ||
with_items: | ||
- "latest" | ||
- "{{ awx_version }}" | ||
|
||
- name: Set full image path for Registry | ||
set_fact: | ||
awx_docker_actual_image: >- | ||
{{ docker_registry }}/{{ docker_registry_repository }}/{{ awx_image }}:{{ awx_version }} | ||
docker_image: | ||
name: "{{ awx_image }}:{{ awx_version }}" | ||
repository: "{{ registry }}/{{ awx_image }}:{{ item }}" | ||
force_tag: yes | ||
push: true | ||
source: local | ||
with_items: | ||
- "latest" | ||
- "{{ awx_version }}" |