diff --git a/Ansible/roles/marvin/tasks/install_marvin_prereqs.yml b/Ansible/roles/marvin/tasks/install_marvin_prereqs.yml index 155ac7ac2b..9fd11ca4cd 100644 --- a/Ansible/roles/marvin/tasks/install_marvin_prereqs.yml +++ b/Ansible/roles/marvin/tasks/install_marvin_prereqs.yml @@ -28,22 +28,17 @@ - marvin_cfg - marvin_install -- include: ../../../tasks/set_centos_repos.yml - tags: - - marvin - - marvin_install - name: Install Dev Tools Group - yum: name="@Development tools" state=installed update_cache=yes + dnf: name="@Development tools" state=installed tags: - marvin - marvin_cfg - marvin_install - name: Install other dependancies - yum: name={{ item }} state=installed update_cache=yes + dnf: name={{ item }} state=installed with_items: - - 'http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm' - zlib-devel - bzip2-devel - openssl-devel @@ -51,12 +46,8 @@ - wget - sqlite - sqlite-devel - - python-paramiko - - python-devel - - python-pip - python3-devel - python3-pip - - mysql-devel - zlib-devel - bzip2-devel - openssl-devel @@ -77,35 +68,14 @@ - marvin_install - name: remove yum openSSL package - yum: - name: pyOpenSSL - state: absent - -- name: Update pip and components - pip: + dnf: name: "{{ item }}" - extra_args: '--trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --upgrade' + state: absent with_items: - - pip==20.2.1 - - six - - pyOpenSSL - - wheel==0.34.2 - - '"requests[security]"' - - pyasn1 - - wget - - texttable - - lxml - - paramiko - - setuptools - - pyvmomi==8.0.0.1 - tags: - - marvin - - marvin_install - -- name: Workaround for pip install kubernetes - pip: - name: "kubernetes" - extra_args: '--ignore-installed' + - python3-pyOpenSSL + - python3-six + - python3-urllib3 + - python3-requests - name: Update pip3 and components pip: @@ -113,30 +83,29 @@ executable: pip3 extra_args: '--upgrade' with_items: - - pip==21.3.1 + - pip - six - pyOpenSSL - - wheel==0.34.2 + - paramiko + - wheel - kubernetes - - '"requests[security]"' - pyasn1 - wget - texttable - lxml - - pycparser==2.13 - - paramiko - - mysql-connector-python==8.0.29 - - netaddr==0.10.1 - - pyvmomi==8.0.3.0.1 + - pycparser + - mysql-connector-python==8.0.30 + - netaddr + - pyvmomi tags: - marvin - marvin_install - name: Clear all yum cache - command: yum clean all + command: dnf clean all - name: Ensure CA-Certificates are up to date - yum: + dnf: name: ca-certificates state: latest tags: @@ -144,4 +113,7 @@ - marvin_install - name: ensure atd is running to schedule jobs - service: name=atd state=started enabled=yes + systemd: + name: atd + state: started + enabled: true diff --git a/Ansible/roles/marvin/tasks/main.yml b/Ansible/roles/marvin/tasks/main.yml index 3dd1275305..3964d7e177 100644 --- a/Ansible/roles/marvin/tasks/main.yml +++ b/Ansible/roles/marvin/tasks/main.yml @@ -13,17 +13,16 @@ - kvm - name: Now I'm connected, get facts - setup: - tags: - - kvm - -- include: ../../../tasks/set_centos_repos.yml + os_facts: -- name: Ensure selinux python bindings are installed - yum: name=libselinux-python state=present +- name: Set hostname pt2 + shell: "hostnamectl set-hostname {{ inventory_hostname }}" - name: Ensure selinux python3 bindings are installed - yum: name=libselinux-python3 state=present + dnf: name=python3-libselinux state=present + +- name: Ensure sshpass is installed + dnf: name=sshpass state=present - name: Put SELinux in permissive mode, logging actions that would be blocked. selinux: @@ -36,16 +35,6 @@ - name: sync time with mgmt server shell: date --set=`sshpass -p 'P@ssword123' ssh -o StrictHostKeyChecking=no root@{{ hostvars[groups['primary_cs_manager'][0]]['ansible_ssh_host'] }} 'date --iso-8601=seconds'` -- name: restart machine for clean time application - command: sleep 2 && /sbin/shutdown -r now "set time" - async: 1 - poll: 0 - ignore_errors: true - -- name: waiting 60 secs for server to come back - become: false - local_action: wait_for host={{ ansible_ssh_host }} port=22 state=started delay=60 timeout=300 - - include: ./install_marvin_prereqs.yml - name: Set repo to install PR tests from @@ -69,36 +58,13 @@ when: ("{{ mypackage_available }}" == "false") or (force_marvin_fallback) - name: Install Marvin package - yum: name=cloudstack-marvin state=present + dnf: name=cloudstack-marvin state=present tags: - marvin - marvin_cfg - name: Ensure integration test packages are installed - yum: name=cloudstack-integration-tests state=present - tags: - - marvin - - marvin_cfg - -- name: Install wheel - pip: - name: wheel - tags: - - marvin - -- name: Install nose - pip: - name: nose - tags: - - marvin - -- name: Check if marvin is installed in python3 - stat: path=/usr/local/lib/python3.6/site-packages/marvin/ - register: marvin3 - -- name: install marvin in python3 if not exist - shell: "pip3 install /usr/share/cloudstack-marvin/Marvin-*.tar.gz" - when: marvin3.stat.exists == false + dnf: name=cloudstack-integration-tests state=present tags: - marvin - marvin_cfg @@ -153,13 +119,20 @@ - marvin - marvin_cfg +- name: get site packages location + shell: pip show requests | awk '/^Location:/{print $2}' + register: + package_dir + +- name: Check if marvin is installed in python3 + stat: path={{ package_dir.stdout }}/marvin/ + register: marvin3 + - name: remove orginal test_data files file: path="{{ item }}" state=absent with_items: - - "/usr/lib/python2.7/site-packages/marvin/config/test_data.pyc" - - "/usr/lib/python2.7/site-packages/marvin/config/test_data.py" - - "/usr/local/lib/python3.6/site-packages/marvin/config/test_data.pyc" - - "/usr/local/lib/python3.6/site-packages/marvin/config/test_data.py" + - "{{ package_dir.stdout }}/marvin/config/test_data.pyc" + - "{{ package_dir.stdout }}/marvin/config/test_data.py" tags: - marvin - marvin_cfg @@ -170,41 +143,13 @@ - marvin - marvin_cfg -- name: Check if marvin is installed in python2 - stat: path=/usr/lib/python2.7/site-packages/marvin/ - register: marvin2 - -- name: create symlink to test_data.py - file: src=/marvin/test_data.py dest=/usr/lib/python2.7/site-packages/marvin/config/test_data.py state=link mode=0644 - when: marvin2.stat.exists == true - tags: - - marvin - - marvin_cfg - -- name: Check if marvin is installed in python3 - stat: path=/usr/local/lib/python3.6/site-packages/marvin/ - register: marvin3 - - name: create python3 symlink to test_data.py - file: src=/marvin/test_data.py dest=/usr/local/lib/python3.6/site-packages/marvin/config/test_data.py state=link mode=0644 + file: src=/marvin/test_data.py dest={{ package_dir.stdout }}/marvin/config/test_data.py state=link mode=0644 when: marvin3.stat.exists == true tags: - marvin - marvin_cfg -# Install specific version of mysql-connector-python for compatibility with MariaDB -# For more details: https://stackoverflow.com/a/73254598/3428543 -- name: Install mysql-connector-python==8.0.29 - pip: - name: "{{ item }}" - executable: pip3 - extra_args: '--upgrade' - with_items: - - mysql-connector-python==8.0.29 - tags: - - marvin - - marvin_install - - name: create common functions file template: src="common_functions.sh.j2" dest="/marvin/common_functions.sh" mode=0755 tags: diff --git a/Ansible/roles/marvin/templates/componenttests.sh.j2 b/Ansible/roles/marvin/templates/componenttests.sh.j2 index 47515bd01f..8d3b95d0f6 100644 --- a/Ansible/roles/marvin/templates/componenttests.sh.j2 +++ b/Ansible/roles/marvin/templates/componenttests.sh.j2 @@ -18,7 +18,7 @@ set +e # stop erroneous failures reported by Jenkins TESTTYPE="Component tests" LOGDIR=/marvin/MarvinLogs TESTDIR="/marvin/tests/component" -SUMMARY_FILE=/marvin/componenttest-summary.txt +SUMMARY_FILE=/marvin/componenttests-summary.txt TMP_JSON_DIR="/marvin/json_results/" CLEAN_UP_LOG="/marvin/cleanup.log" mkdir -p $LOGDIR @@ -74,7 +74,8 @@ for file in $FILES; do {% if use_hipchat %} hipchat --action sendNotification --room "Marvin Notifications" --messageFormat "html" --colour "gray" --message "Starting $(basename $file) on {{ hostvars[groups['marvin_host'][0]]['ansible_ssh_host'] }} in:
{{ env_name_clean }} - test ($counter of $NUMTESTS)" {% endif %} - {% if use_slack %} slackmsg "Starting $TESTFILENAME on {{ hostvars[groups['marvin_host'][0]]['ansible_ssh_host'] }}.\nTest ($counter of $NUMTESTS) " "#808080" + {% if use_slack %} + slackmsg "Starting $TESTFILENAME on {{ hostvars[groups['marvin_host'][0]]['ansible_ssh_host'] }}.\nTest ($counter of $NUMTESTS) " "#808080" {% endif %} start_time="$(date -u +%s)" launchtest $file