Compare commits
10 Commits
6143b279eb
...
1378d8a38e
Author | SHA1 | Date | |
---|---|---|---|
1378d8a38e | |||
cf3811c98f | |||
1423653a04 | |||
0767ca5f20 | |||
2ee99ade1e | |||
0d8f500df4 | |||
896c4a168e | |||
cd8ae7ea4f | |||
a98fdd76e9 | |||
905c5d1c9f |
183
inmem-split-host.yml
Normal file
183
inmem-split-host.yml
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
---
|
||||||
|
- name: Run a series of tasks, with exception handling, on a given host
|
||||||
|
hosts: all
|
||||||
|
gather_facts: no
|
||||||
|
become: no
|
||||||
|
|
||||||
|
|
||||||
|
vars_files:
|
||||||
|
- vars/defaults.yml
|
||||||
|
|
||||||
|
|
||||||
|
vars:
|
||||||
|
provision_host: "{{ tower_provision_host | default(ansible_play_hosts | random) }}"
|
||||||
|
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name : "Create in-memory inventory to run against"
|
||||||
|
add_host :
|
||||||
|
name : "{{ item }}"
|
||||||
|
groups :
|
||||||
|
- remdiation
|
||||||
|
delegate_to: localhost
|
||||||
|
loop: "{{ provision_host.split(',') }}" # Please take note of the split
|
||||||
|
# differences between Ansible versions
|
||||||
|
# str.split() - Ansible <= 2.9
|
||||||
|
# str | split - Ansible >= 2.10
|
||||||
|
|
||||||
|
|
||||||
|
# =========================================================================== #
|
||||||
|
|
||||||
|
|
||||||
|
- name: Verify file existence and handle errors if needed
|
||||||
|
hosts: remdiation
|
||||||
|
gather_facts: yes
|
||||||
|
become: no
|
||||||
|
|
||||||
|
|
||||||
|
vars_files:
|
||||||
|
- vars/defaults.yml
|
||||||
|
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name : Run file test
|
||||||
|
###############
|
||||||
|
# BLOCK TASKS #
|
||||||
|
###############
|
||||||
|
block :
|
||||||
|
- name : "Test #1: register file contents"
|
||||||
|
command :
|
||||||
|
cmd : "cat {{ check_file }}"
|
||||||
|
changed_when : no
|
||||||
|
register : r_check_file
|
||||||
|
|
||||||
|
|
||||||
|
- name : "Test #2: Launch the `file_removal_test` job template"
|
||||||
|
no_log : "{{ __no_log | default('yes') }}"
|
||||||
|
uri :
|
||||||
|
url : "{{ tower_file_remove_url }}"
|
||||||
|
force_basic_auth : yes
|
||||||
|
user : "{{ tower_user }}"
|
||||||
|
password : "{{ tower_password }}"
|
||||||
|
body_format : json
|
||||||
|
method : POST
|
||||||
|
status_code : 201
|
||||||
|
body:
|
||||||
|
extra_vars:
|
||||||
|
tower_provision_host: "{{ inventory_hostname }}"
|
||||||
|
|
||||||
|
|
||||||
|
- name : Return job data to originating source
|
||||||
|
no_log : "{{ __no_log | default('yes') }}"
|
||||||
|
uri :
|
||||||
|
url : "{{ gitlab_commit_url }}"
|
||||||
|
headers :
|
||||||
|
PRIVATE-TOKEN : "{{ gitlab_pat }}"
|
||||||
|
method : POST
|
||||||
|
status_code : 201
|
||||||
|
body_format : json
|
||||||
|
return_content : no
|
||||||
|
validate_certs : no
|
||||||
|
body:
|
||||||
|
id : "{{ gitlab_proj_id }}"
|
||||||
|
branch : "{{ git_commit_branch }}"
|
||||||
|
commit_message : "Job {{ lookup('env', 'JOB_ID') | default('N/A', true) }} - {{ inventory_hostname }}; SUCCESS: {{ r_check_file.stdout }}"
|
||||||
|
author_name : "{{ git_commit_author }}"
|
||||||
|
author_email : "{{ git_commit_email }}"
|
||||||
|
actions:
|
||||||
|
- action : create
|
||||||
|
file_path : "successful_jobs/{{ lookup('env', 'JOB_ID') }}_\
|
||||||
|
{{ inventory_hostname }}_\
|
||||||
|
{{ ansible_date_time.iso8601 }}.txt"
|
||||||
|
content : |
|
||||||
|
tower_provision_host : {{ inventory_hostname }}
|
||||||
|
tower_job_id : {{ lookup('env', 'JOB_ID') | default('N/A', true) }}
|
||||||
|
tower_project_revision : {{ lookup('env', 'PROJECT_REVISION') | default('N/A', true) }}
|
||||||
|
tower_provision_rc : {{ r_check_file.rc | default('N/A', true) }}
|
||||||
|
tower_provision_stdout : {{ r_check_file.stdout | default('N/A', true) }}
|
||||||
|
|
||||||
|
|
||||||
|
###################
|
||||||
|
# END BLOCK TASKS #
|
||||||
|
###################
|
||||||
|
|
||||||
|
|
||||||
|
################
|
||||||
|
# RESCUE TASKS #
|
||||||
|
################
|
||||||
|
rescue:
|
||||||
|
- name : Exception caught
|
||||||
|
debug :
|
||||||
|
msg : "*** EXCEPTION CAUGHT; RUNNING RESCUE TASKS ***"
|
||||||
|
|
||||||
|
|
||||||
|
- name : "Create missing file on {{ inventory_hostname }}"
|
||||||
|
no_log : "{{ __no_log | default('yes') }}"
|
||||||
|
uri :
|
||||||
|
url : "{{ tower_file_creation_url }}"
|
||||||
|
force_basic_auth : yes
|
||||||
|
user : "{{ tower_user }}"
|
||||||
|
password : "{{ tower_password }}"
|
||||||
|
body_format : json
|
||||||
|
method : POST
|
||||||
|
status_code : 201
|
||||||
|
body:
|
||||||
|
extra_vars:
|
||||||
|
tower_provision_host: "{{ inventory_hostname }}"
|
||||||
|
|
||||||
|
|
||||||
|
- name : Return job data to originating source
|
||||||
|
no_log : "{{ __no_log | default('yes') }}"
|
||||||
|
uri :
|
||||||
|
url : "{{ gitlab_commit_url }}"
|
||||||
|
headers :
|
||||||
|
PRIVATE-TOKEN : "{{ gitlab_pat }}"
|
||||||
|
method : POST
|
||||||
|
status_code : 201
|
||||||
|
body_format : json
|
||||||
|
return_content : no
|
||||||
|
validate_certs : no
|
||||||
|
body:
|
||||||
|
id : "{{ gitlab_proj_id }}"
|
||||||
|
branch : "{{ git_commit_branch }}"
|
||||||
|
commit_message : "Job {{ lookup('env', 'JOB_ID') | default('N/A', true) }} - {{ inventory_hostname }}; FAILED: {{ r_check_file.msg }}"
|
||||||
|
author_name : "{{ git_commit_author }}"
|
||||||
|
author_email : "{{ git_commit_email }}"
|
||||||
|
actions:
|
||||||
|
- action : create
|
||||||
|
file_path : "failed_jobs/{{ lookup('env', 'JOB_ID') }}_\
|
||||||
|
{{ inventory_hostname }}_\
|
||||||
|
{{ ansible_date_time.iso8601 }}.txt"
|
||||||
|
content : |
|
||||||
|
tower_provision_host : {{ inventory_hostname }}
|
||||||
|
tower_job_id : {{ lookup('env', 'JOB_ID') | default('N/A', true) }}
|
||||||
|
tower_project_revision : {{ lookup('env', 'PROJECT_REVISION') | default('N/A', true) }}
|
||||||
|
tower_provision_rc : {{ r_check_file.rc | default('N/A', true) }}
|
||||||
|
tower_provision_stdout : {{ r_check_file.stdout | default('N/A', true) }}
|
||||||
|
tower_provision_stderr : {{ r_check_file.stderr | default('N/A', true) }}
|
||||||
|
tower_provision_msg : {{ r_check_file.msg | default('N/A', true) }}
|
||||||
|
|
||||||
|
|
||||||
|
####################
|
||||||
|
# END RESCUE TASKS #
|
||||||
|
####################
|
||||||
|
|
||||||
|
|
||||||
|
################
|
||||||
|
# ALWAYS TASKS #
|
||||||
|
################
|
||||||
|
|
||||||
|
always:
|
||||||
|
- name : Job complete
|
||||||
|
debug :
|
||||||
|
msg :
|
||||||
|
- "tower_provision_host : {{ inventory_hostname }}"
|
||||||
|
- "tower_provision_failed : {{ r_check_file.failed }}"
|
||||||
|
|
||||||
|
|
||||||
|
####################
|
||||||
|
# END ALWAYS TASKS #
|
||||||
|
####################
|
||||||
|
|
||||||
|
|
||||||
|
...
|
103
notes/ldap_auth_notes.txt
Normal file
103
notes/ldap_auth_notes.txt
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
=================================
|
||||||
|
LDAP SERVER URI
|
||||||
|
=================================
|
||||||
|
ldap://10.10.42.250
|
||||||
|
|
||||||
|
|
||||||
|
=================================
|
||||||
|
LDAP BIND DN
|
||||||
|
=================================
|
||||||
|
CN=ansbl_ldap_svc,CN=Users,DC=thezengarden,DC=net
|
||||||
|
|
||||||
|
|
||||||
|
=================================
|
||||||
|
LDAP GROUP TYPE
|
||||||
|
=================================
|
||||||
|
ActiveDirectoryGroupType
|
||||||
|
|
||||||
|
|
||||||
|
=================================
|
||||||
|
LDAP USER SEARCH
|
||||||
|
=================================
|
||||||
|
[
|
||||||
|
"OU=tower_dev,DC=thezengarden,DC=net",
|
||||||
|
"SCOPE_SUBTREE",
|
||||||
|
"(sAMAccountName=%(user)s)"
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
=================================
|
||||||
|
LDAP GROUP SEARCH
|
||||||
|
=================================
|
||||||
|
[
|
||||||
|
"OU=tower_dev,DC=thezengarden,DC=net",
|
||||||
|
"SCOPE_SUBTREE",
|
||||||
|
"(objectClass=group)"
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
=================================
|
||||||
|
LDAP USER ATTRIBUTE MAP
|
||||||
|
=================================
|
||||||
|
{
|
||||||
|
"first_name": "givenName",
|
||||||
|
"last_name": "sn",
|
||||||
|
"email": "mail"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
=================================
|
||||||
|
LDAP USER FLAGS BY GROUP
|
||||||
|
=================================
|
||||||
|
{
|
||||||
|
"is_superuser": [
|
||||||
|
"CN=tower_dev_admins,OU=tower_dev,DC=thezengarden,DC=net"
|
||||||
|
],
|
||||||
|
"is_system_auditor": [
|
||||||
|
"CN=tower_dev_auditors,OU=tower_dev,DC=thezengarden,DC=net"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
=================================
|
||||||
|
LDAP ORGANIZATION MAP
|
||||||
|
=================================
|
||||||
|
{
|
||||||
|
"LDAP Lab": {
|
||||||
|
"users": [
|
||||||
|
"CN=tower_dev_auditors,OU=tower_dev,DC=thezengarden,DC=net",
|
||||||
|
"CN=tower_dev_users,OU=tower_dev,DC=thezengarden,DC=net"
|
||||||
|
],
|
||||||
|
"remove_admins": true,
|
||||||
|
"admins": "CN=tower_dev_admins,OU=tower_dev,DC=thezengarden,DC=net"
|
||||||
|
},
|
||||||
|
"CSV Inventory Demo": {
|
||||||
|
"users": [
|
||||||
|
"CN=tower_dev_demo,OU=tower_dev,DC=thezengarden,DC=net"
|
||||||
|
],
|
||||||
|
"remove_admins": true,
|
||||||
|
"admins": "CN=tower_dev_demo,OU=tower_dev,DC=thezengarden,DC=net"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
=================================
|
||||||
|
LDAP TEAM MAP
|
||||||
|
=================================
|
||||||
|
{
|
||||||
|
"LDAP Lab Admins": {
|
||||||
|
"users": "CN=tower_dev_admins,OU=tower_dev,DC=thezengarden,DC=net",
|
||||||
|
"organization": "LDAP Lab",
|
||||||
|
"remove": true
|
||||||
|
},
|
||||||
|
"LDAP Lab Auditors": {
|
||||||
|
"users": "CN=tower_dev_auditors,OU=tower_dev,DC=thezengarden,DC=net",
|
||||||
|
"organization": "LDAP Lab",
|
||||||
|
"remove": true
|
||||||
|
},
|
||||||
|
"LDAP Lab Users": {
|
||||||
|
"users": "CN=tower_dev_users,OU=tower_dev,DC=thezengarden,DC=net",
|
||||||
|
"organization": "LDAP Lab",
|
||||||
|
"remove": true
|
||||||
|
}
|
||||||
|
}
|
@ -28,27 +28,9 @@
|
|||||||
|
|
||||||
- name: Provision hosts defined via tower_webhook_payload
|
- name: Provision hosts defined via tower_webhook_payload
|
||||||
block:
|
block:
|
||||||
- name: Debug tower_webhook_payload
|
|
||||||
debug:
|
|
||||||
var: tower_webhook_payload
|
|
||||||
|
|
||||||
- name: Debug tower_webhook_payload.commits[0].added
|
|
||||||
debug:
|
|
||||||
msg: "{{ tower_webhook_payload.commits[0].added }}"
|
|
||||||
when:
|
|
||||||
- tower_webhook_payload.commits[0].added is defined
|
|
||||||
|
|
||||||
|
|
||||||
- name: Debug tower_webhook_payload.commits[0].modified
|
|
||||||
debug:
|
|
||||||
msg: "{{ tower_webhook_payload.commits[0].modified }}"
|
|
||||||
when:
|
|
||||||
- tower_webhook_payload.commits[0].modified is defined
|
|
||||||
|
|
||||||
|
|
||||||
- name: Set provision_host to Webhook files
|
- name: Set provision_host to Webhook files
|
||||||
set_fact:
|
set_fact:
|
||||||
provision_host: "{{ [item | split('/') | last] + provision_host | default([]) }}"
|
provision_host: "{{ [item.split('/') | last] + provision_host | default([]) }}"
|
||||||
loop: "{{ tower_webhook_payload.commits[0].added + tower_webhook_payload.commits[0].modified }}"
|
loop: "{{ tower_webhook_payload.commits[0].added + tower_webhook_payload.commits[0].modified }}"
|
||||||
|
|
||||||
- name: "Create in-memory inventory for Webhook"
|
- name: "Create in-memory inventory for Webhook"
|
||||||
|
18
utils/add_host.sh
Executable file
18
utils/add_host.sh
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
RUN_DATE=`date`
|
||||||
|
|
||||||
|
BASE_URL="tower2.thezengarden.net"
|
||||||
|
AAP_INVENTORY=8
|
||||||
|
POST_PAYLOAD_PATH="post.add_host"
|
||||||
|
POST_PAYLOAD_TYPE="application/json"
|
||||||
|
|
||||||
|
TOWER_TOKEN="jQwHURhs9fNNyombPLEAK8a2vRmmBQ"
|
||||||
|
|
||||||
|
curl -k -H "Authorization: Bearer ${TOWER_TOKEN}" \
|
||||||
|
-H "Content-type: ${POST_PAYLOAD_TYPE}" \
|
||||||
|
-X POST \
|
||||||
|
-d @"${POST_PAYLOAD_PATH}" \
|
||||||
|
"https://${BASE_URL}/api/v2/inventories/${AAP_INVENTORY}/hosts/"
|
||||||
|
|
||||||
|
|
18
utils/add_inv.sh
Executable file
18
utils/add_inv.sh
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
RUN_DATE=`date`
|
||||||
|
BASE_URL="tower2.thezengarden.net"
|
||||||
|
AAP_INVENTORY="LabTest ${RUN_DATE}"
|
||||||
|
POST_PAYLOAD_PATH="post.add_inv"
|
||||||
|
POST_PAYLOAD_TYPE="application/json"
|
||||||
|
|
||||||
|
#TOWER_TOKEN="jQwHURhs9fNNyombPLEAK8a2vRmmBQ"
|
||||||
|
TOWER_TOKEN="YtLStVtkMGKxnWinslNiqDgYwZqKfM"
|
||||||
|
|
||||||
|
curl -s -k -H "Authorization: Bearer ${TOWER_TOKEN}" \
|
||||||
|
-H "Content-type: ${POST_PAYLOAD_TYPE}" \
|
||||||
|
-X POST \
|
||||||
|
-d @"${POST_PAYLOAD_PATH}" \
|
||||||
|
"https://${BASE_URL}/api/v2/inventories/"
|
||||||
|
|
||||||
|
echo
|
18
utils/db.txt
Normal file
18
utils/db.txt
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/var/opt/rh/rh-postgresql10/lib/pgsql/data/postgresql.conf
|
||||||
|
----------------------------------------------------------
|
||||||
|
log_autovacuum_min_duration = '0'
|
||||||
|
log_checkpoints = 'True'
|
||||||
|
log_connections = 'True'
|
||||||
|
log_disconnections = 'True'
|
||||||
|
log_line_prefix = '%m [%r] [%p]: [l-%l] user=%u,db=%d,app=%a,e=%e, prcstm=%s '
|
||||||
|
log_lock_waits = 'True'
|
||||||
|
log_min_duration_statement = 900
|
||||||
|
|
||||||
|
max_connections = 512
|
||||||
|
shared_buffers = 4800MB
|
||||||
|
work_mem = 8MB
|
||||||
|
maintenance_work_mem = 600MB
|
||||||
|
effective_cache_size = 12000MB
|
||||||
|
|
||||||
|
|
||||||
|
select * from pg_settings where name like 'autovacuum%';
|
30
utils/dns_parse.pl
Executable file
30
utils/dns_parse.pl
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
my $BASE_URL="tower2.thezengarden.net";
|
||||||
|
my $AAP_INVENTORY=14;
|
||||||
|
my $CONTENT_TYPE="Content-type: application/json";
|
||||||
|
|
||||||
|
my $TOWER_TOKEN="Authorization: Bearer YtLStVtkMGKxnWinslNiqDgYwZqKfM";
|
||||||
|
|
||||||
|
my $csv = $ARGV[0];
|
||||||
|
|
||||||
|
open (CSV, "< $csv") or die "unable to read $csv: $0\n";
|
||||||
|
|
||||||
|
while (my $line = <CSV>)
|
||||||
|
{
|
||||||
|
chomp $line;
|
||||||
|
$line =~ s/\r//g;
|
||||||
|
|
||||||
|
my @host = split(/,/, $line);
|
||||||
|
|
||||||
|
next if $host[1] =~ /Not/;
|
||||||
|
|
||||||
|
my $json_args = "{\"name\": \"$host[1]\", \"description\": \"$host[0]\"}";
|
||||||
|
print "$json_args\n";
|
||||||
|
|
||||||
|
my $add_host_post = `curl -s -k -H \"$TOWER_TOKEN\" -H \"$CONTENT_TYPE\" -X POST -d '$json_args' \"https://$BASE_URL/api/v2/inventories/$AAP_INVENTORY/hosts/\"`;
|
||||||
|
print "$add_host_post\n";
|
||||||
|
}
|
||||||
|
|
5
utils/hi
Normal file
5
utils/hi
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
cat logfile.txt | grep "bytes in" | awk '{print "time: "$13, $14, $15, $16,"request_type: "$17, "endpoint: "$18, "output_bytes: "$21, "response_time: "$24" ms"}' | sed 's/\]/ /g'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
cat 2k_awx-uwsgi.log | grep "bytes in" | awk '{print "time: "$13, $14, $15, $16,"request_type: "$17, "endpoint: "$18, "output_bytes: "$21, "response_time: "$24" ms"}' | sed 's/\]/ /g'
|
23
utils/limit_test.sh
Executable file
23
utils/limit_test.sh
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
CONC="1"
|
||||||
|
REQU="1"
|
||||||
|
|
||||||
|
BASE_URL="tower2.thezengarden.net"
|
||||||
|
AAP_JOB_ID="63"
|
||||||
|
POST_PAYLOAD_PATH="provision.limit-dev"
|
||||||
|
POST_PAYLOAD_TYPE="application/json"
|
||||||
|
|
||||||
|
TOWER_USER="admin"
|
||||||
|
TOWER_PASS="redhat"
|
||||||
|
|
||||||
|
|
||||||
|
printf "\n%s\n" \
|
||||||
|
"# Running test ${ITER}"
|
||||||
|
ab -c "${CONC}" \
|
||||||
|
-n ${REQU} \
|
||||||
|
-A ${TOWER_USER}:${TOWER_PASS} \
|
||||||
|
-T "${POST_PAYLOAD_TYPE}" \
|
||||||
|
-v1 \
|
||||||
|
-p ${POST_PAYLOAD_PATH} "https://${BASE_URL}/api/v2/job_templates/${AAP_JOB_ID}/launch/" | \
|
||||||
|
grep "Failed requests\|Time taken for tests"
|
24
utils/metrics_load_test.sh
Executable file
24
utils/metrics_load_test.sh
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
CONC="10"
|
||||||
|
REQU="10"
|
||||||
|
|
||||||
|
#BASE_URL="tower2.thezengarden.net"
|
||||||
|
BASE_URL="10.10.42.225"
|
||||||
|
AAP_JOB_ID="57"
|
||||||
|
POST_PAYLOAD_TYPE="application/json"
|
||||||
|
|
||||||
|
TOWER_USER="admin"
|
||||||
|
TOWER_PASS="redhat"
|
||||||
|
|
||||||
|
|
||||||
|
printf "\n%s\n" \
|
||||||
|
"# Running test - ${REQU} requests / ${CONC} concurrency"
|
||||||
|
ab -c "${CONC}" \
|
||||||
|
-n ${REQU} \
|
||||||
|
-A ${TOWER_USER}:${TOWER_PASS} \
|
||||||
|
-T "${POST_PAYLOAD_TYPE}" \
|
||||||
|
-v1 \
|
||||||
|
"https://${BASE_URL}/api/v2/metrics/" | \
|
||||||
|
grep "Failed requests\|Time taken for tests"
|
||||||
|
|
1
utils/post.add_host
Normal file
1
utils/post.add_host
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"name": "sample-host-1", "description": "added via add_host.sh"}
|
1
utils/post.add_inv
Normal file
1
utils/post.add_inv
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"name": "isaac inventory", "organization": 1}
|
1
utils/provision.all
Normal file
1
utils/provision.all
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"extra_vars": {"tower_provision_host": "lab-dev-1,lab-dev-2,lab-dev-3,lab-test-1,lab-test-2,lab-test-3,lab-prod-1,lab-prod-2,lab-prod-3"}}
|
1
utils/provision.lab-dev-1
Normal file
1
utils/provision.lab-dev-1
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"extra_vars": {"tower_provision_host": "lab-dev-1"}}
|
5
utils/provision.limit-dev
Normal file
5
utils/provision.limit-dev
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{"extra_vars": {"tower_provision_host": "lab-test-1,lab-test-2,lab-test-3"},"limit": "lab-dev-1,lab-dev-4"}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
1
utils/provision.prod
Normal file
1
utils/provision.prod
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"extra_vars": {"tower_provision_host": "lab-prod-1,lab-prod-2,lab-prod-3"}}
|
1
utils/provision.test
Normal file
1
utils/provision.test
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"extra_vars": {"tower_provision_host": "lab-test-1,lab-test-2,lab-test-3"}}
|
@ -1,12 +1,16 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
CONC="50"
|
CONC="100"
|
||||||
REQU="100"
|
REQU="100"
|
||||||
|
|
||||||
BASE_URL="tower2.thezengarden.net"
|
BASE_URL="tower2.thezengarden.net"
|
||||||
AAP_JOB_ID="54"
|
AAP_JOB_ID="57"
|
||||||
#POST_PAYLOAD_PATH="empty.post"
|
#POST_PAYLOAD_PATH="empty.post"
|
||||||
POST_PAYLOAD_PATH="provision.post"
|
#POST_PAYLOAD_PATH="provision.lab-dev-1"
|
||||||
|
#POST_PAYLOAD_PATH="provision.dev"
|
||||||
|
#POST_PAYLOAD_PATH="provision.test"
|
||||||
|
#POST_PAYLOAD_PATH="provision.prod"
|
||||||
|
POST_PAYLOAD_PATH="provision.all"
|
||||||
POST_PAYLOAD_TYPE="application/json"
|
POST_PAYLOAD_TYPE="application/json"
|
||||||
|
|
||||||
TOWER_USER="jadmin"
|
TOWER_USER="jadmin"
|
||||||
@ -22,3 +26,4 @@ printf "\n%s\n" \
|
|||||||
-v1 \
|
-v1 \
|
||||||
-p ${POST_PAYLOAD_PATH} "https://${BASE_URL}/api/v2/job_templates/${AAP_JOB_ID}/launch/" | \
|
-p ${POST_PAYLOAD_PATH} "https://${BASE_URL}/api/v2/job_templates/${AAP_JOB_ID}/launch/" | \
|
||||||
grep "Failed requests\|Time taken for tests"
|
grep "Failed requests\|Time taken for tests"
|
||||||
|
|
||||||
|
3
utils/psql_lock_mon.sh
Executable file
3
utils/psql_lock_mon.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
for i in $(seq 3600); do date;psql awx -c 'select relation::regclass, * from pg_locks where not granted';sleep 1; done
|
27
utils/sample_inv.sh
Executable file
27
utils/sample_inv.sh
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
HOSTS=${1:-1}
|
||||||
|
|
||||||
|
RUN_DATE=`date`
|
||||||
|
|
||||||
|
BASE_URL="tower2.thezengarden.net"
|
||||||
|
#AAP_INVENTORY=9
|
||||||
|
AAP_INVENTORY=27
|
||||||
|
POST_PAYLOAD_PATH="post.add_host"
|
||||||
|
POST_PAYLOAD_TYPE="application/json"
|
||||||
|
|
||||||
|
#TOWER_TOKEN="jQwHURhs9fNNyombPLEAK8a2vRmmBQ"
|
||||||
|
TOWER_TOKEN="YtLStVtkMGKxnWinslNiqDgYwZqKfM"
|
||||||
|
|
||||||
|
|
||||||
|
for i in $(seq $HOSTS)
|
||||||
|
do
|
||||||
|
time curl -s -k -H "Authorization: Bearer ${TOWER_TOKEN}" \
|
||||||
|
-H "Content-type: ${POST_PAYLOAD_TYPE}" \
|
||||||
|
-X POST \
|
||||||
|
-d "{\"name\": \"sample-host-${i}\", \"description\": \"added via sample_inv.sh\"}" \
|
||||||
|
"https://${BASE_URL}/api/v2/inventories/${AAP_INVENTORY}/hosts/" | jq '{created_time:.["created"], hostname:.["name"], inventory:.["summary_fields"]["inventory"]["name"]}'
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
|
||||||
|
|
41
utils/sample_inv_concurrent.sh
Executable file
41
utils/sample_inv_concurrent.sh
Executable file
@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
trap "exit" INT TERM ERR
|
||||||
|
trap "kill 0" EXIT
|
||||||
|
|
||||||
|
HOSTS=${1:-50000}
|
||||||
|
|
||||||
|
SLEEP_TIME="0.05"
|
||||||
|
|
||||||
|
RUN_DATE=`date`
|
||||||
|
|
||||||
|
#$BASE_URL="tower2.thezengarden.net"
|
||||||
|
BASE_URL="10.10.42.225"
|
||||||
|
AAP_INVENTORY=42
|
||||||
|
POST_PAYLOAD_PATH="post.add_host"
|
||||||
|
POST_PAYLOAD_TYPE="application/json"
|
||||||
|
|
||||||
|
#TOWER_TOKEN="jQwHURhs9fNNyombPLEAK8a2vRmmBQ"
|
||||||
|
TOWER_TOKEN="YtLStVtkMGKxnWinslNiqDgYwZqKfM"
|
||||||
|
|
||||||
|
|
||||||
|
echo "Script start time: $(date '+%F %T %Z')"
|
||||||
|
|
||||||
|
|
||||||
|
for i in $(seq $HOSTS)
|
||||||
|
do
|
||||||
|
DESC_DATE=`date "+%F %T %Z"`
|
||||||
|
/usr/bin/time -f "%e" curl -s -k -H "Authorization: Bearer ${TOWER_TOKEN}" \
|
||||||
|
-H "Content-type: ${POST_PAYLOAD_TYPE}" \
|
||||||
|
-X POST \
|
||||||
|
-d "{\"name\": \"new-sample-host-${i}\", \"description\": \"added ${DESC_DATE}\"}" \
|
||||||
|
"https://${BASE_URL}/api/v2/inventories/${AAP_INVENTORY}/hosts/" | jq '{created_time:.["created"], hostname:.["name"], inventory:.["summary_fields"]["inventory"]["name"]}' &
|
||||||
|
sleep ${SLEEP_TIME}
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
|
||||||
|
wait
|
||||||
|
|
||||||
|
|
||||||
|
echo "Script end time: $(date '+%F %T %Z')"
|
||||||
|
|
3647
utils/soiuedfhsdf
Normal file
3647
utils/soiuedfhsdf
Normal file
File diff suppressed because it is too large
Load Diff
1
utils/stats.txt
Normal file
1
utils/stats.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
python /var/lib/awx/venv/awx/bin/uwsgitop /var/lib/awx/uwsgi.stats
|
23
utils/stress_test.sh
Executable file
23
utils/stress_test.sh
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
CONC="100"
|
||||||
|
REQU="10000"
|
||||||
|
|
||||||
|
BASE_URL="10.1.1.71"
|
||||||
|
AAP_JOB_ID="7"
|
||||||
|
POST_PAYLOAD_PATH="empty.post"
|
||||||
|
POST_PAYLOAD_TYPE="application/json"
|
||||||
|
|
||||||
|
TOWER_USER="admin"
|
||||||
|
TOWER_PASS="redhat"
|
||||||
|
|
||||||
|
|
||||||
|
printf "\n%s\n" \
|
||||||
|
"# Running test ${ITER}"
|
||||||
|
ab -c "${CONC}" \
|
||||||
|
-n ${REQU} \
|
||||||
|
-A ${TOWER_USER}:${TOWER_PASS} \
|
||||||
|
-T "${POST_PAYLOAD_TYPE}" \
|
||||||
|
-v1 \
|
||||||
|
-p ${POST_PAYLOAD_PATH} "https://${BASE_URL}/api/v2/job_templates/${AAP_JOB_ID}/launch/" | \
|
||||||
|
grep "Failed requests\|Time taken for tests"
|
23
utils/stress_test2.sh
Executable file
23
utils/stress_test2.sh
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
CONC="10"
|
||||||
|
REQU="100000"
|
||||||
|
|
||||||
|
BASE_URL="10.10.42.210"
|
||||||
|
AAP_JOB_ID="10"
|
||||||
|
POST_PAYLOAD_PATH="empty.post"
|
||||||
|
POST_PAYLOAD_TYPE="application/json"
|
||||||
|
|
||||||
|
TOWER_USER="admin"
|
||||||
|
TOWER_PASS="redhat"
|
||||||
|
|
||||||
|
|
||||||
|
printf "\n%s\n" \
|
||||||
|
"# Running test ${ITER}"
|
||||||
|
ab -c "${CONC}" \
|
||||||
|
-n ${REQU} \
|
||||||
|
-A ${TOWER_USER}:${TOWER_PASS} \
|
||||||
|
-T "${POST_PAYLOAD_TYPE}" \
|
||||||
|
-v1 \
|
||||||
|
-p ${POST_PAYLOAD_PATH} "https://${BASE_URL}/api/v2/job_templates/${AAP_JOB_ID}/launch/" | \
|
||||||
|
grep "Failed requests\|Time taken for tests"
|
@ -1 +0,0 @@
|
|||||||
|
|
@ -1,14 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
CONC="10"
|
CONC="1"
|
||||||
REQU="10"
|
REQU="1"
|
||||||
|
|
||||||
BASE_URL="tower2.thezengarden.net"
|
#BASE_URL="tower2.thezengarden.net"
|
||||||
AAP_JOB_ID="54"
|
BASE_URL="10.10.42.225"
|
||||||
|
AAP_JOB_ID="7"
|
||||||
POST_PAYLOAD_PATH="empty.post"
|
POST_PAYLOAD_PATH="empty.post"
|
||||||
POST_PAYLOAD_TYPE="application/json"
|
POST_PAYLOAD_TYPE="application/json"
|
||||||
|
|
||||||
TOWER_USER="jadmin"
|
TOWER_USER="admin"
|
||||||
TOWER_PASS="redhat"
|
TOWER_PASS="redhat"
|
||||||
|
|
||||||
|
|
||||||
|
23
utils/tower_test_workflow.sh
Executable file
23
utils/tower_test_workflow.sh
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
CONC="1"
|
||||||
|
REQU="1"
|
||||||
|
|
||||||
|
BASE_URL="tower2.thezengarden.net"
|
||||||
|
AAP_JOB_ID="54"
|
||||||
|
POST_PAYLOAD_PATH="empty.post"
|
||||||
|
POST_PAYLOAD_TYPE="application/json"
|
||||||
|
|
||||||
|
TOWER_USER="jadmin"
|
||||||
|
TOWER_PASS="redhat"
|
||||||
|
|
||||||
|
|
||||||
|
printf "\n%s\n" \
|
||||||
|
"# Running test ${ITER}"
|
||||||
|
ab -c "${CONC}" \
|
||||||
|
-n ${REQU} \
|
||||||
|
-A ${TOWER_USER}:${TOWER_PASS} \
|
||||||
|
-T "${POST_PAYLOAD_TYPE}" \
|
||||||
|
-v1 \
|
||||||
|
-p ${POST_PAYLOAD_PATH} "https://${BASE_URL}/api/v2/workflow_job_templates/${AAP_JOB_ID}/launch/" | \
|
||||||
|
grep "Failed requests\|Time taken for tests"
|
7
utils/vacuum.txt
Normal file
7
utils/vacuum.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
2023-02-24 17:55:36.937 UTC [] [23254]: [l-1] user=,db=,app=,e=00000, prcstm=2023-02-24 17:55:36 UTC LOG: automatic vacuum of table "awx.public.main_job": index scans: 1
|
||||||
|
2023-02-24 17:55:37.289 UTC [] [23254]: [l-4] user=,db=,app=,e=00000, prcstm=2023-02-24 17:55:36 UTC LOG: automatic vacuum of table "awx.public.main_host": index scans: 1
|
||||||
|
2023-02-24 17:55:37.449 UTC [] [23254]: [l-6] user=,db=,app=,e=00000, prcstm=2023-02-24 17:55:36 UTC LOG: automatic vacuum of table "awx.public.main_unifiedjob": index scans: 1
|
||||||
|
2023-02-24 17:55:37.573 UTC [] [23254]: [l-9] user=,db=,app=,e=00000, prcstm=2023-02-24 17:55:36 UTC LOG: automatic vacuum of table "awx.public.main_unifiedjobtemplate": index scans: 1
|
||||||
|
2023-02-24 17:55:37.634 UTC [] [23254]: [l-11] user=,db=,app=,e=00000, prcstm=2023-02-24 17:55:36 UTC LOG: automatic vacuum of table "awx.public.main_towerschedulestate": index scans: 0
|
||||||
|
2023-02-24 17:55:37.724 UTC [] [23254]: [l-13] user=,db=,app=,e=00000, prcstm=2023-02-24 17:55:36 UTC LOG: automatic vacuum of table "awx.pg_toast.pg_toast_2619": index scans: 1
|
||||||
|
|
@ -2,7 +2,7 @@
|
|||||||
check_file: /tmp/hello-ansible.txt
|
check_file: /tmp/hello-ansible.txt
|
||||||
|
|
||||||
|
|
||||||
__no_log: yes
|
__no_log: no
|
||||||
|
|
||||||
|
|
||||||
tower_url : 'https://tower2.thezengarden.net'
|
tower_url : 'https://tower2.thezengarden.net'
|
||||||
@ -24,7 +24,7 @@ tower_remdiation_workflow : "{{ tower_url}}/api/v2/workflow_job_templates/\
|
|||||||
|
|
||||||
gitlab_url : 'https://git.thezengarden.net'
|
gitlab_url : 'https://git.thezengarden.net'
|
||||||
gitlab_proj_id : 119
|
gitlab_proj_id : 119
|
||||||
gitlab_pat : "glpat-zLk2Sxv4BfySjuTy5G2q"
|
gitlab_pat : "glpat-8--g8Ji2xqEuww2z8Tru"
|
||||||
gitlab_commit_url : "{{ gitlab_url }}/api/v4/projects/{{ gitlab_proj_id }}\
|
gitlab_commit_url : "{{ gitlab_url }}/api/v4/projects/{{ gitlab_proj_id }}\
|
||||||
/repository/commits"
|
/repository/commits"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user