Fix ansible path for elk_metrics_6x tests

Fix the failing elk_metrics_6x tests by changing the ansible venv path
to ~/ansible_venv.  Update tests to ensure when the bootstrap ansible
script changes both osquery and elk_metrics_6x tests are run.

Change-Id: Ic79c52ae21294373ca67be264fd287fdf32b4c9a
This commit is contained in:
Michael Vollman 2018-11-01 10:33:20 -04:00 committed by Kevin Carter
parent 58c7890bfc
commit b5ed2d024f
10 changed files with 62 additions and 60 deletions

View File

@ -19,7 +19,7 @@ Usage
source bootstrap-embedded-ansible.sh
With the script sourced, the ansible enviornment will create a virtual environment at
`${HOME}/ansible${ANSIBLE_VERSION}` if it does not already exist.
With the script sourced, the ansible environment will create a virtual environment at
`${HOME}/ansible_venv` if it does not already exist.
To leave the embedded ansible enviornment run the function `deactivate`.

View File

@ -15,7 +15,7 @@
export OPTS=()
export ANSIBLE_VERSION="${ANSIBLE_VERSION:-2.5.5.0}"
export ANSIBLE_EMBED_HOME="${HOME}/ansible${ANSIBLE_VERSION}"
export ANSIBLE_EMBED_HOME="${HOME}/ansible_venv"
OPTS+=('ANSIBLE_EMBED_HOME')
source /etc/os-release

View File

@ -60,7 +60,7 @@
reload: "yes"
sysctl_file: /etc/sysctl.d/99-elasticsearch.conf
- name: Create tmp osquery dir
- name: Create tmp elk_metrics_6x dir
file:
path: "/tmp/elk-metrics-6x-logs"
state: directory
@ -98,26 +98,26 @@
- name: Run ansible-galaxy (tests)
become: yes
become_user: root
command: "/root/ansible25/bin/ansible-galaxy install --force --ignore-errors --roles-path=/root/ansible25/repositories/roles -r ansible-role-requirements.yml"
command: "${HOME}/ansible_venv/bin/ansible-galaxy install --force --ignore-errors --roles-path=${HOME}/ansible_venv/repositories/roles -r ansible-role-requirements.yml"
args:
chdir: "src/{{ current_test_repo }}/osquery/tests"
chdir: "src/{{ current_test_repo }}/elk_metrics_6x/tests"
- name: Run ansible-galaxy (elk_metrics_6x)
become: yes
become_user: root
command: "/root/ansible25/bin/ansible-galaxy install --force --ignore-errors --roles-path=/root/ansible25/repositories/roles -r ansible-role-requirements.yml"
command: "${HOME}/ansible_venv/bin/ansible-galaxy install --force --ignore-errors --roles-path=${HOME}/ansible_venv/repositories/roles -r ansible-role-requirements.yml"
args:
chdir: "src/{{ current_test_repo }}/osquery"
chdir: "src/{{ current_test_repo }}/elk_metrics_6x"
- name: Run environment setup
become: yes
become_user: root
command: "/root/ansible25/bin/ansible-playbook -i {{ inventory_file }} -e @test-vars.yml _key-setup.yml"
command: "${HOME}/ansible_venv/bin/ansible-playbook -i {{ inventory_file }} -e @test-vars.yml _key-setup.yml"
environment:
ANSIBLE_ACTION_PLUGINS: "/root/ansible25/repositories/ansible-config_template/action"
ANSIBLE_CONNECTION_PLUGINS: "/root/ansible25/repositories/openstack-ansible-plugins/connection"
ANSIBLE_ACTION_PLUGINS: "${HOME}/ansible_venv/repositories/ansible-config_template/action"
ANSIBLE_CONNECTION_PLUGINS: "${HOME}/ansible_venv/repositories/openstack-ansible-plugins/connection"
ANSIBLE_LOG_PATH: "/tmp/elk-metrics-6x-logs/ansible-elk-test-container-setup.log"
ANSIBLE_ROLES_PATH: /root/ansible25/repositories/roles
ANSIBLE_ROLES_PATH: "${HOME}/ansible_venv/repositories/roles"
args:
chdir: "src/{{ current_test_repo }}/elk_metrics_6x/tests"
when:
@ -127,12 +127,12 @@
- name: Run environment setup
become: yes
become_user: root
command: "/root/ansible25/bin/ansible-playbook -i {{ inventory_file }} -e @test-vars.yml _container-setup.yml"
command: "${HOME}/ansible_venv/bin/ansible-playbook -i {{ inventory_file }} -e @test-vars.yml _container-setup.yml"
environment:
ANSIBLE_ACTION_PLUGINS: "/root/ansible25/repositories/ansible-config_template/action"
ANSIBLE_CONNECTION_PLUGINS: "/root/ansible25/repositories/openstack-ansible-plugins/connection"
ANSIBLE_ACTION_PLUGINS: "${HOME}/ansible_venv/repositories/ansible-config_template/action"
ANSIBLE_CONNECTION_PLUGINS: "${HOME}/ansible_venv/repositories/openstack-ansible-plugins/connection"
ANSIBLE_LOG_PATH: "/tmp/elk-metrics-6x-logs/ansible-elk-test-container-setup.log"
ANSIBLE_ROLES_PATH: /root/ansible25/repositories/roles
ANSIBLE_ROLES_PATH: "${HOME}/ansible_venv/repositories/roles"
args:
chdir: "src/{{ current_test_repo }}/elk_metrics_6x/tests"
when:
@ -148,23 +148,23 @@
- name: Run functional test
become: yes
become_user: root
command: "/root/ansible25/bin/ansible-playbook -i tests/{{ inventory_file }} -e @tests/test-vars.yml site.yml"
command: "${HOME}/ansible_venv/bin/ansible-playbook -i tests/{{ inventory_file }} -e @tests/test-vars.yml site.yml"
environment:
ANSIBLE_ACTION_PLUGINS: "/root/ansible25/repositories/ansible-config_template/action"
ANSIBLE_CONNECTION_PLUGINS: "/root/ansible25/repositories/openstack-ansible-plugins/connection"
ANSIBLE_ACTION_PLUGINS: "${HOME}/ansible_venv/repositories/ansible-config_template/action"
ANSIBLE_CONNECTION_PLUGINS: "${HOME}/ansible_venv/repositories/openstack-ansible-plugins/connection"
ANSIBLE_LOG_PATH: "/tmp/elk-metrics-6x-logs/ansible-elk-test-deployment.log"
ANSIBLE_ROLES_PATH: /root/ansible25/repositories/roles
ANSIBLE_ROLES_PATH: "${HOME}/ansible_venv/repositories/roles"
args:
chdir: "src/{{ current_test_repo }}/elk_metrics_6x"
- name: Show cluster state
become: yes
become_user: root
command: "/root/ansible25/bin/ansible-playbook -i tests/{{ inventory_file }} -e @tests/test-vars.yml showElasticCluster.yml"
command: "${HOME}/ansible_venv/bin/ansible-playbook -i tests/{{ inventory_file }} -e @tests/test-vars.yml showElasticCluster.yml"
environment:
ANSIBLE_ACTION_PLUGINS: "/root/ansible25/repositories/ansible-config_template/action"
ANSIBLE_CONNECTION_PLUGINS: "/root/ansible25/repositories/openstack-ansible-plugins/connection"
ANSIBLE_ACTION_PLUGINS: "${HOME}/ansible_venv/repositories/ansible-config_template/action"
ANSIBLE_CONNECTION_PLUGINS: "${HOME}/ansible_venv/repositories/openstack-ansible-plugins/connection"
ANSIBLE_LOG_PATH: "/tmp/elk-metrics-6x-logs/ansible-elk-test-show-cluster.log"
ANSIBLE_ROLES_PATH: /root/ansible25/repositories/roles
ANSIBLE_ROLES_PATH: "${HOME}/ansible_venv/repositories/roles"
args:
chdir: "src/{{ current_test_repo }}/elk_metrics_6x"

View File

@ -1,7 +1,7 @@
export ANSIBLE_HOST_KEY_CHECKING="False"
export ANSIBLE_ROLES_PATH="${HOME}/ansible25/repositories/roles"
export ANSIBLE_ACTION_PLUGINS="${HOME}/ansible25/repositories/roles/config_template/action"
export ANSIBLE_CONNECTION_PLUGINS="${HOME}/ansible25/repositories/roles/plugins/connection"
export ANSIBLE_ROLES_PATH="${HOME}/ansible_venv/repositories/roles"
export ANSIBLE_ACTION_PLUGINS="${HOME}/ansible_venv/repositories/roles/config_template/action"
export ANSIBLE_CONNECTION_PLUGINS="${HOME}/ansible_venv/repositories/roles/plugins/connection"
export ANSIBLE_LOG_PATH="/tmp/elk-metrics-6x-logs/ansible-elk-test.log"
if [[ ! -d "/tmp/elk-metrics-6x-logs" ]]; then
@ -10,7 +10,7 @@ if [[ ! -d "/tmp/elk-metrics-6x-logs" ]]; then
fi
echo "To build a test environment run the following:"
echo -e "# /root/ansible25/bin/ansible-playbook -i tests/inventory/test-container-inventory.yml tests/test.yml --limit localhost\n"
echo -e "# ${HOME}/ansible_venv/bin/ansible-playbook -i tests/inventory/test-container-inventory.yml tests/test.yml --limit localhost\n"
echo "Run manual functional tests by executing the following:"
echo -e "# /root/ansible25/bin/ansible-playbook -i tests/inventory/test-container-inventory.yml site.yml\n"
echo -e "# ${HOME}/ansible_venv/bin/ansible-playbook -i tests/inventory/test-container-inventory.yml site.yml\n"

View File

@ -26,20 +26,20 @@ pushd "${HOME}"
popd
popd
source "${TEST_DIR}/osquery/tests/manual-test.rc"
source "${TEST_DIR}/elk_metrics_6x/tests/manual-test.rc"
source "${TEST_DIR}/osquery/bootstrap-embedded-ansible.sh"
source "${TEST_DIR}/elk_metrics_6x/bootstrap-embedded-ansible.sh"
deactivate
${HOME}/ansible25/bin/ansible-galaxy install --force \
--roles-path="${HOME}/ansible25/repositories/roles" \
${HOME}/ansible_venv/bin/ansible-galaxy install --force \
--roles-path="${HOME}/ansible_venv/repositories/roles" \
--role-file="${TEST_DIR}/elk_metrics_6x/tests/ansible-role-requirements.yml"
if [[ ! -e "${TEST_DIR}/osquery/tests/src" ]]; then
ln -s ${TEST_DIR}/../ ${TEST_DIR}/osquery/tests/src
if [[ ! -e "${TEST_DIR}/elk_metrics_6x/tests/src" ]]; then
ln -s ${TEST_DIR}/../ ${TEST_DIR}/elk_metrics_6x/tests/src
fi
${HOME}/ansible25/bin/ansible-playbook -i 'localhost,' \
${HOME}/ansible_venv/bin/ansible-playbook -i 'localhost,' \
-vv \
-e ansible_connection=local \
-e test_clustered_elk=${CLUSTERED:-no} \

View File

@ -129,14 +129,14 @@ the `bootstrap-ansible.sh` script these dependencies can be resolved with the
.. code-block:: bash
ansible-galaxy install -r ansible-role-requirements.yml --roles-path=~/ansible25/repositories/roles
ansible-galaxy install -r ansible-role-requirements.yml --roles-path=~/ansible_venv/repositories/roles
In the even that some of the modules are alread installed execute the following
.. code-block:: bash
ansible-galaxy install -r ansible-role-requirements.yml --ignore-errors --roles-path=~/ansible25/repositories/roles
ansible-galaxy install -r ansible-role-requirements.yml --ignore-errors --roles-path=~/ansible_venv/repositories/roles
Once the dependencies are set make sure to set the action plugin path to the

View File

@ -98,26 +98,26 @@
- name: Run ansible-galaxy (tests)
become: yes
become_user: root
command: "/root/ansible25/bin/ansible-galaxy install --force --ignore-errors --roles-path=/root/ansible25/repositories/roles -r ansible-role-requirements.yml"
command: "${HOME}/ansible_venv/bin/ansible-galaxy install --force --ignore-errors --roles-path=${HOME}/ansible_venv/repositories/roles -r ansible-role-requirements.yml"
args:
chdir: "src/{{ current_test_repo }}/osquery/tests"
- name: Run ansible-galaxy (osquery)
become: yes
become_user: root
command: "/root/ansible25/bin/ansible-galaxy install --force --ignore-errors --roles-path=/root/ansible25/repositories/roles -r ansible-role-requirements.yml"
command: "${HOME}/ansible_venv/bin/ansible-galaxy install --force --ignore-errors --roles-path=${HOME}/ansible_venv/repositories/roles -r ansible-role-requirements.yml"
args:
chdir: "src/{{ current_test_repo }}/osquery"
- name: Run environment setup
become: yes
become_user: root
command: "/root/ansible25/bin/ansible-playbook -i {{ inventory_file }} -e @test-vars.yml _key-setup.yml"
command: "${HOME}/ansible_venv/bin/ansible-playbook -i {{ inventory_file }} -e @test-vars.yml _key-setup.yml"
environment:
ANSIBLE_ACTION_PLUGINS: "/root/ansible25/repositories/ansible-config_template/action"
ANSIBLE_CONNECTION_PLUGINS: "/root/ansible25/repositories/openstack-ansible-plugins/connection"
ANSIBLE_ACTION_PLUGINS: "${HOME}/ansible_venv/repositories/ansible-config_template/action"
ANSIBLE_CONNECTION_PLUGINS: "${HOME}/ansible_venv/repositories/openstack-ansible-plugins/connection"
ANSIBLE_LOG_PATH: "/tmp/osquery-logs/ansible-osquery-test-container-setup.log"
ANSIBLE_ROLES_PATH: /root/ansible25/repositories/roles
ANSIBLE_ROLES_PATH: "${HOME}/ansible_venv/repositories/roles"
args:
chdir: "src/{{ current_test_repo }}/osquery/tests"
when:
@ -127,12 +127,12 @@
- name: Run environment setup
become: yes
become_user: root
command: "/root/ansible25/bin/ansible-playbook -i {{ inventory_file }} -e @test-vars.yml _container-setup.yml"
command: "${HOME}/ansible_venv/bin/ansible-playbook -i {{ inventory_file }} -e @test-vars.yml _container-setup.yml"
environment:
ANSIBLE_ACTION_PLUGINS: "/root/ansible25/repositories/ansible-config_template/action"
ANSIBLE_CONNECTION_PLUGINS: "/root/ansible25/repositories/openstack-ansible-plugins/connection"
ANSIBLE_ACTION_PLUGINS: "${HOME}/ansible_venv/repositories/ansible-config_template/action"
ANSIBLE_CONNECTION_PLUGINS: "${HOME}/ansible_venv/repositories/openstack-ansible-plugins/connection"
ANSIBLE_LOG_PATH: "/tmp/osquery-logs/ansible-osquery-test-container-setup.log"
ANSIBLE_ROLES_PATH: /root/ansible25/repositories/roles
ANSIBLE_ROLES_PATH: "${HOME}/ansible_venv/repositories/roles"
args:
chdir: "src/{{ current_test_repo }}/osquery/tests"
when:
@ -148,11 +148,11 @@
- name: Run functional test
become: yes
become_user: root
command: "/root/ansible25/bin/ansible-playbook -i tests/{{ inventory_file }} -e @tests/test-vars.yml site.yml"
command: "${HOME}/ansible_venv/bin/ansible-playbook -i tests/{{ inventory_file }} -e @tests/test-vars.yml site.yml"
environment:
ANSIBLE_ACTION_PLUGINS: "/root/ansible25/repositories/ansible-config_template/action"
ANSIBLE_CONNECTION_PLUGINS: "/root/ansible25/repositories/openstack-ansible-plugins/connection"
ANSIBLE_ACTION_PLUGINS: "${HOME}/ansible_venv/repositories/ansible-config_template/action"
ANSIBLE_CONNECTION_PLUGINS: "${HOME}/ansible_venv/repositories/openstack-ansible-plugins/connection"
ANSIBLE_LOG_PATH: "/tmp/osquery-logs/ansible-osquery-test-deployment.log"
ANSIBLE_ROLES_PATH: /root/ansible25/repositories/roles
ANSIBLE_ROLES_PATH: "${HOME}/ansible_venv/repositories/roles"
args:
chdir: "src/{{ current_test_repo }}/osquery"

View File

@ -1,7 +1,7 @@
export ANSIBLE_HOST_KEY_CHECKING="False"
export ANSIBLE_ROLES_PATH="${HOME}/ansible25/repositories/roles"
export ANSIBLE_ACTION_PLUGINS="${HOME}/ansible25/repositories/roles/config_template/action"
export ANSIBLE_CONNECTION_PLUGINS="${HOME}/ansible25/repositories/roles/plugins/connection"
export ANSIBLE_ROLES_PATH="${HOME}/ansible_venv/repositories/roles"
export ANSIBLE_ACTION_PLUGINS="${HOME}/ansible_venv/repositories/roles/config_template/action"
export ANSIBLE_CONNECTION_PLUGINS="${HOME}/ansible_venv/repositories/roles/plugins/connection"
export ANSIBLE_LOG_PATH="/tmp/osquery-logs/ansible-elk-test.log"
if [[ ! -d "/tmp/osquery-logs" ]]; then
@ -10,7 +10,7 @@ if [[ ! -d "/tmp/osquery-logs" ]]; then
fi
echo "To build a test environment run the following:"
echo -e "# /root/ansible25/bin/ansible-playbook -i tests/inventory/test-container-inventory.yml tests/test.yml --limit localhost\n"
echo -e "# ${HOME}/ansible_venv/bin/ansible-playbook -i tests/inventory/test-container-inventory.yml tests/test.yml --limit localhost\n"
echo "Run manual functional tests by executing the following:"
echo -e "# /root/ansible25/bin/ansible-playbook -i tests/inventory/test-container-inventory.yml site.yml\n"
echo -e "# ${HOME}/ansible_venv/bin/ansible-playbook -i tests/inventory/test-container-inventory.yml site.yml\n"

View File

@ -31,15 +31,15 @@ source "${TEST_DIR}/osquery/tests/manual-test.rc"
source "${TEST_DIR}/osquery/bootstrap-embedded-ansible.sh"
deactivate
${HOME}/ansible25/bin/ansible-galaxy install --force \
--roles-path="${HOME}/ansible25/repositories/roles" \
${HOME}/ansible_venv/bin/ansible-galaxy install --force \
--roles-path="${HOME}/ansible_venv/repositories/roles" \
--role-file="${TEST_DIR}/osquery/tests/ansible-role-requirements.yml"
if [[ ! -e "${TEST_DIR}/osquery/tests/src" ]]; then
ln -s ${TEST_DIR}/../ ${TEST_DIR}/osquery/tests/src
fi
${HOME}/ansible25/bin/ansible-playbook -i 'localhost,' \
${HOME}/ansible_venv/bin/ansible-playbook -i 'localhost,' \
-vv \
-e ansible_connection=local \
-e test_clustered_kolide=${CLUSTERED:-no} \

View File

@ -21,6 +21,7 @@
post-run: "elk_metrics_6x/tests/post-run.yml"
files:
- ^elk_metrics_6x/.*
- ^bootstrap-embedded-ansible/.*
vars:
osa_test_repo: "openstack/openstack-ansible-ops"
test_clustered_elk: false
@ -93,6 +94,7 @@
voting: true
files:
- ^osquery/.*
- ^bootstrap-embedded-ansible/.*
- job:
name: "openstack-ansible-ops:osquery-ubuntu-xenial-clustered"