Adds docker installation steps (#15)

This commit is contained in:
Chris Houseknecht
2017-08-31 22:21:25 -04:00
committed by GitHub
parent c1ffa6e5d9
commit e2a0fd7b0b
10 changed files with 445 additions and 54 deletions

View File

@@ -0,0 +1,15 @@
# check_docker.yml
---
- name: postgres_data_dir should be defined
assert:
that:
- postgres_data_dir is defined and postgres_data_dir != ''
msg: "Set the value of 'postgres_data_dir' in the inventory file."
when: pg_hostname is not defined or pg_hostname == ''
- name: host_port should be defined
assert:
that:
- host_port is defined and host_port != ''
msg: "Set the value of 'host_port' in the inventory file."

View File

@@ -0,0 +1,49 @@
# check_openshift.yml
---
- name: awx_openshift_project should be defined
assert:
that:
- awx_openshift_project is defined and awx_openshift_project != ''
msg: "Set the value of 'awx_openshift_project' in the inventory file."
- name: openshift_user should be defined
assert:
that:
- openshift_user is defined and openshift_user != ''
msg: "Set the value of 'openshift_user' in the inventory file."
- name: openshift_password should be defined
assert:
that:
- openshift_password is defined and openshift_password != ''
msg: "Set the value of 'openshift_password' in the inventory file."
- name: awx_node_port should be defined
assert:
that:
- awx_node_port is defined and awx_node_port != ''
msg: "Set the value of 'awx_node_port' in the inventory file."
- name: docker_registry should be defined
assert:
that:
- docker_registry is defined and docker_registry != ''
msg: "Set the value of 'docker_registry' in the inventory file."
- name: docker_registry_repository should be defined
assert:
that:
- docker_registry_repository is defined and docker_registry_repository != ''
msg: "Set the value of 'docker_registry_repository' in the inventory file."
- name: docker_registry_username should be defined
assert:
that:
- docker_registry_username is defined and docker_registry_username != ''
msg: "Set the value of 'docker_registry_username' in the inventory file."
- name: docker_registry_password should be defined
assert:
that:
- docker_registry_password is defined and docker_registry_password != ''
msg: "Set the value of 'docker_registry_password' in the inventory file."

View File

@@ -0,0 +1,9 @@
# main.yml
---
- include: check_openshift.yml
when: openshift_host is defined and openshift_host != ''
- include: check_docker.yml
when: openshift_host is not defined or openshift_host == ''

View File

@@ -34,17 +34,25 @@
debug:
msg: "{{ awx_sdist_file }}"
- name: Stat distribution file
stat:
path: "../dist/{{ awx_sdist_file }}"
delegate_to: localhost
register: sdist
- name: Clean distribution
shell: make clean
args:
chdir: ..
ignore_errors: yes
when: not sdist.stat.exists
delegate_to: localhost
- name: Build AWX distribution
shell: make sdist
args:
chdir: ..
creates: "../dist/{{ awx_sdist_file }}"
creates: "./dist/{{ awx_sdist_file }}"
delegate_to: localhost
- name: Set docker build base path
@@ -155,3 +163,4 @@
path: "{{ docker_base_path }}"
state: absent
when: cleanup_docker_base|default(True)
delegate_to: localhost

View File

@@ -1,8 +1,10 @@
---
- hosts: all
- name: Build and deploy AWX
hosts: all
gather_facts: false
roles:
- { role: check_vars }
- { role: image_build }
- { role: openshift, when: "openshift_host is defined" }
- { role: local_docker, when: "openshift_host is not defined" }

View File

@@ -3,12 +3,12 @@ localhost ansible_connection=local
[all:vars]
# Build AWX with official logos
# Agree to acceptance of trademark guidelines
# Requires awx-logos be checked out in the directory containing the awx repository
# Requires cloning awx-logos repo into the project root.
# Review the trademark guidelines at https://github.com/ansible/awx-logos/blob/master/TRADEMARKS.md
awx_official=false
# Local Openshift
# Will need to set -e openshift_password=developer -e docker_registry_password=$(oc whoami -t)
# Openshift Install
# Will need to set -e openshift_password=developer -e docker_registry_password=$(oc whoami -t)
#
# openshift_host=127.0.0.1:8443
# awx_openshift_project=awx
@@ -26,8 +26,8 @@ host_port=80
# docker_registry_repository=awx
# docker_registry_username=developer
# Set this if you have an external postgres you are pointing at
# otherwise a new ephemeral awx postgres service will be created
# Set pg_hostname if you have an external postgres server, otherwise
# a new ephemeral postgres service will be created
# pg_hostname=postgresql
pg_username=awx
pg_password=awxpass

View File

@@ -1,11 +1,10 @@
---
- name: Export Docker web image if it isnt local and there isnt a registry defined
docker_image:
name: "{{ awx_web_image }}"
tag: "{{ awx_version }}"
archive_path: "{{ awx_local_base_config_path|default('/tmp') }}/{{ awx_web_image }}_{{ awx_version }}.tar"
when: ansible_connection != "local" and docker_registry is not defined
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
@@ -13,7 +12,7 @@
name: "{{ awx_task_image }}"
tag: "{{ awx_version }}"
archive_path: "{{ awx_local_base_config_path|default('/tmp') }}/{{ awx_task_image }}_{{ awx_version }}.tar"
when: ansible_connection != "local" and docker_registry is not defined
when: inventory_hostname != "localhost" and docker_registry is not defined
delegate_to: localhost
- name: Authenticate with Docker registry if registry password given
@@ -53,6 +52,7 @@
name: "{{ awx_web_image }}"
tag: "{{ awx_version }}"
load_path: "{{ docker_deploy_base_path }}/{{ awx_web_image }}_{{ awx_version }}.tar"
timeout: 300
when: ansible_connection != "local" and docker_registry is not defined
- name: Load task image
@@ -60,6 +60,7 @@
name: "{{ awx_task_image }}"
tag: "{{ awx_version }}"
load_path: "{{ docker_deploy_base_path }}/{{ awx_task_image }}_{{ awx_version }}.tar"
timeout: 300
when: ansible_connection != "local" and docker_registry is not defined
- name: Tag and push web image to registry