mirror of
https://github.com/ansible/awx.git
synced 2026-02-20 20:50:06 -03:30
129 lines
3.3 KiB
YAML
129 lines
3.3 KiB
YAML
---
|
|
- name: Set global version if not provided
|
|
set_fact:
|
|
awx_version: "{{ lookup('file', playbook_dir + '/../VERSION') }}"
|
|
when: awx_version is not defined
|
|
|
|
- name: Verify awx-logos directory exists for official install
|
|
stat:
|
|
path: "../../awx-logos"
|
|
delegate_to: localhost
|
|
register: logosdir
|
|
failed_when: logosdir.stat.isdir is not defined or not logosdir.stat.isdir
|
|
when: awx_official|default(false)|bool
|
|
|
|
- name: Copy logos for inclusion in sdist
|
|
copy:
|
|
src: "../../awx-logos/awx/ui/client/assets/"
|
|
dest: "../awx/ui_next/public/static/media/"
|
|
delegate_to: localhost
|
|
when: awx_official|default(false)|bool
|
|
|
|
- name: Set sdist file name
|
|
set_fact:
|
|
awx_sdist_file: "awx-{{ awx_version }}.tar.gz"
|
|
|
|
- name: AWX Distribution
|
|
debug:
|
|
msg: "{{ awx_sdist_file }}"
|
|
|
|
- name: Stat distribution file
|
|
stat:
|
|
path: "../dist/{{ awx_sdist_file }}"
|
|
delegate_to: localhost
|
|
register: sdist
|
|
|
|
- name: Clean distribution
|
|
command: make clean
|
|
args:
|
|
chdir: ..
|
|
ignore_errors: true
|
|
when: not sdist.stat.exists
|
|
delegate_to: localhost
|
|
|
|
- name: Build sdist builder image
|
|
docker_image:
|
|
build:
|
|
path: "{{ role_path }}/files"
|
|
dockerfile: Dockerfile.sdist
|
|
pull: false
|
|
args:
|
|
http_proxy: "{{ http_proxy | default('') }}"
|
|
https_proxy: "{{ https_proxy | default('') }}"
|
|
no_proxy: "{{ no_proxy | default('') }}"
|
|
name: awx_sdist_builder
|
|
tag: "{{ awx_version }}"
|
|
source: 'build'
|
|
force_source: true
|
|
delegate_to: localhost
|
|
when: use_container_for_build|default(true)|bool
|
|
|
|
- name: Get current uid
|
|
command: id -u
|
|
register: uid
|
|
|
|
- name: Build AWX distribution using container
|
|
docker_container:
|
|
env:
|
|
http_proxy: "{{ http_proxy | default('') }}"
|
|
https_proxy: "{{ https_proxy | default('') }}"
|
|
no_proxy: "{{ no_proxy | default('') }}"
|
|
image: "awx_sdist_builder:{{ awx_version }}"
|
|
name: awx_sdist_builder
|
|
state: started
|
|
user: "{{ uid.stdout }}"
|
|
detach: false
|
|
volumes:
|
|
- ../:/awx:Z
|
|
delegate_to: localhost
|
|
when: use_container_for_build|default(true)|bool
|
|
|
|
- name: Build AWX distribution locally
|
|
command: make sdist
|
|
args:
|
|
chdir: ..
|
|
delegate_to: localhost
|
|
when: not use_container_for_build|default(true)|bool
|
|
|
|
- name: Set docker build base path
|
|
set_fact:
|
|
docker_base_path: "{{ awx_local_base_config_path|default('/tmp') }}/docker-image"
|
|
|
|
- name: Set awx image name
|
|
set_fact:
|
|
awx_image: "{{ awx_image|default('awx') }}"
|
|
|
|
- name: Render Dockerfile
|
|
template:
|
|
src: Dockerfile.j2
|
|
dest: ../Dockerfile
|
|
|
|
- name: Build base awx image
|
|
docker_image:
|
|
build:
|
|
path: ".."
|
|
dockerfile: Dockerfile
|
|
pull: false
|
|
args:
|
|
http_proxy: "{{ http_proxy | default('') }}"
|
|
https_proxy: "{{ https_proxy | default('') }}"
|
|
no_proxy: "{{ no_proxy | default('') }}"
|
|
name: "{{ awx_image }}"
|
|
tag: "{{ awx_version }}"
|
|
source: 'build'
|
|
force_source: true
|
|
delegate_to: localhost
|
|
|
|
- name: Tag awx images as latest
|
|
command: "docker tag {{ item }}:{{ awx_version }} {{ item }}:latest"
|
|
delegate_to: localhost
|
|
with_items:
|
|
- "{{ awx_image }}"
|
|
|
|
- name: Clean docker base directory
|
|
file:
|
|
path: "{{ docker_base_path }}"
|
|
state: absent
|
|
when: cleanup_docker_base|default(True)|bool
|
|
delegate_to: localhost
|