diff --git a/bootstrap-embedded-ansible/README.rst b/bootstrap-embedded-ansible/README.rst index 18ade5b5..3b6df850 100644 --- a/bootstrap-embedded-ansible/README.rst +++ b/bootstrap-embedded-ansible/README.rst @@ -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`. diff --git a/bootstrap-embedded-ansible/bootstrap-embedded-ansible.sh b/bootstrap-embedded-ansible/bootstrap-embedded-ansible.sh index 18f49267..961d6534 100755 --- a/bootstrap-embedded-ansible/bootstrap-embedded-ansible.sh +++ b/bootstrap-embedded-ansible/bootstrap-embedded-ansible.sh @@ -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 diff --git a/elk_metrics_6x/tests/functional.yml b/elk_metrics_6x/tests/functional.yml index e37bc9e1..ea7bec4f 100644 --- a/elk_metrics_6x/tests/functional.yml +++ b/elk_metrics_6x/tests/functional.yml @@ -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" diff --git a/elk_metrics_6x/tests/manual-test.rc b/elk_metrics_6x/tests/manual-test.rc index 7a1158cc..2222ac0c 100644 --- a/elk_metrics_6x/tests/manual-test.rc +++ b/elk_metrics_6x/tests/manual-test.rc @@ -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" diff --git a/elk_metrics_6x/tests/run-tests.sh b/elk_metrics_6x/tests/run-tests.sh index 43fcd356..559f3c09 100755 --- a/elk_metrics_6x/tests/run-tests.sh +++ b/elk_metrics_6x/tests/run-tests.sh @@ -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} \ diff --git a/osquery/README.rst b/osquery/README.rst index 8ab246bb..571400e8 100644 --- a/osquery/README.rst +++ b/osquery/README.rst @@ -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 diff --git a/osquery/tests/functional.yml b/osquery/tests/functional.yml index b0d468be..6cf6fcb3 100644 --- a/osquery/tests/functional.yml +++ b/osquery/tests/functional.yml @@ -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" diff --git a/osquery/tests/manual-test.rc b/osquery/tests/manual-test.rc index 59460552..afc9b08f 100644 --- a/osquery/tests/manual-test.rc +++ b/osquery/tests/manual-test.rc @@ -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" diff --git a/osquery/tests/run-tests.sh b/osquery/tests/run-tests.sh index 888b0447..e09c8f44 100755 --- a/osquery/tests/run-tests.sh +++ b/osquery/tests/run-tests.sh @@ -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} \ diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 5662d6c7..73f3c122 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -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"