Skip to content

Commit

Permalink
Create container to run ansible playbooks from
Browse files Browse the repository at this point in the history
Create container to run ansible playbooks from.
This container is meantto be used for NFV
performance test runs using test operator
  • Loading branch information
eshulman2 committed Jun 27, 2024
1 parent b478187 commit 0de9ddd
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 1 deletion.
2 changes: 1 addition & 1 deletion container-images/containers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ container_images:
- imagename: quay.io/podified-master-centos9/openstack-heat-api:current-podified
- imagename: quay.io/podified-master-centos9/openstack-heat-engine:current-podified
- imagename: quay.io/podified-master-centos9/openstack-horizon:current-podified
- imagename: quay.io/podified-master-centos9/openstack-horizontest:current-podified
- imagename: quay.io/podified-master-centos9/openstack-ironic-api:current-podified
- imagename: quay.io/podified-master-centos9/openstack-ironic-conductor:current-podified
- imagename: quay.io/podified-master-centos9/openstack-ironic-inspector:current-podified
Expand Down Expand Up @@ -75,4 +74,5 @@ container_images:
- imagename: quay.io/podified-master-centos9/openstack-tempest-all:current-podified
- imagename: quay.io/podified-master-centos9/openstack-tempest-extras:current-podified
- imagename: quay.io/podified-master-centos9/openstack-tobiko:current-podified
- imagename: quay.io/podified-master-centos9/test_performance:current-podified
- imagename: quay.io/podified-master-centos9/openstack-openstackclient:current-podified
1 change: 1 addition & 0 deletions container-images/kolla/base/uid_gid_manage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ _SUPPORTED_USERS['swift']='swift 42445 42445 /var/lib/swift kolla'
_SUPPORTED_USERS['tempest']='tempest 42480 42480 /var/lib/tempest kolla'
_SUPPORTED_USERS['tobiko']='tobiko 42495 42495 /var/lib/tobiko kolla'
_SUPPORTED_USERS['tss']='tss 59 59'
_SUPPORTED_USERS['perf']='perf 227 227 /var/lib/perf kolla'

for _USER_TO_CREATE in $_USERS_TO_CREATE; do
# Initialize computed args
Expand Down
24 changes: 24 additions & 0 deletions container-images/tcib/base/test_performance/NFVperf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
tcib_envs:
USE_EXTERNAL_FILES: true
tcib_actions:
- run: bash /usr/local/bin/uid_gid_manage {{ tcib_user }}
- run: dnf -y install {{ tcib_packages.common | join(' ') }} && dnf clean all && rm -rf /var/cache/dnf
- run: pip3 install ansible==2.9.27 openstacksdk
- run: cp /usr/share/tcib/container-images/tcib/base/test_performance/run_perf.sh /var/lib/perf/run_perf.sh
- run: chmod +x /var/lib/perf/run_perf.sh
- run: chown -R perf:perf /var/lib/perf

tcib_entrypoint: /var/lib/perf/run_perf.sh

tcib_packages:
common:
- gcc
- git
- python3
- python3-devel
- python3-pip
- python3-setuptools
- libffi-devel
- rsync

tcib_user: perf
1 change: 1 addition & 0 deletions container-images/tcib/base/test_performance/perf_sudoers
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
perf ALL=(ALL) NOPASSWD: ALL
41 changes: 41 additions & 0 deletions container-images/tcib/base/test_performance/run_perf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

set -euo pipefail

ANSIBLE_DIR="/var/lib/perf/ansible"

# Check and set ansible debug verbosity
ANSIBLE_DEBUG=""
if [[ ${PERF_DEBUG:-true} == true ]]; then
ANSIBLE_DEBUG="-vvvv"
fi

# Clone the Ansible repository
git clone "$PERF_ANSIBLE_GIT_REPO" "$ANSIBLE_DIR"

# Handle extra vars file if provided
if [[ -n "${PERF_ANSIBLE_FILE_EXTRA_VARS:-}" ]]; then
echo "$PERF_ANSIBLE_FILE_EXTRA_VARS" > "$ANSIBLE_DIR/extra_vars.yaml"
ANSIBLE_FILE_EXTRA_VARS_PARAM="-e @$ANSIBLE_DIR/extra_vars.yaml"
fi

# Handle inventory file if provided
if [[ -n "${PERF_ANSIBLE_INVENTORY:-}" ]]; then
echo "$PERF_ANSIBLE_INVENTORY" > "$ANSIBLE_DIR/inventory"
fi

# Install collections if specified
if [[ -n "${INSTALL_COLLECTIONS:-}" ]]; then
ansible-galaxy collection install "$INSTALL_COLLECTIONS"
fi

# Install collections from requirements.yaml if the file exists
if [[ -f "$ANSIBLE_DIR/requirements.yaml" ]]; then
ansible-galaxy collection install -r "$ANSIBLE_DIR/requirements.yaml"
else
echo "requirements.yaml doesn't exist, skipping requirements installation"
fi

# Navigate to ansible directory and run playbook
cd "$ANSIBLE_DIR"
ansible-playbook "$ANSIBLE_PERF_PLAYBOOK" $ANSIBLE_DEBUG -i $ANSIBLE_DIR/inventory $PERF_ANSIBLE_EXTRA_VARS $ANSIBLE_FILE_EXTRA_VARS_PARAM
1 change: 1 addition & 0 deletions repo-setup
Submodule repo-setup added at b91467

0 comments on commit 0de9ddd

Please sign in to comment.