From 47da6b581bc4923032447bfca5c96b6dc6ea7c08 Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Mon, 20 Apr 2026 17:14:56 +0200 Subject: [PATCH 1/4] Consistency changes --- .github/workflows/ci.yml | 24 ++++++++++++--------- .github/workflows/release.yml | 2 +- README.md | 24 ++++++++++----------- Vagrantfile | 37 +++++++++++++++++++++++++------- meta/main.yml | 12 +++++------ molecule/default/collections.yml | 6 +----- molecule/default/molecule.yml | 2 +- tasks/configure.yml | 2 +- tasks/plugins.yml | 2 +- tasks/users.yml | 2 +- tasks/wp-cli.yml | 2 +- tests/tasks/pre.yml | 4 ++-- tests/test.yml | 3 ++- tests/vagrant.yml | 3 ++- 14 files changed, 73 insertions(+), 52 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6776c26..80ca72f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,12 +15,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the codebase - uses: actions/checkout@v3 + uses: actions/checkout@v5 - name: Set up Python 3 - uses: actions/setup-python@v4 + uses: actions/setup-python@v6 with: - python-version: '3.x' + python-version: '3 - 3.13' - name: Install test dependencies run: | @@ -44,25 +44,29 @@ jobs: fail-fast: false matrix: include: - - distro: ubuntu1604 - ansible-version: '>=2.10, <2.11' - - distro: ubuntu1604 + - distro: debian11 + - distro: debian12 - distro: ubuntu1804 + ansible-version: '>=9, <10' - distro: ubuntu2004 + ansible-version: '>=12, <13' + - distro: ubuntu2204 + - distro: ubuntu2404 steps: - name: Check out the codebase - uses: actions/checkout@v3 + uses: actions/checkout@v5 with: path: "${{ github.repository }}" - name: Set up Python 3 - uses: actions/setup-python@v4 + uses: actions/setup-python@v6 with: - python-version: '3.x' + python-version: '3 - 3.13' - name: Install test dependencies - run: pip install 'ansible${{ matrix.ansible-version }}' molecule-plugins[docker] docker + run: | + pip install 'ansible${{ matrix.ansible-version }}' molecule-plugins[docker] docker - name: Run Molecule tests run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5cc5164..45165e9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the codebase - uses: actions/checkout@v3 + uses: actions/checkout@v5 - name: Publish to Galaxy uses: robertdebock/galaxy-action@1.2.0 diff --git a/README.md b/README.md index 8904536..302d30b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Build Status](https://travis-ci.org/Oefenweb/ansible-wordpress.svg?branch=master)](https://travis-ci.org/Oefenweb/ansible-wordpress) [![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-wordpress-blue.svg)](https://galaxy.ansible.com/Oefenweb/wordpress) -Set up (multiple) wordpress installations in Debian-like systems (using `wp-cli`). +Set up (multiple) WordPress installations in Debian-like systems (using `wp-cli`). #### Requirements @@ -23,18 +23,18 @@ This role assumes a working virtual host (that handles `wordpress_url`). * `wordpress_installs.{n}.dbpass`: [required]: Database password (**make sure to change**) * `wordpress_installs.{n}.dbhost`: [default: `localhost`, optional]: Database host * `wordpress_installs.{n}.dbprefix`: [default: `wp_`, optional]: Prefix for database tables -* `wordpress_installs.{n}.path`: [required]: Install directory for wordpress -* `wordpress_installs.{n}.locale`: [default: `en_US`, optional]: Language of the downloaded Wordpress +* `wordpress_installs.{n}.path`: [required]: Install directory for WordPress +* `wordpress_installs.{n}.locale`: [default: `en_US`, optional]: Language of the downloaded WordPress * `wordpress_installs.{n}.owner`: [default: `www-data`]: The name of the user that should own the install * `wordpress_installs.{n}.group`: [default: `owner`, `www-data`]: The name of the group that should own the install -* `wordpress_installs.{n}.url`: [required]: Wordpress url -* `wordpress_installs.{n}.title`: [required]: Wordpress title -* `wordpress_installs.{n}.admin_name`: [default: `admin`, optional]: Wordpress admin (user)name -* `wordpress_installs.{n}.admin_email`: [required]: Wordpress admin email address -* `wordpress_installs.{n}.admin_password`: [required]: Wordpress admin password (**make sure to change**) +* `wordpress_installs.{n}.url`: [required]: WordPress url +* `wordpress_installs.{n}.title`: [required]: WordPress title +* `wordpress_installs.{n}.admin_name`: [default: `admin`, optional]: WordPress admin (user)name +* `wordpress_installs.{n}.admin_email`: [required]: WordPress admin email address +* `wordpress_installs.{n}.admin_password`: [required]: WordPress admin password (**make sure to change**) * `wordpress_installs.{n}.cron`: [optional]: Cron declaration -* `wordpress_installs.{n}.cron.use_crond`: [default: `false`]: Whether or not to use `crond` instead of wp-cron +* `wordpress_installs.{n}.cron.use_crond`: [default: `false`]: Whether to use `crond` instead of wp-cron * `wordpress_installs.{n}.cron.user`: [default: `www-data`]: User to run job as * `wordpress_installs.{n}.cron.schedule`: [optional]: Cron schedule declaration * `wordpress_installs.{n}.cron.schedule.day`: [default: `*`]: Day when the job should run @@ -45,18 +45,18 @@ This role assumes a working virtual host (that handles `wordpress_url`). * `wordpress_installs.{n}.themes`: [required]: (Additional) themes to install (and activate) * `wordpress_installs.{n}.themes.{n}.name`: [required]: Name of the theme -* `wordpress_installs.{n}.themes.{n}.activate`: [default: `false`, optional]: Whether or not to activate the theme +* `wordpress_installs.{n}.themes.{n}.activate`: [default: `false`, optional]: Whether to activate the theme * `wordpress_installs.{n}.plugins`: [required]: (Additional) plugins to install (and activate) * `wordpress_installs.{n}.plugins.{n}.name`: [required]: Name of the plugin * `wordpress_installs.{n}.plugins.{n}.zip`: [optional]: Zip of the plugin * `wordpress_installs.{n}.plugins.{n}.url`: [optional]: Url of the plugin * `wordpress_installs.{n}.plugins.{n}.activate`: [default: `true`, optional]: Whether to activate or to deactivate the plugin -* `wordpress_installs.{n}.plugins.{n}.force`: [default: `false`, optional]: Whether or not to add the `--force` option during install +* `wordpress_installs.{n}.plugins.{n}.force`: [default: `false`, optional]: Whether to add the `--force` option during install * `wordpress_installs.{n}.users`: [optional]: User declarations * `wordpress_installs.{n}.users.src`: [required]: The local path of the [csv file](http://wp-cli.org/commands/user/import-csv/) to import, can be absolute or relative (e.g. `../../../files/wordpress/users.csv`) -* `wordpress_installs.{n}.users.skip_update`: [default: `true`, optional]: Whether or not to update users that already exist +* `wordpress_installs.{n}.users.skip_update`: [default: `true`, optional]: Whether to update users that already exist * `wordpress_installs.{n}.options`: [required]: Options to add, update or delete * `wordpress_installs.{n}.options.{n}.command`: [required]: Add, update or delete diff --git a/Vagrantfile b/Vagrantfile index fbae761..b411e28 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -4,25 +4,46 @@ role = File.basename(File.expand_path(File.dirname(__FILE__))) boxes = [ - { - :name => "ubuntu-1604", - :box => "bento/ubuntu-16.04", - :ip => '10.0.0.13', - :cpu => "50", - :ram => "256" - }, { :name => "ubuntu-1804", :box => "bento/ubuntu-18.04", - :ip => '10.0.0.14', + :ip => '10.0.0.13', :cpu => "50", :ram => "384" }, { :name => "ubuntu-2004", :box => "bento/ubuntu-20.04", + :ip => '10.0.0.14', + :cpu => "50", + :ram => "512" + }, + { + :name => "ubuntu-2204", + :box => "bento/ubuntu-22.04", :ip => '10.0.0.15', :cpu => "50", + :ram => "512" + }, + { + :name => "ubuntu-2404", + :box => "bento/ubuntu-24.04", + :ip => '10.0.0.16', + :cpu => "50", + :ram => "512" + }, + { + :name => "debian-11", + :box => "bento/debian-11", + :ip => '10.0.0.19', + :cpu => "50", + :ram => "256" + }, + { + :name => "debian-12", + :box => "bento/debian-12", + :ip => '10.0.0.20', + :cpu => "50", :ram => "384" }, ] diff --git a/meta/main.yml b/meta/main.yml index 655b2b4..adb1a4d 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -11,16 +11,14 @@ galaxy_info: platforms: - name: Ubuntu versions: - - precise - - trusty - - xenial - bionic + - focal + - jammy + - noble - name: Debian versions: - - wheezy - - jessie - - stretch - - buster + - bullseye + - bookworm galaxy_tags: - web dependencies: [] diff --git a/molecule/default/collections.yml b/molecule/default/collections.yml index c3d7e2a..1062b36 100644 --- a/molecule/default/collections.yml +++ b/molecule/default/collections.yml @@ -1,6 +1,2 @@ --- -collections: - - name: community.docker - version: '>=1.2.0,<2' - - name: community.general - version: '>=2,<3' +collections: [] diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 8841165..908aaf6 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -5,7 +5,7 @@ driver: name: docker platforms: - name: instance - image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu1604}-ansible:latest" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2004}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:rw diff --git a/tasks/configure.yml b/tasks/configure.yml index 1b0dff2..3674ccf 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -6,7 +6,7 @@ state: directory owner: root group: root - mode: 0755 + mode: '0755' with_items: - "{{ wordpress_data_path }}/themes" - "{{ wordpress_data_path }}/plugins" diff --git a/tasks/plugins.yml b/tasks/plugins.yml index cbb7835..5ea30f0 100644 --- a/tasks/plugins.yml +++ b/tasks/plugins.yml @@ -34,7 +34,7 @@ dest: "{{ wordpress_data_path }}/plugins/{{ item.item.1.name }}.zip" owner: root group: root - mode: 0644 + mode: '0644' with_items: "{{ _check_installation_plugins.results | default([]) }}" when: - item.item.1.name diff --git a/tasks/users.yml b/tasks/users.yml index 38f41c5..bd01b31 100644 --- a/tasks/users.yml +++ b/tasks/users.yml @@ -6,7 +6,7 @@ dest: "{{ wordpress_data_path }}/users/{{ item.dbname }}.csv" owner: root group: root - mode: 0644 + mode: '0644' register: _check_copy_users with_items: "{{ wordpress_installs }}" when: item.users.src is defined diff --git a/tasks/wp-cli.yml b/tasks/wp-cli.yml index a2245be..ff255e1 100644 --- a/tasks/wp-cli.yml +++ b/tasks/wp-cli.yml @@ -7,7 +7,7 @@ force: true owner: root group: root - mode: 0755 + mode: '0755' tags: - wordpress-wp-cli-install diff --git a/tests/tasks/pre.yml b/tests/tasks/pre.yml index a21d9e0..881ea53 100644 --- a/tests/tasks/pre.yml +++ b/tests/tasks/pre.yml @@ -16,7 +16,7 @@ ansible.builtin.apt_repository: repo: 'ppa:ondrej/php' update_cache: true - mode: 0644 + mode: '0644' - name: percona server | preseed ansible.builtin.debconf: @@ -77,7 +77,7 @@ password = '{{ wordpress_percona_server_root_password }}' owner: root group: root - mode: 0600 + mode: '0600' - name: percona server | ensure database community.mysql.mysql_db: diff --git a/tests/test.yml b/tests/test.yml index f289193..e6206ee 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -1,6 +1,7 @@ # test file --- -- hosts: localhost +- name: converge + hosts: localhost connection: local become: true pre_tasks: diff --git a/tests/vagrant.yml b/tests/vagrant.yml index 8949a4e..a5c8368 100644 --- a/tests/vagrant.yml +++ b/tests/vagrant.yml @@ -1,6 +1,7 @@ # test file --- -- hosts: all +- name: converge + hosts: all remote_user: vagrant become: true pre_tasks: From 71e38b2517fffa528bc57343514af5aaa28a6e1c Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Tue, 21 Apr 2026 10:35:20 +0200 Subject: [PATCH 2/4] Fix failing tests --- tests/tasks/pre.yml | 46 ++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/tests/tasks/pre.yml b/tests/tasks/pre.yml index 881ea53..366d783 100644 --- a/tests/tasks/pre.yml +++ b/tests/tasks/pre.yml @@ -8,10 +8,15 @@ update_cache: true cache_valid_time: "{{ apt_update_cache_valid_time | default(3600) }}" -- name: percona server | add repo +- name: percona server | percona-release ansible.builtin.apt: deb: "https://repo.percona.com/apt/percona-release_latest.{{ ansible_distribution_release }}_all.deb" +- name: percona server | add repo + ansible.builtin.shell: > + percona-release enable-only ps-80 + changed_when: true + - name: php | add repo ansible.builtin.apt_repository: repo: 'ppa:ondrej/php' @@ -25,22 +30,26 @@ value: "{{ item.value }}" vtype: "{{ item.vtype }}" with_items: - - name: "percona-server-server-5.7" - question: "percona-server-server-5.7/root-pass" + - name: 'percona-server-server' + question: 'percona-server-server/root-pass' value: "{{ wordpress_percona_server_root_password }}" vtype: password - - name: "percona-server-server-5.7" - question: "percona-server-server-5.7/re-root-pass" + - name: 'percona-server-server' + question: 'percona-server-server/re-root-pass' value: "{{ wordpress_percona_server_root_password }}" vtype: password + - 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 - name: percona server | install ansible.builtin.apt: name: - - percona-server-client-5.7 - - percona-server-server-5.7 - - libperconaserverclient20 + - percona-server-client + - percona-server-server + - libperconaserverclient21 - "python{{ ansible_python_version is version('3', '>=') | ternary('3', '') }}-mysqldb" state: "{{ apt_install_state | default('latest') }}" @@ -48,17 +57,16 @@ ansible.builtin.apt: name: - apache2 - - libapache2-mod-php7.4 - - php7.4-cli - - php7.4-gd - - php7.4-gmp - - php7.4-json - - php7.4-ldap - - php7.4-mbstring - - php7.4-mysql - - php7.4-opcache - - php7.4-snmp - - php7.4-xml + - libapache2-mod-php8.3 + - php8.3-cli + - php8.3-gd + - php8.3-gmp + - php8.3-ldap + - php8.3-mbstring + - php8.3-mysql + - php8.3-opcache + - php8.3-snmp + - php8.3-xml state: "{{ apt_install_state | default('latest') }}" - name: percona server | start From d7ee3a92a84a4187b94c6fbbd562c4d0a0acc93a Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Tue, 21 Apr 2026 12:24:14 +0200 Subject: [PATCH 3/4] Fix bool --- tasks/plugins.yml | 20 ++++++++++---------- tasks/themes.yml | 10 +++++----- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tasks/plugins.yml b/tasks/plugins.yml index 5ea30f0..48e9635 100644 --- a/tasks/plugins.yml +++ b/tasks/plugins.yml @@ -9,7 +9,7 @@ with_subelements: - "{{ wordpress_installs }}" - plugins - when: item.1 + when: item.1.name | length > 0 tags: - wordpress-plugins-is-installed-plugin @@ -20,7 +20,7 @@ changed_when: true with_items: "{{ _check_installation_plugins.results | default([]) }}" when: - - item.item.1.name + - item.item.1.name | length > 0 - not item.item.1.zip | default(false) - not item.item.1.url | default(false) - item.rc != 0 @@ -37,7 +37,7 @@ mode: '0644' with_items: "{{ _check_installation_plugins.results | default([]) }}" when: - - item.item.1.name + - item.item.1.name | length > 0 - item.item.1.zip | default(false) - not item.item.1.url | default(false) - item.rc != 0 @@ -53,7 +53,7 @@ changed_when: true with_items: "{{ _check_installation_plugins.results | default([]) }}" when: - - item.item.1.name + - item.item.1.name | length > 0 - item.item.1.zip | default(false) - not item.item.1.url | default(false) - item.rc != 0 @@ -69,7 +69,7 @@ changed_when: true with_items: "{{ _check_installation_plugins.results | default([]) }}" when: - - item.item.1.name + - item.item.1.name | length > 0 - not item.item.1.zip | default(false) - item.item.1.url | default(false) - item.rc != 0 @@ -84,7 +84,7 @@ with_subelements: - "{{ wordpress_installs }}" - plugins - when: item.1.name + when: item.1.name | length > 0 tags: - wordpress-plugins-check-install-plugin @@ -97,8 +97,8 @@ - "{{ wordpress_installs }}" - plugins when: - - item.1.name - - item.1.activate | default(true) + - item.1.name | length > 0 + - item.1.activate | bool | default(true) tags: - wordpress-plugins-activate-plugin @@ -111,7 +111,7 @@ - "{{ wordpress_installs }}" - plugins when: - - item.1.name - - not item.1.activate | default(true) + - item.1.name | length > 0 + - not item.1.activate | bool | default(true) tags: - wordpress-plugins-deactivate-plugin diff --git a/tasks/themes.yml b/tasks/themes.yml index b500a5d..d35ee3b 100644 --- a/tasks/themes.yml +++ b/tasks/themes.yml @@ -9,7 +9,7 @@ with_subelements: - "{{ wordpress_installs }}" - themes - when: item.1.name + when: item.1.name | length > 0 tags: - wordpress-themes-is-installed-theme @@ -19,7 +19,7 @@ changed_when: true with_items: "{{ _check_installation_themes.results | default([]) }}" when: - - item.item.1.name + - item.item.1.name | length > 0 - item.rc != 0 tags: - wordpress-themes-install-theme @@ -31,7 +31,7 @@ with_subelements: - "{{ wordpress_installs }}" - themes - when: item.1.name + when: item.1.name | length > 0 tags: - wordpress-themes-install-theme-check @@ -44,7 +44,7 @@ - "{{ wordpress_installs }}" - themes when: - - item.1.name - - item.1.activate | default(false) + - item.1.name | length > 0 + - item.1.activate | bool | default(false) tags: - wordpress-themes-activate-theme From c8c3496c272b81cc7f64e3a497e6523ab11c8373 Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Tue, 21 Apr 2026 12:33:11 +0200 Subject: [PATCH 4/4] Fix deprecations --- .github/workflows/ci.yml | 2 -- Vagrantfile | 14 -------------- tests/tasks/pre.yml | 4 ++-- 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 80ca72f..c392d97 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,8 +44,6 @@ jobs: fail-fast: false matrix: include: - - distro: debian11 - - distro: debian12 - distro: ubuntu1804 ansible-version: '>=9, <10' - distro: ubuntu2004 diff --git a/Vagrantfile b/Vagrantfile index b411e28..4e0b72f 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -32,20 +32,6 @@ boxes = [ :cpu => "50", :ram => "512" }, - { - :name => "debian-11", - :box => "bento/debian-11", - :ip => '10.0.0.19', - :cpu => "50", - :ram => "256" - }, - { - :name => "debian-12", - :box => "bento/debian-12", - :ip => '10.0.0.20', - :cpu => "50", - :ram => "384" - }, ] Vagrant.configure("2") do |config| diff --git a/tests/tasks/pre.yml b/tests/tasks/pre.yml index 366d783..073d458 100644 --- a/tests/tasks/pre.yml +++ b/tests/tasks/pre.yml @@ -10,7 +10,7 @@ - name: percona server | percona-release ansible.builtin.apt: - deb: "https://repo.percona.com/apt/percona-release_latest.{{ ansible_distribution_release }}_all.deb" + deb: "https://repo.percona.com/apt/percona-release_latest.{{ ansible_facts['distribution_release'] }}_all.deb" - name: percona server | add repo ansible.builtin.shell: > @@ -50,7 +50,7 @@ - percona-server-client - percona-server-server - libperconaserverclient21 - - "python{{ ansible_python_version is version('3', '>=') | ternary('3', '') }}-mysqldb" + - "python{{ ansible_facts['python_version'] is version('3', '>=') | ternary('3', '') }}-mysqldb" state: "{{ apt_install_state | default('latest') }}" - name: php | install