<commit_before>---
- name: Activate postgres container
  docker_container:
    name: postgres
    state: started
    restart_policy: unless-stopped
    image: postgres:9.6
    volumes:
      - "{{ postgres_data_dir }}:/var/lib/postgresql/data:Z"
    env:
      POSTGRES_USER: "{{ pg_username }}"
      POSTGRES_PASSWORD: "{{ pg_password }}"
      POSTGRES_DB: "{{ pg_database }}"
      PGDATA: "/var/lib/postgresql/data/pgdata"
  when: pg_hostname is not defined or pg_hostname == ''
  register: postgres_container_activate

- name: Activate rabbitmq container
  docker_container:
    name: rabbitmq
    state: started
    restart_policy: unless-stopped
    image: rabbitmq:3
    env:
      RABBITMQ_DEFAULT_VHOST: "awx"
  register: rabbitmq_container_activate

- name: Activate memcached container
  docker_container:
    name: memcached
    state: started
    restart_policy: unless-stopped
    image: memcached:alpine

- name: Wait for postgres and rabbitmq to activate
  pause:
    seconds: 15
  when: postgres_container_activate.changed or rabbitmq_container_activate.changed

- name: Set properties without postgres for awx_web
  set_fact:
    pg_hostname_actual: "{{ pg_hostname }}"
    awx_web_container_links:
      - rabbitmq
      - memcached
  when: pg_hostname is defined

- name: Set properties with postgres for awx_web
  set_fact:
    pg_hostname_actual: postgres
    awx_web_container_links:
      - rabbitmq
      - memcached
      - postgres
  when: pg_hostname is not defined or pg_hostname == ''

- name: Set properties without postgres for awx_task
  set_fact:
    pg_hostname_actual: "{{ pg_hostname }}"
    awx_task_container_links:
      - rabbitmq
      - memcached
      - awx_web:awxweb
  when: pg_hostname is defined

- name: Set properties with postgres for awx_task
  set_fact:
    pg_hostname_actual: postgres
    awx_task_container_links:
      - rabbitmq
      - memcached
      - awx_web:awxweb
      - postgres
  when: pg_hostname is not defined or pg_hostname == ''

- name: Activate AWX Web Container
  docker_container:
    name: awx_web
    state: started
    restart_policy: unless-stopped
    image: "{{ awx_web_docker_actual_image }}"
    volumes: >
      {{
        [project_data_dir + ':/var/lib/awx/projects:rw' if project_data_dir is defined else []
        + [ca_trust_dir + ':/etc/pki/ca-trust:ro'] if ca_trust_dir is defined else []
      }}
    user: root
    ports:
      - "{{ host_port }}:8052"
    links: "{{ awx_web_container_links|list }}"
    hostname: awxweb
    dns_search_domains: "{{ awx_container_search_domains.split(',') if awx_container_search_domains is defined else omit }}"
    dns_servers: "{{ awx_alternate_dns_servers.split(',') if awx_alternate_dns_servers is defined else omit }}"
    env:
      http_proxy: "{{ http_proxy | default('') }}"
      https_proxy: "{{ https_proxy | default('') }}"
      no_proxy: "{{ no_proxy | default('') }}"
      SECRET_KEY: "{{ awx_secret_key }}"
      DATABASE_NAME: "{{ pg_database }}"
      DATABASE_USER: "{{ pg_username }}"
      DATABASE_PASSWORD: "{{ pg_password }}"
      DATABASE_PORT: "{{ pg_port }}"
      DATABASE_HOST: "{{ pg_hostname_actual }}"
      RABBITMQ_USER: "guest"
      RABBITMQ_PASSWORD: "<PASSWORD>"
      RABBITMQ_HOST: "rabbitmq"
      RABBITMQ_PORT: "5672"
      RABBITMQ_VHOST: "awx"
      MEMCACHED_HOST: "memcached"
      MEMCACHED_PORT: "11211"
      AWX_ADMIN_USER: "{{ default_admin_user|default('admin') }}"
      AWX_ADMIN_PASSWORD: "{{ default_admin_password|default('password') }}"

- name: Activate AWX Task Container
  docker_container:
    name: awx_task
    state: started
    restart_policy: unless-stopped
    image: "{{ awx_task_docker_actual_image }}"
    volumes: >
      {{
        [project_data_dir + ':/var/lib/awx/projects:rw' if project_data_dir is defined else []
        + [ca_trust_dir + ':/etc/pki/ca-trust:ro'] if ca_trust_dir is defined else []
      }}
    links: "{{ awx_task_container_links|list }}"
    user: root
    hostname: awx
    dns_search_domains: "{{ awx_container_search_domains.split(',') if awx_container_search_domains is defined else omit }}"
    dns_servers: "{{ awx_alternate_dns_servers.split(',') if awx_alternate_dns_servers is defined else omit }}"
    env:
      http_proxy: "{{ http_proxy | default('') }}"
      https_proxy: "{{ https_proxy | default('') }}"
      no_proxy: "{{ no_proxy | default('') }}"
      SECRET_KEY: "{{ awx_secret_key }}"
      DATABASE_NAME: "{{ pg_database }}"
      DATABASE_USER: "{{ pg_username }}"
      DATABASE_PASSWORD: "{{ pg_password }}"
      DATABASE_HOST: "{{ pg_hostname_actual }}"
      DATABASE_PORT: "{{ pg_port }}"
      RABBITMQ_USER: "guest"
      RABBITMQ_PASSWORD: "guest"
      RABBITMQ_HOST: "rabbitmq"
      RABBITMQ_PORT: "5672"
      RABBITMQ_VHOST: "awx"
      MEMCACHED_HOST: "memcached"
      MEMCACHED_PORT: "11211"
      AWX_ADMIN_USER: "{{ default_admin_user|default('admin') }}"
      AWX_ADMIN_PASSWORD: "{{ default_admin_password|default('password') }}"
<commit_msg>fixup! Add local_docker facility for bind-mounting ca-trust<commit_after>---
- name: Activate postgres container
  docker_container:
    name: postgres
    state: started
    restart_policy: unless-stopped
    image: postgres:9.6
    volumes:
      - "{{ postgres_data_dir }}:/var/lib/postgresql/data:Z"
    env:
      POSTGRES_USER: "{{ pg_username }}"
      POSTGRES_PASSWORD: "{{ pg_password }}"
      POSTGRES_DB: "{{ pg_database }}"
      PGDATA: "/var/lib/postgresql/data/pgdata"
  when: pg_hostname is not defined or pg_hostname == ''
  register: postgres_container_activate

- name: Activate rabbitmq container
  docker_container:
    name: rabbitmq
    state: started
    restart_policy: unless-stopped
    image: rabbitmq:3
    env:
      RABBITMQ_DEFAULT_VHOST: "awx"
  register: rabbitmq_container_activate

- name: Activate memcached container
  docker_container:
    name: memcached
    state: started
    restart_policy: unless-stopped
    image: memcached:alpine

- name: Wait for postgres and rabbitmq to activate
  pause:
    seconds: 15
  when: postgres_container_activate.changed or rabbitmq_container_activate.changed

- name: Set properties without postgres for awx_web
  set_fact:
    pg_hostname_actual: "{{ pg_hostname }}"
    awx_web_container_links:
      - rabbitmq
      - memcached
  when: pg_hostname is defined

- name: Set properties with postgres for awx_web
  set_fact:
    pg_hostname_actual: postgres
    awx_web_container_links:
      - rabbitmq
      - memcached
      - postgres
  when: pg_hostname is not defined or pg_hostname == ''

- name: Set properties without postgres for awx_task
  set_fact:
    pg_hostname_actual: "{{ pg_hostname }}"
    awx_task_container_links:
      - rabbitmq
      - memcached
      - awx_web:awxweb
  when: pg_hostname is defined

- name: Set properties with postgres for awx_task
  set_fact:
    pg_hostname_actual: postgres
    awx_task_container_links:
      - rabbitmq
      - memcached
      - awx_web:awxweb
      - postgres
  when: pg_hostname is not defined or pg_hostname == ''

- name: Activate AWX Web Container
  docker_container:
    name: awx_web
    state: started
    restart_policy: unless-stopped
    image: "{{ awx_web_docker_actual_image }}"
    volumes: >
      {{
        [project_data_dir + ':/var/lib/awx/projects:rw'] if project_data_dir is defined else []
        + [ca_trust_dir + ':/etc/pki/ca-trust:ro'] if ca_trust_dir is defined else []
      }}
    user: root
    ports:
      - "{{ host_port }}:8052"
    links: "{{ awx_web_container_links|list }}"
    hostname: awxweb
    dns_search_domains: "{{ awx_container_search_domains.split(',') if awx_container_search_domains is defined else omit }}"
    dns_servers: "{{ awx_alternate_dns_servers.split(',') if awx_alternate_dns_servers is defined else omit }}"
    env:
      http_proxy: "{{ http_proxy | default('') }}"
      https_proxy: "{{ https_proxy | default('') }}"
      no_proxy: "{{ no_proxy | default('') }}"
      SECRET_KEY: "{{ awx_secret_key }}"
      DATABASE_NAME: "{{ pg_database }}"
      DATABASE_USER: "{{ pg_username }}"
      DATABASE_PASSWORD: "{{ pg_password }}"
      DATABASE_PORT: "{{ pg_port }}"
      DATABASE_HOST: "{{ pg_hostname_actual }}"
      RABBITMQ_USER: "guest"
      RABBITMQ_PASSWORD: "guest"
      RABBITMQ_HOST: "rabbitmq"
      RABBITMQ_PORT: "5672"
      RABBITMQ_VHOST: "awx"
      MEMCACHED_HOST: "memcached"
      MEMCACHED_PORT: "11211"
      AWX_ADMIN_USER: "{{ default_admin_user|default('admin') }}"
      AWX_ADMIN_PASSWORD: "{{ default_admin_password|default('password') }}"

- name: Activate AWX Task Container
  docker_container:
    name: awx_task
    state: started
    restart_policy: unless-stopped
    image: "{{ awx_task_docker_actual_image }}"
    volumes: >
      {{
        [project_data_dir + ':/var/lib/awx/projects:rw'] if project_data_dir is defined else []
        + [ca_trust_dir + ':/etc/pki/ca-trust:ro'] if ca_trust_dir is defined else []
      }}
    links: "{{ awx_task_container_links|list }}"
    user: root
    hostname: awx
    dns_search_domains: "{{ awx_container_search_domains.split(',') if awx_container_search_domains is defined else omit }}"
    dns_servers: "{{ awx_alternate_dns_servers.split(',') if awx_alternate_dns_servers is defined else omit }}"
    env:
      http_proxy: "{{ http_proxy | default('') }}"
      https_proxy: "{{ https_proxy | default('') }}"
      no_proxy: "{{ no_proxy | default('') }}"
      SECRET_KEY: "{{ awx_secret_key }}"
      DATABASE_NAME: "{{ pg_database }}"
      DATABASE_USER: "{{ pg_username }}"
      DATABASE_PASSWORD: "{{ pg_password }}"
      DATABASE_HOST: "{{ pg_hostname_actual }}"
      DATABASE_PORT: "{{ pg_port }}"
      RABBITMQ_USER: "guest"
      RABBITMQ_PASSWORD: "<PASSWORD>"
      RABBITMQ_HOST: "rabbitmq"
      RABBITMQ_PORT: "5672"
      RABBITMQ_VHOST: "awx"
      MEMCACHED_HOST: "memcached"
      MEMCACHED_PORT: "11211"
      AWX_ADMIN_USER: "{{ default_admin_user|default('admin') }}"
      AWX_ADMIN_PASSWORD: "{{ default_admin_password|default('password') }}"

{'fraction_non_alphanumeric': 0.11482068555577571, 'fraction_numerical': 0.005349712700614226, 'mean_word_length': 3.3682388576373863, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7476461', 'n_tokens_mistral': 3662, 'n_tokens_neox': 3549, 'n_words': 694}