Skip to content

Commit

Permalink
group updates to public branch
Browse files Browse the repository at this point in the history
  • Loading branch information
lj020326 committed Jun 5, 2024
1 parent ccf4e24 commit 58eada2
Show file tree
Hide file tree
Showing 92 changed files with 419 additions and 333 deletions.
3 changes: 3 additions & 0 deletions inventory/group_vars/docker_stack_control.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ kickstart_tftpdir: "{{ pxe_config_dir }}/menus"
# hour: "*/24"
# job: "cd {{ docker_stack__dir }} && /usr/local/bin/docker-compose restart jenkins"

## ansible-template-ui
docker_stack__ansibletemplateui__cred_docker_registry_admin_username: "{{ vault__docker_registry_username }}"
docker_stack__ansibletemplateui__cred_docker_registry_admin_password: "{{ vault__docker_registry_username }}"

#cobbler_firewalld_ports:
firewalld_ports__cobbler:
Expand Down
28 changes: 14 additions & 14 deletions inventory/group_vars/docker_stack_jenkins_controller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,28 +61,28 @@ docker_stack__jenkins__ssh_port: 4444

#######################
## config-as-code creds
docker_stack__jenkins__cred_jenkins_admin_user_username: "{{ vault__jenkins_cred_jenkins_admin_user_username }}"
docker_stack__jenkins__cred_jenkins_admin_user_password: "{{ vault__jenkins_cred_jenkins_admin_user_password }}"
docker_stack__jenkins__cred_jenkins_git_user_password: "{{ vault__jenkins_cred_jenkins_git_user_password }}"
docker_stack__jenkins__cred_jenkins_admin_user_username: "{{ vault__jenkins_admin_user_username }}"
docker_stack__jenkins__cred_jenkins_admin_user_password: "{{ vault__jenkins_admin_user_password }}"
docker_stack__jenkins__cred_jenkins_git_user_password: "{{ vault__jenkins_git_user_password }}"
docker_stack__jenkins__cred_ansible_vault_password: "{{ vault__ansible_vault_password }}"
docker_stack__jenkins__cred_ansible_ssh_key: "{{ vault__jenkins_cred_ansible_ssh_key }}"
docker_stack__jenkins__cred_ansible_ssh_key: "{{ vault__ansible_ssh_key }}"

docker_stack__jenkins__cred_ansible_ssh_username: "{{ vault__jenkins_cred_ansible_ssh_username }}"
docker_stack__jenkins__cred_ansible_ssh_password: "{{ vault__jenkins_cred_ansible_ssh_password }}"
docker_stack__jenkins__cred_ansible_ssh_username: "{{ vault__ansible_ssh_username }}"
docker_stack__jenkins__cred_ansible_ssh_password: "{{ vault__ansible_ssh_password }}"

docker_stack__jenkins__cred_vsphere_username: "{{ vault__jenkins_cred_vsphere_username }}"
docker_stack__jenkins__cred_vsphere_password: "{{ vault__jenkins_cred_vsphere_password }}"
docker_stack__jenkins__cred_vsphere_username: "{{ vault__vsphere_username }}"
docker_stack__jenkins__cred_vsphere_password: "{{ vault__vsphere_password }}"
docker_stack__jenkins__cred_esxi_password: "{{ vault__esxi_password }}"
docker_stack__jenkins__cred_bitbucket_ssh_username: "{{ vault__jenkins_cred_bitbucket_ssh_username }}"
docker_stack__jenkins__cred_bitbucket_ssh_private_key: "{{ vault__jenkins_cred_bitbucket_ssh_private_key }}"
docker_stack__jenkins__cred_bitbucket_ssh_username: "{{ vault__bitbucket_ssh_username }}"
docker_stack__jenkins__cred_bitbucket_ssh_private_key: "{{ vault__bitbucket_ssh_private_key }}"
#docker_stack__jenkins__cred_packer_ssh_password: "{{ vault__packer_user_password }}"
docker_stack__jenkins__cred_packer_user_password: "{{ vault__packer_user_password }}"
docker_stack__jenkins__cred_vm_root_password: "{{ vault__sha512_hashed_root_password }}"
docker_stack__jenkins__cred_github_username: "{{ vault__jenkins_cred_github_username }}"
docker_stack__jenkins__cred_github_password: "{{ vault__jenkins_cred_github_password }}"
docker_stack__jenkins__cred_github_username: "{{ vault__github_username }}"
docker_stack__jenkins__cred_github_password: "{{ vault__github_password }}"

docker_stack__jenkins__cred_docker_registry_admin_username: "{{ vault__jenkins_cred_docker_registry_admin_username }}"
docker_stack__jenkins__cred_docker_registry_admin_password: "{{ vault__jenkins_cred_docker_registry_admin_password }}"
docker_stack__jenkins__cred_docker_registry_admin_username: "{{ vault__docker_registry_admin_username }}"
docker_stack__jenkins__cred_docker_registry_admin_password: "{{ vault__docker_registry_admin_password }}"

docker_stack__jenkins__cred_bitbucket_cloud_oauth_key: "{{ vault__jenkins_bitbucket_cloud_oauth_key }}"
docker_stack__jenkins__cred_bitbucket_cloud_oauth_token: "{{ vault__jenkins_bitbucket_cloud_oauth_token }}"
28 changes: 14 additions & 14 deletions inventory/group_vars/docker_stack_jenkins_jcac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,28 @@ docker_stack__jenkins_jcac__ssh_public_key: "{{ vault__git_ssh_public_keyfile }}

#######################
## config-as-code creds
docker_stack__jenkins_jcac__cred_jenkins_admin_user_username: "{{ vault__jenkins_cred_jenkins_admin_user_username }}"
docker_stack__jenkins_jcac__cred_jenkins_admin_user_password: "{{ vault__jenkins_cred_jenkins_admin_user_password }}"
docker_stack__jenkins_jcac__cred_jenkins_git_user_password: "{{ vault__jenkins_cred_jenkins_git_user_password }}"
docker_stack__jenkins_jcac__cred_jenkins_admin_user_username: "{{ vault__jenkins_admin_user_username }}"
docker_stack__jenkins_jcac__cred_jenkins_admin_user_password: "{{ vault__jenkins_admin_user_password }}"
docker_stack__jenkins_jcac__cred_jenkins_git_user_password: "{{ vault__jenkins_git_user_password }}"
docker_stack__jenkins_jcac__cred_ansible_vault_password: "{{ vault__ansible_vault_password }}"
docker_stack__jenkins_jcac__cred_ansible_ssh_key: "{{ vault__jenkins_cred_ansible_ssh_key }}"
docker_stack__jenkins_jcac__cred_ansible_ssh_key: "{{ vault__ansible_ssh_key }}"

docker_stack__jenkins_jcac__cred_ansible_ssh_username: "{{ vault__jenkins_cred_ansible_ssh_username }}"
docker_stack__jenkins_jcac__cred_ansible_ssh_password: "{{ vault__jenkins_cred_ansible_ssh_password }}"
docker_stack__jenkins_jcac__cred_ansible_ssh_username: "{{ vault__ansible_ssh_username }}"
docker_stack__jenkins_jcac__cred_ansible_ssh_password: "{{ vault__ansible_ssh_password }}"

docker_stack__jenkins_jcac__cred_vsphere_username: "{{ vault__jenkins_cred_vsphere_username }}"
docker_stack__jenkins_jcac__cred_vsphere_password: "{{ vault__jenkins_cred_vsphere_password }}"
docker_stack__jenkins_jcac__cred_vsphere_username: "{{ vault__vsphere_username }}"
docker_stack__jenkins_jcac__cred_vsphere_password: "{{ vault__vsphere_password }}"
docker_stack__jenkins_jcac__cred_esxi_password: "{{ vault__esxi_password }}"
docker_stack__jenkins_jcac__cred_bitbucket_ssh_username: "{{ vault__jenkins_cred_bitbucket_ssh_username }}"
docker_stack__jenkins_jcac__cred_bitbucket_ssh_private_key: "{{ vault__jenkins_cred_bitbucket_ssh_private_key }}"
docker_stack__jenkins_jcac__cred_bitbucket_ssh_username: "{{ vault__bitbucket_ssh_username }}"
docker_stack__jenkins_jcac__cred_bitbucket_ssh_private_key: "{{ vault__bitbucket_ssh_private_key }}"
#docker_stack__jenkins_jcac__cred_packer_ssh_password: "{{ vault__packer_user_password }}"
docker_stack__jenkins_jcac__cred_packer_user_password: "{{ vault__packer_user_password }}"
docker_stack__jenkins_jcac__cred_vm_root_password: "{{ vault__sha512_hashed_root_password }}"
docker_stack__jenkins_jcac__cred_github_username: "{{ vault__jenkins_cred_github_username }}"
docker_stack__jenkins_jcac__cred_github_password: "{{ vault__jenkins_cred_github_password }}"
docker_stack__jenkins_jcac__cred_github_username: "{{ vault__github_username }}"
docker_stack__jenkins_jcac__cred_github_password: "{{ vault__github_password }}"

docker_stack__jenkins_jcac__cred_docker_registry_admin_username: "{{ vault__jenkins_cred_docker_registry_admin_username }}"
docker_stack__jenkins_jcac__cred_docker_registry_admin_password: "{{ vault__jenkins_cred_docker_registry_admin_password }}"
docker_stack__jenkins_jcac__cred_docker_registry_admin_username: "{{ vault__docker_registry_username }}"
docker_stack__jenkins_jcac__cred_docker_registry_admin_password: "{{ vault__docker_registry_password }}"

docker_stack__jenkins_jcac__cred_bitbucket_cloud_oauth_key: "{{ vault__jenkins_bitbucket_cloud_oauth_key }}"
docker_stack__jenkins_jcac__cred_bitbucket_cloud_oauth_token: "{{ vault__jenkins_bitbucket_cloud_oauth_token }}"
19 changes: 8 additions & 11 deletions inventory/run-inventory-tests.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

VERSION="2024.2.1"
VERSION="2024.5.1"

#SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SCRIPT_DIR="$(dirname "$0")"
Expand All @@ -10,10 +10,8 @@ SCRIPT_DIR="$(dirname "$0")"
PROJECT_DIR="$(cd "${SCRIPT_DIR}" && git rev-parse --show-toplevel)"
INVENTORY_DIR="${PROJECT_DIR}/inventory"

#KEEP_TMP=1

KEEP_TMP=0
RUN_PYTEST=0
LIST_TEST_CASES=0
ENSURE_PYTHON_MODULES=0

PYTEST_JUNIT_REPORT_DEFAULT=".test-results/junit-report.xml"
Expand Down Expand Up @@ -658,7 +656,7 @@ function ensure_tool() {
esac

logDebug "${LOG_PREFIX} installing executable '${executable}'"
eval "${install_function} ${OS}"
eval "${install_function} ${PLATFORM_OS}"
fi
}

Expand All @@ -673,6 +671,7 @@ function usage() {
echo " -p : run pytest"
echo " -r [PYTEST_JUNIT_REPORT] : use specified junitxml path for pytest report"
echo " -v : show script version"
echo " -k : keep temp directory/files"
echo " -h : help"
echo " [TEST_CASES]"
echo ""
Expand All @@ -681,6 +680,7 @@ function usage() {
echo " ${0} -l"
echo " ${0} 01"
echo " ${0} validate_file_extensions"
echo " ${0} -k -L DEBUG validate_yml_sortorder"
echo " ${0} 01 03"
echo " ${0} -L DEBUG 02 04"
echo " ${0} -p"
Expand All @@ -695,12 +695,13 @@ function main() {

checkRequiredCommands ansible-inventory yamllint

while getopts "L:r:dlpvh" opt; do
while getopts "L:r:dlpvhk" opt; do
case "${opt}" in
L) setLogLevel "${OPTARG}" ;;
l) print_test_cases && exit ;;
r) PYTEST_JUNIT_REPORT="${OPTARG}" ;;
d) DISPLAY_TEST_RESULTS=1 ;;
l) LIST_TEST_CASES=1 ;;
k) KEEP_TMP=1 ;;
p) RUN_PYTEST=1 ;;
v) echo "${VERSION}" && exit ;;
h) usage 1 ;;
Expand All @@ -713,10 +714,6 @@ function main() {
if [[ -n "${PYTEST_JUNIT_REPORT-}" ]]; then
PYTEST_JUNIT_REPORT="${PYTEST_JUNIT_REPORT_DEFAULT}"
fi
if [ "${LIST_TEST_CASES}" -eq 1 ]; then
print_test_cases
exit
fi

## ref: https://pypi.org/project/yq/
logDebug "Ensure jq present/installed (required for yq sort-keys)"
Expand Down
2 changes: 1 addition & 1 deletion roles/ansible-ping-test/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
- name: ping test via CLI
delegate_to: localhost
become: yes
command: "ping -c 1 -w 2 {{ ansible_host }}"
ansible.builtin.command: "ping -c 1 -w 2 {{ ansible_host }}"
register: ping_cli_test
changed_when: no

Expand Down
2 changes: 1 addition & 1 deletion roles/ansible-role-bind/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
tags: bind

- name: Create serial, based on UTC UNIX time
command: date -u +%s
ansible.builtin.command: date -u +%s
register: timestamp
changed_when: false
run_once: true
Expand Down
2 changes: 1 addition & 1 deletion roles/ansible-role-dhcp/tasks/apparmor-fix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
tags: dhcp

- name: AppArmor fix | Force running handlers now
meta: flush_handlers
ansible.builtin.meta: flush_handlers
2 changes: 1 addition & 1 deletion roles/ansible-role-pdc/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
when: not ansible_windows_domain_member

- name: Force all notified handlers to run at this point, not waiting for normal sync points
meta: flush_handlers
ansible.builtin.meta: flush_handlers

- name: Ensure a Domain Controller is available in the domain
win_dsc:
Expand Down
4 changes: 2 additions & 2 deletions roles/awx-docker/tasks/build_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
when: awx_version is not defined

- name: Verify awx-logos directory exists for official install
stat:
ansible.builtin.stat:
path: "../../awx-logos"
# delegate_to: localhost
register: logosdir
Expand Down Expand Up @@ -211,7 +211,7 @@
# delegate_to: localhost

- name: Tag task and web images as latest
command: "docker tag {{ item }}:{{ awx_version }} {{ item }}:latest"
ansible.builtin.command: "docker tag {{ item }}:{{ awx_version }} {{ item }}:latest"
# delegate_to: localhost
with_items:
- "{{ awx_task_image }}"
Expand Down
2 changes: 1 addition & 1 deletion roles/awx-docker/tasks/check_docker.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# check_docker.yml
---
- name: awx_postgres_data_dir should be defined
assert:
ansible.builtin.assert:
that:
- awx_postgres_data_dir is defined and awx_postgres_data_dir != ''
msg: "Set the value of 'awx_postgres_data_dir' in the inventory file."
Expand Down
10 changes: 5 additions & 5 deletions roles/awx-docker/tasks/compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
- name: Create {{ awx_inventory_dir }} directory
file:
ansible.builtin.file:
path: "{{ awx_inventory_dir }}"
state: directory
owner: "{{ docker_user_username }}"
Expand Down Expand Up @@ -72,11 +72,11 @@
register: awx_compose_start

- name: Update CA trust in awx_web container
command: "docker exec {{ awx_container_prefix }}_web '/usr/bin/update-ca-trust'"
ansible.builtin.command: "docker exec {{ awx_container_prefix }}_web '/usr/bin/update-ca-trust'"
when: awx_compose_config.changed or awx_compose_start.changed

- name: Update CA trust in awx_task container
command: "docker exec {{ awx_container_prefix }}_task '/usr/bin/update-ca-trust'"
ansible.builtin.command: "docker exec {{ awx_container_prefix }}_task '/usr/bin/update-ca-trust'"
when: awx_compose_config.changed or awx_compose_start.changed

- name: Wait for launch script to create user
Expand All @@ -87,8 +87,8 @@
## moved to smoke-test.yml
# ## ref: https://github.com/ansible/awx/blob/20.1.0/tools/docker-compose/ansible/smoke-test.yml
# - name: Create Preload data
## command: "docker exec {{ awx_container_prefix }}_task bash -c '/usr/bin/awx-manage create_preload_data'"
# command: "docker exec {{ awx_container_prefix }}_task bash -c '/usr/bin/awx-manage create_preload_data'"
## ansible.builtin.command: "docker exec {{ awx_container_prefix }}_task bash -c '/usr/bin/awx-manage create_preload_data'"
# ansible.builtin.command: "docker exec {{ awx_container_prefix }}_task bash -c '/usr/bin/awx-manage create_preload_data'"
# when: awx_create_preload_data|bool
# register: awx_cdo
# changed_when: "'added' in awx_cdo.stdout"
6 changes: 3 additions & 3 deletions roles/awx-docker/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
no_log: true

- name: Check for existing Postgres data
stat:
ansible.builtin.stat:
path: "{{ awx_postgres_data_dir }}/pgdata/PG_VERSION"
register: pg_version_file

Expand All @@ -33,7 +33,7 @@
upgrade_postgres: "{{ old_pg_version is defined and old_pg_version == '9.6' }}"

- name: Set up new postgres paths pre-upgrade
file:
ansible.builtin.file:
state: directory
path: "{{ item }}"
recurse: true
Expand Down Expand Up @@ -68,7 +68,7 @@
# when: upgrade_postgres | bool
#
#- name: Remove old data directory
# file:
# ansible.builtin.file:
# path: "{{ awx_postgres_data_dir + '/pgdata' }}"
# state: absent
# when: awx_compose_start_containers|bool
Expand Down
2 changes: 1 addition & 1 deletion roles/awx-docker/tasks/set_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
when: ansible_connection != "local" and awx_docker_registry is not defined

- name: Ensure directory exists
file:
ansible.builtin.file:
path: "{{ docker_deploy_base_path }}"
state: directory
when: ansible_connection != "local" and awx_docker_registry is not defined
Expand Down
2 changes: 1 addition & 1 deletion roles/awx-docker/tasks/smoke_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Takes a while for migrations to finish
- name: Wait for the environment to be ready
uri:
ansible.builtin.uri:
# url: "http://localhost:8013/api/v2/ping/"
url: "http://localhost:{{ awx_host_port }}/api/v2/ping/"
register: _result
Expand Down
2 changes: 1 addition & 1 deletion roles/bootstrap-awstats/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ awstats_pkg_state: present
# Repository states: present or absent
#awstats_repository_state: present

apache_directory : "apache2"
apache_directory: "apache2"
apache_conf_path: "/etc/{{ apache_directory }}"
apache_log_path: "/var/log/{{ apache_directory }}"
#apache_log_path: "${APACHE_LOG_DIR}"
Expand Down
2 changes: 1 addition & 1 deletion roles/bootstrap-awstats/tasks/remove.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
notify: restart apache

- name: apache | Disable the awstats site
command: a2dissite awstats
ansible.builtin.command: a2dissite awstats
ignore_errors: yes
notify: restart apache

Expand Down
4 changes: 2 additions & 2 deletions roles/bootstrap-awstats/tasks/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# notify: restart apache

- name: apache | Enable some required modules (rewrite)
command: a2enmod rewrite vhost_alias cgi
ansible.builtin.command: a2enmod rewrite vhost_alias cgi

- name: apache | Add apache awstats vhosts configuration.
ansible.builtin.template:
Expand All @@ -33,7 +33,7 @@
notify: restart apache

- name: apache | Enable the awstats site
command: a2ensite awstats
ansible.builtin.command: a2ensite awstats
ignore_errors: yes
when: apache_create_vhosts|bool
notify: restart apache
Expand Down
12 changes: 6 additions & 6 deletions roles/bootstrap-certs/tasks/trust_cert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@
## ref: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/security_hardening/using-shared-system-certificates_security-hardening
## ref: https://techjourney.net/update-add-ca-certificates-bundle-in-redhat-centos/
- name: "trust_cert | update CA trust: {{ __bootstrap_certs__trust_ca_update_trust_cmd }}"
command: "{{ __bootstrap_certs__trust_ca_update_trust_cmd }}"
ansible.builtin.command: "{{ __bootstrap_certs__trust_ca_update_trust_cmd }}"
# when: trust_ca_cacertinstalled|bool is changed or bootstrap_certs__ca_force_distribute_nodes|bool

#- name: convert to pkcs12
# command: openssl pkcs12 -export \
# ansible.builtin.command: openssl pkcs12 -export \
# -in {{ ca_path }}/{{ __bootstrap_certs__cert_node.domainName }}/{{ __bootstrap_certs__cert_node.commonName }}.crt \
# -inkey {{ ca_path }}/{{ __bootstrap_certs__cert_node.domainName}}/{{ __bootstrap_certs__cert_node.commonName }}.key \
# -out {{ ca_path }}/{{ __bootstrap_certs__cert_node.domainName }}/{{ __bootstrap_certs__cert_node.commonName }}.p12 \
Expand All @@ -78,7 +78,7 @@

#- name: "trust_cert | Add service cert to keystore"
# when: bootstrap_certs__ca_java_keystore_enabled|bool
# command: |
# ansible.builtin.command: |
# keytool -importcert \
# -storepass {{ bootstrap_certs__ca_java_keystore_pass }} \
# -keystore {{ ca_java_keystore }} \
Expand All @@ -91,7 +91,7 @@

#- name: "trust_cert | Add root ca root and host certs to keystore"
# when: bootstrap_certs__ca_java_keystore_enabled|bool
# command: |
# ansible.builtin.command: |
# keytool -importcert -v \
# -storepass {{ bootstrap_certs__ca_java_keystore_pass }} \
# -noprompt \
Expand All @@ -111,7 +111,7 @@
## ref: https://superuser.com/questions/881665/keytool-commands-to-replace-existing-ssl-certificate
## ref: https://stackoverflow.com/questions/48204014/how-to-delete-already-import-certificate-alias-by-keytool-command
- name: "trust_cert | Remove old service cert from keystore"
command: |
ansible.builtin.command: |
keytool -delete -v \
-storepass {{ bootstrap_certs__ca_java_keystore_pass }} \
-noprompt \
Expand All @@ -127,7 +127,7 @@
verbosity: 1

- name: "trust_cert | Add current service cert to keystore"
command: |
ansible.builtin.command: |
keytool -importcert -v \
-storepass {{ bootstrap_certs__ca_java_keystore_pass }} \
-noprompt \
Expand Down
2 changes: 1 addition & 1 deletion roles/bootstrap-dhcp/tasks/apparmor-fix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
tags: dhcp

- name: AppArmor fix | Force running handlers now
meta: flush_handlers
ansible.builtin.meta: flush_handlers
Loading

0 comments on commit 58eada2

Please sign in to comment.