mirror of
https://github.com/ansible/awx.git
synced 2026-02-23 22:16:00 -03:30
Allow for dynamically scaling automation mesh in dev env
This commit is contained in:
committed by
Alan Rominger
parent
9881bb72b8
commit
460c7c3379
@@ -5,5 +5,5 @@ awx_image: 'quay.io/ansible/awx_devel'
|
||||
pg_port: 5432
|
||||
pg_username: 'awx'
|
||||
pg_database: 'awx'
|
||||
cluster_node_count: 1
|
||||
control_plane_node_count: 1
|
||||
minikube_container_group: false
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
---
|
||||
|
||||
- name: Create _sources directory
|
||||
- name: Create _sources directories
|
||||
file:
|
||||
path: "{{ sources_dest }}/secrets"
|
||||
path: "{{ sources_dest }}/{{ item }}"
|
||||
state: 'directory'
|
||||
mode: '0700'
|
||||
loop:
|
||||
- secrets
|
||||
- receptor
|
||||
|
||||
- name: Detect secrets
|
||||
stat:
|
||||
@@ -82,8 +85,15 @@
|
||||
dest: "{{ sources_dest }}/{{ compose_name }}"
|
||||
mode: '0600'
|
||||
|
||||
- name: Render Docker-Compose (Receptor)
|
||||
- name: Render Receptor Hop Config
|
||||
template:
|
||||
src: docker-receptor.yml.j2
|
||||
dest: "{{ sources_dest }}/docker-receptor.yml"
|
||||
src: "receptor-hop.conf.j2"
|
||||
dest: "{{ sources_dest }}/receptor/receptor-hop.conf"
|
||||
mode: '0600'
|
||||
|
||||
- name: Render Receptor Worker Config(s)
|
||||
template:
|
||||
src: "receptor-worker.conf.j2"
|
||||
dest: "{{ sources_dest }}/receptor/receptor-worker-{{ item }}.conf"
|
||||
mode: '0600'
|
||||
with_sequence: start=1 end={{ execution_node_count }}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
version: '2.1'
|
||||
services:
|
||||
{% for i in range(cluster_node_count|int) %}
|
||||
{% for i in range(control_plane_node_count|int) %}
|
||||
{% set container_postfix = loop.index %}
|
||||
{% set awx_sdb_port_start = 7899 + (loop.index0*1000) | int %}
|
||||
{% set awx_sdb_port_end = 7999 + (loop.index0*1000) | int %}
|
||||
@@ -27,7 +27,6 @@ services:
|
||||
links:
|
||||
- postgres
|
||||
- redis_{{ container_postfix }}
|
||||
- execution_node_1
|
||||
working_dir: "/awx_devel"
|
||||
volumes:
|
||||
- "../../../:/awx_devel"
|
||||
@@ -41,12 +40,11 @@ services:
|
||||
- "/sys/fs/cgroup:/sys/fs/cgroup"
|
||||
- "~/.kube/config:/var/lib/awx/.kube/config"
|
||||
- "redis_socket_{{ container_postfix }}:/var/run/redis/:rw"
|
||||
- "execution_node_1:/var/run/receptor/"
|
||||
privileged: true
|
||||
tty: true
|
||||
ports:
|
||||
- "{{ awx_sdb_port_start }}-{{ awx_sdb_port_end }}:{{ awx_sdb_port_start }}-{{ awx_sdb_port_end }}" # sdb-listen
|
||||
{% if cluster_node_count|int == 1 %}
|
||||
{% if control_plane_node_count|int == 1 %}
|
||||
- "6899:6899"
|
||||
- "8080:8080" # unused but mapped for debugging
|
||||
- "8888:8888" # jupyter notebook
|
||||
@@ -63,17 +61,7 @@ services:
|
||||
entrypoint: ["redis-server"]
|
||||
command: ["/usr/local/etc/redis/redis.conf"]
|
||||
{% endfor %}
|
||||
execution_node_1:
|
||||
image: quay.io/awx/awx_devel:devel
|
||||
user: "{{ ansible_user_uid }}"
|
||||
container_name: tools_execution_node_1
|
||||
hostname: execution_node_1
|
||||
command: 'receptor --config /etc/receptor/awx-1-receptor-standalone.conf'
|
||||
volumes:
|
||||
- "../../docker-compose:/etc/receptor"
|
||||
- "/sys/fs/cgroup:/sys/fs/cgroup"
|
||||
privileged: true
|
||||
{% if cluster_node_count|int > 1 %}
|
||||
{% if control_plane_node_count|int > 1 %}
|
||||
haproxy:
|
||||
image: haproxy
|
||||
user: "{{ ansible_user_uid }}"
|
||||
@@ -84,7 +72,7 @@ services:
|
||||
- "8043:8043"
|
||||
- "1936:1936"
|
||||
depends_on:
|
||||
{% for i in range(cluster_node_count|int) -%}
|
||||
{% for i in range(control_plane_node_count|int) -%}
|
||||
{% set container_postfix = loop.index %}
|
||||
- "awx_{{ container_postfix }}"
|
||||
{% endfor %}
|
||||
@@ -105,13 +93,40 @@ services:
|
||||
POSTGRES_PASSWORD: {{ pg_password }}
|
||||
volumes:
|
||||
- "awx_db:/var/lib/postgresql/data"
|
||||
{% if execution_node_count|int > 0 %}
|
||||
receptor-hop:
|
||||
image: quay.io/project-receptor/receptor:latest
|
||||
user: root
|
||||
container_name: tools_receptor_hop
|
||||
hostname: receptor-hop
|
||||
command: 'receptor --config /etc/receptor/receptor.conf'
|
||||
links:
|
||||
- awx_1
|
||||
ports:
|
||||
- "5555:5555"
|
||||
volumes:
|
||||
- "../../docker-compose/_sources/receptor/receptor-hop.conf:/etc/receptor/receptor.conf"
|
||||
{% for i in range(execution_node_count|int) -%}
|
||||
receptor-{{ loop.index }}:
|
||||
image: quay.io/awx/awx_devel:devel
|
||||
user: "{{ ansible_user_uid }}"
|
||||
container_name: tools_receptor_{{ loop.index }}
|
||||
hostname: receptor-1
|
||||
command: 'receptor --config /etc/receptor/receptor.conf'
|
||||
links:
|
||||
- receptor-hop
|
||||
volumes:
|
||||
- "../../docker-compose/_sources/receptor/receptor-worker-{{ loop.index }}.conf:/etc/receptor/receptor.conf"
|
||||
- "/sys/fs/cgroup:/sys/fs/cgroup"
|
||||
privileged: true
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
volumes:
|
||||
awx_db:
|
||||
name: tools_awx_db
|
||||
{% for i in range(cluster_node_count|int) -%}
|
||||
{% for i in range(control_plane_node_count|int) -%}
|
||||
{% set container_postfix = loop.index %}
|
||||
execution_node_1:
|
||||
name: tools_execution_node_1
|
||||
redis_socket_{{ container_postfix }}:
|
||||
name: tools_redis_socket_{{ container_postfix }}
|
||||
{% endfor -%}
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
#
|
||||
# a simple receptor network with a single control plane node and one hop
|
||||
# to nodes where receptor + runner are installed
|
||||
#
|
||||
# <awx:4444>
|
||||
# <receptor-hop:5555>
|
||||
# ^-------------- <receptor-1>
|
||||
# ^-------------- <receptor-2>
|
||||
# ^-------------- <receptor-3>
|
||||
#
|
||||
---
|
||||
version: '2.1'
|
||||
services:
|
||||
awx_1:
|
||||
environment:
|
||||
RECEPTOR_MUTUAL_TLS: awx receptor-hop receptor-1 receptor-2 receptor-3
|
||||
volumes:
|
||||
- "./docker-compose-cluster:/etc/receptor"
|
||||
receptor-hop:
|
||||
image: quay.io/project-receptor/receptor:latest
|
||||
user: root
|
||||
container_name: tools_receptor_hop
|
||||
hostname: receptor-hop
|
||||
command: 'receptor --config /etc/receptor/awx-hop-receptor.conf'
|
||||
links:
|
||||
- awx_1
|
||||
ports:
|
||||
- "5555:5555"
|
||||
volumes:
|
||||
- "../../docker-compose-cluster:/etc/receptor"
|
||||
receptor-1:
|
||||
image: quay.io/awx/awx_devel:devel
|
||||
user: "{{ ansible_user_uid }}"
|
||||
container_name: tools_receptor_1
|
||||
hostname: receptor-1
|
||||
command: 'receptor --config /etc/receptor/awx-1-receptor.conf'
|
||||
links:
|
||||
- receptor-hop
|
||||
volumes:
|
||||
- "../../docker-compose-cluster:/etc/receptor"
|
||||
- "/sys/fs/cgroup:/sys/fs/cgroup"
|
||||
privileged: true
|
||||
receptor-2:
|
||||
image: quay.io/awx/awx_devel:devel
|
||||
user: "{{ ansible_user_uid }}"
|
||||
container_name: tools_receptor_2
|
||||
hostname: receptor-2
|
||||
command: 'receptor --config /etc/receptor/awx-2-receptor.conf'
|
||||
links:
|
||||
- receptor-hop
|
||||
volumes:
|
||||
- "../../docker-compose-cluster:/etc/receptor"
|
||||
- "/sys/fs/cgroup:/sys/fs/cgroup"
|
||||
privileged: true
|
||||
receptor-3:
|
||||
image: quay.io/awx/awx_devel:devel
|
||||
user: "{{ ansible_user_uid }}"
|
||||
container_name: tools_receptor_3
|
||||
hostname: receptor-3
|
||||
command: 'receptor --config /etc/receptor/awx-3-receptor.conf'
|
||||
links:
|
||||
- receptor-hop
|
||||
volumes:
|
||||
- "../../docker-compose-cluster:/etc/receptor"
|
||||
- "/sys/fs/cgroup:/sys/fs/cgroup"
|
||||
privileged: true
|
||||
@@ -29,7 +29,7 @@ backend nodes
|
||||
http-request set-header X-Forwarded-Port %[dst_port]
|
||||
http-request add-header X-Forwarded-Proto https if { ssl_fc }
|
||||
option httpchk HEAD / HTTP/1.1\r\nHost:localhost
|
||||
{% for i in range(cluster_node_count|int) %}
|
||||
{% for i in range(control_plane_node_count|int) %}
|
||||
{% set container_postfix = loop.index %}
|
||||
server tools_awx_{{ container_postfix }} tools_awx_{{ container_postfix }}:8013 check
|
||||
{% endfor %}
|
||||
@@ -37,7 +37,7 @@ backend nodes
|
||||
backend nodes_ssl
|
||||
mode tcp
|
||||
balance roundrobin
|
||||
{% for i in range(cluster_node_count|int) %}
|
||||
{% for i in range(control_plane_node_count|int) %}
|
||||
{% set container_postfix = loop.index %}
|
||||
server tools_awx_{{ container_postfix }} tools_awx_{{ container_postfix }}:8043 check
|
||||
{% endfor %}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
- node:
|
||||
id: receptor-hop
|
||||
|
||||
- log-level: info
|
||||
|
||||
- tcp-peer:
|
||||
address: awx_1:4444
|
||||
redial: true
|
||||
|
||||
- tcp-listener:
|
||||
port: 5555
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
- node:
|
||||
id: receptor-{{ item }}
|
||||
|
||||
- log-level: info
|
||||
|
||||
- tcp-peer:
|
||||
address: tools_receptor_hop:5555
|
||||
redial: true
|
||||
|
||||
- work-command:
|
||||
worktype: ansible-runner
|
||||
command: ansible-runner
|
||||
params: worker
|
||||
allowruntimeparams: true
|
||||
|
||||
- control-service:
|
||||
service: control
|
||||
Reference in New Issue
Block a user