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
This commit is contained in:
Shane McDonald
2021-10-12 18:50:25 -04:00
parent 84ffa4a5b7
commit c9b53cf975
8 changed files with 68 additions and 45 deletions

View File

@@ -2,7 +2,24 @@
- name: Build AWX Docker Images
hosts: localhost
gather_facts: true
roles:
- {role: dockerfile}
- {role: image_build}
- {role: image_push, when: "docker_registry is defined"}
tasks:
- name: Get version from SCM if not explicitly provided
shell: |
python setup.py --version | cut -d + -f -1
args:
chdir: '../../'
register: setup_py_version
when: awx_version is not defined
- name: Set awx_version
set_fact:
awx_version: "{{ setup_py_version.stdout }}"
when: awx_version is not defined
- include_role:
name: dockerfile
- include_role:
name: image_build
- include_role:
name: image_push
when: push | default(false) | bool