From c14c01b67dfd02c45820803ebb6542e894f77580 Mon Sep 17 00:00:00 2001 From: "Douglas Cerna (Soy Douglas)" Date: Mon, 14 Oct 2024 21:11:18 +0000 Subject: [PATCH] Execute only percona role in upgrade test --- .../vars-singlenode-1.16.yml | 61 ---------- tests/archivematica-upgrade/playbook.yml | 106 +++++++++++++----- 2 files changed, 80 insertions(+), 87 deletions(-) diff --git a/playbooks/archivematica-jammy/vars-singlenode-1.16.yml b/playbooks/archivematica-jammy/vars-singlenode-1.16.yml index 9527b04..7f09d6f 100644 --- a/playbooks/archivematica-jammy/vars-singlenode-1.16.yml +++ b/playbooks/archivematica-jammy/vars-singlenode-1.16.yml @@ -5,46 +5,6 @@ archivematica_src_am_version: "stable/1.16.x" archivematica_src_ss_version: "stable/0.22.x" -archivematica_src_ss_db_name: "SS" -archivematica_src_ss_db_user: "ss" -archivematica_src_ss_db_password: "demo" -archivematica_src_ss_db_host: "{{ archivematica_src_am_db_host }}" - -archivematica_src_configure_dashboard: "yes" -archivematica_src_configure_ss: "yes" -archivematica_src_configure_ss_user: "admin" -archivematica_src_configure_ss_password: "archivematica" -archivematica_src_configure_ss_api_key: "this_is_the_ss_api_key" -archivematica_src_configure_ss_url: "http://192.168.168.198:8000" -archivematica_src_configure_ss_email: "admin@example.com" -archivematica_src_configure_am_user: "admin" -archivematica_src_configure_am_password: "archivematica" -archivematica_src_configure_am_email: "admin@example.com" -archivematica_src_configure_am_api_key: "this_is_the_am_api_key" -archivematica_src_configure_am_site_url: "http://192.168.168.198" - -nodejs_version: "22.x" - -# elasticsearch role - -elasticsearch_version: "6.5.4" -elasticsearch_apt_java_package: "openjdk-8-jre-headless" -elasticsearch_java_home: "/usr/lib/jvm/java-1.8.0-openjdk-amd64" -elasticsearch_heap_size: "1g" -elasticsearch_max_open_files: "65535" -elasticsearch_timezone: "UTC" -elasticsearch_node_max_local_storage_nodes: "1" -elasticsearch_index_mapper_dynamic: "true" -elasticsearch_memory_bootstrap_mlockall: "true" -elasticsearch_install_java: "true" -elasticsearch_thread_pools: - - "thread_pool.write.size: 2" - - "thread_pool.write.queue_size: 1000" -elasticsearch_network_http_max_content_lengtht: 1024mb -elasticsearch_discovery_zen_ping_multicast_enabled: "false" -elasticsearch_max_locked_memory: "unlimited" -elasticsearch_network_host: "127.0.0.1" - # percona role mysql_version_major: "8" @@ -52,25 +12,4 @@ mysql_version_minor: "0" mysql_character_set_server: "utf8mb4" mysql_collation_server: "utf8mb4_0900_ai_ci" -mysql_databases: - - name: "{{ archivematica_src_am_db_name }}" - collation: "{{ archivematica_src_am_db_collation }}" - encoding: "{{ archivematica_src_am_db_encoding }}" - - name: "{{ archivematica_src_ss_db_name }}" - collation: "{{ archivematica_src_ss_db_collation }}" - encoding: "{{ archivematica_src_ss_db_encoding }}" - -mysql_users: - - name: "{{ archivematica_src_am_db_user }}" - pass: "{{ archivematica_src_am_db_password }}" - priv: "{{ archivematica_src_am_db_name }}.*:ALL,GRANT" - host: "{{ archivematica_src_am_db_host }}" - - name: "{{ archivematica_src_ss_db_user }}" - pass: "{{ archivematica_src_ss_db_password }}" - priv: "{{ archivematica_src_ss_db_name }}.*:ALL,GRANT" - host: "{{ archivematica_src_ss_db_host }}" - mysql_root_password: "MYSQLROOTPASSWORD" - -archivematica_src_ss_environment: - SS_DB_URL: "mysql://{{ archivematica_src_ss_db_user }}:{{ archivematica_src_ss_db_password }}@{{ archivematica_src_ss_db_host }}:3306/{{ archivematica_src_ss_db_name }}" diff --git a/tests/archivematica-upgrade/playbook.yml b/tests/archivematica-upgrade/playbook.yml index a20a84c..31ee124 100644 --- a/tests/archivematica-upgrade/playbook.yml +++ b/tests/archivematica-upgrade/playbook.yml @@ -15,41 +15,95 @@ - "fish" become: "yes" - roles: - - - role: "artefactual.elasticsearch" + tasks: + - name: "Block" become: "yes" - tags: - - "elasticsearch" - when: "archivematica_src_search_enabled|bool" + block: + - name: "Install gnupg" + apt: + name: gnupg2 + update_cache: yes - - role: "artefactual.percona" - become: "yes" - tags: - - "percona" + - name: "Install percona-release package" + apt: + deb: "https://repo.percona.com/apt/percona-release_latest.{{ ansible_distribution_release }}_all.deb" - - role: "artefactual.nginx" - become: "yes" - tags: - - "nginx" + - name: "Update apt cache" + apt: + update_cache: yes - - role: "artefactual.gearman" - become: "yes" - tags: - - "gearman" + # https://www.percona.com/doc/percona-server/LATEST/installation/apt_repo.html + - name: "Enable Percona repository (Percona version >= 8)" + command: "percona-release setup ps{{ mysql_version_major }}{{ mysql_version_minor }}" + when: mysql_version_major|int >= 8 + changed_when: False # TODO: check for task idempotency - - role: "artefactual.clamav" - become: "yes" - tags: - - "clamav" + - name: "Install python-is-python3 (Ubuntu >= Focal/20.04)" + apt: + name: "python-is-python3" + when: + - ansible_distribution_version is version_compare('20.04', '>=') - - role: "artefactual.archivematica-src" - become: "yes" - tags: - - "archivematica-src" + - debug: + msg: "ansible_python_interpreter major version: {{ ansible_python.version.major }}" + + - name: "Install package dependencies for ansible MySQL modules (python 2)" + apt: + name: "python-mysqldb" + when: + - ansible_python.version.major == 2 # version is a number, do not quote + + - name: "Install package dependencies for ansible MySQL modules (python 3)" + apt: + name: + - "python3-pymysql" + - "python3-mysqldb" + when: + - ansible_python.version.major == 3 # version is a number, do not quote + + - name: "Install percona packages and dependencies on Ubuntu (Percona version < 8)" + apt: + name: + - "percona-server-server-{{ mysql_version_major }}.{{ mysql_version_minor }}" + - "percona-server-client-{{ mysql_version_major }}.{{ mysql_version_minor }}" + - "percona-toolkit" + state: "present" + when: mysql_version_major|int < 8 + + - name: "Install | configure debconf for version 8.0 (Use Legacy Authentication Method)" + debconf: + name: 'percona-server-server' + question: 'percona-server-server/default-auth-override' + value: 'Use Legacy Authentication Method (Retain MySQL 5.x Compatibility)' + vtype: select + changed_when: false + when: + - mysql_version_major|int >= 8 + - mysql_default_authentication_plugin is defined + - mysql_default_authentication_plugin == "mysql_native_password" + + - name: "Install percona packages and dependencies on Ubuntu (Percona version >= 8)" + apt: + name: + - "percona-server-server={{ mysql_version_major }}.{{ mysql_version_minor }}*" + - "percona-server-client={{ mysql_version_major }}.{{ mysql_version_minor }}*" + - "percona-toolkit" + state: "present" + when: mysql_version_major|int >= 8 + + - name: "Adjust permissions of datadir" + file: + path: "/var/lib/mysql" + owner: "mysql" + group: "mysql" + mode: 0700 + state: "directory" post_tasks: + - name: Flush handlers + meta: flush_handlers + - name: "change home dir perms (to make transfer source visible)" become: "no" command: "chmod 755 $HOME"