mirror of
https://github.com/ansible/awx.git
synced 2026-05-10 10:57:35 -02:30
Consolidate the Local Docker installer and the dev env
- removes local_docker installer and points community users to our development environment (make docker-compose) - provides a migration path from Local Docker Compose installations --> the dev environment - the dev env can now be configured to use an external database - consolidated the Local Docker and dev env docker-compose.yml files into one template file, used by the dockerfile role - added a 'sources' role to template out config files - the postgres data dir is no longer a bind-mount, it is a docker volume - the redis socket is not longer a bind-mount, it is a docker volume - the local_settings.py.docker-compose file no longer needs to be copied over in the dev env - Create tmp rsyslog.conf in rsyslog volume to avoid cross-linking. Previously, the tmp code-generated rsyslog.conf was being written to /tmp (by default). As a result, we were attempting to shutil.move() across volumes. - move k8s image build and push roles under tools/ansible - See tools/docker-compose/README.md for usage of these changes
This commit is contained in:
76
tools/docker-compose/ansible/roles/sources/tasks/main.yml
Normal file
76
tools/docker-compose/ansible/roles/sources/tasks/main.yml
Normal file
@@ -0,0 +1,76 @@
|
||||
---
|
||||
|
||||
- name: Create _sources directory
|
||||
file:
|
||||
path: "{{ sources_dest }}/secrets"
|
||||
state: 'directory'
|
||||
mode: '0700'
|
||||
|
||||
- name: Detect secrets
|
||||
stat:
|
||||
path: "{{ sources_dest }}/secrets/{{ item }}.yml"
|
||||
register: secrets
|
||||
when: not lookup('vars', item, default='')
|
||||
loop:
|
||||
- pg_password
|
||||
- secret_key
|
||||
- broadcast_websocket_secret
|
||||
|
||||
- name: Generate secrets if needed
|
||||
template:
|
||||
src: 'secrets.yml.j2'
|
||||
dest: '{{ sources_dest }}/secrets/{{ item.item }}.yml'
|
||||
mode: '0600'
|
||||
when: not lookup('vars', item.item, default='') and not item.stat.exists
|
||||
loop: "{{ secrets.results }}"
|
||||
|
||||
- name: Include generated secrets unless they are explicitly passed in
|
||||
include_vars: "{{ sources_dest }}/secrets/{{ item.item }}.yml"
|
||||
no_log: true
|
||||
when: not lookup('vars', item.item, default='')
|
||||
loop: "{{ secrets.results }}"
|
||||
|
||||
- name: Render configuration templates
|
||||
template:
|
||||
src: "{{ item }}.j2"
|
||||
dest: "{{ sources_dest }}/{{ item }}"
|
||||
mode: '0600'
|
||||
with_items:
|
||||
- "database.py"
|
||||
- "websocket_secret.py"
|
||||
|
||||
- name: Delete old local_settings.py
|
||||
file:
|
||||
path: "{{ playbook_dir }}/../../../awx/settings/local_settings.py"
|
||||
state: absent
|
||||
|
||||
- name: Copy local_settings.py
|
||||
copy:
|
||||
src: "local_settings.py"
|
||||
dest: "{{ sources_dest }}/local_settings.py"
|
||||
|
||||
- name: Get OS info for sdb
|
||||
shell: |
|
||||
docker info | grep 'Operating System'
|
||||
register: os_info
|
||||
changed_when: false
|
||||
|
||||
- name: Get user UID
|
||||
shell: id -u
|
||||
register: current_user
|
||||
changed_when: false
|
||||
|
||||
- name: Set fact with user UID
|
||||
set_fact:
|
||||
user_id: "'{{ current_user.stdout }}'"
|
||||
|
||||
- name: Set global version if not provided
|
||||
set_fact:
|
||||
awx_image_tag: "{{ lookup('file', playbook_dir + '/../../../VERSION') }}"
|
||||
when: awx_image_tag is not defined
|
||||
|
||||
- name: Render Docker-Compose
|
||||
template:
|
||||
src: docker-compose.yml.j2
|
||||
dest: "{{ sources_dest }}/{{ compose_name }}"
|
||||
mode: '0600'
|
||||
Reference in New Issue
Block a user