diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6776c26..c392d97 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,27 @@ jobs: fail-fast: false matrix: include: - - distro: ubuntu1604 - ansible-version: '>=2.10, <2.11' - - distro: ubuntu1604 - 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..4e0b72f 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -4,26 +4,33 @@ 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 => "384" + :ram => "512" + }, + { + :name => "ubuntu-2404", + :box => "bento/ubuntu-24.04", + :ip => '10.0.0.16', + :cpu => "50", + :ram => "512" }, ] 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..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 @@ -34,10 +34,10 @@ 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 + - 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 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..073d458 100644 --- a/tests/tasks/pre.yml +++ b/tests/tasks/pre.yml @@ -8,15 +8,20 @@ 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" + deb: "https://repo.percona.com/apt/percona-release_latest.{{ ansible_facts['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' update_cache: true - mode: 0644 + mode: '0644' - name: percona server | preseed ansible.builtin.debconf: @@ -25,40 +30,43 @@ 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 - - "python{{ ansible_python_version is version('3', '>=') | ternary('3', '') }}-mysqldb" + - percona-server-client + - percona-server-server + - libperconaserverclient21 + - "python{{ ansible_facts['python_version'] is version('3', '>=') | ternary('3', '') }}-mysqldb" state: "{{ apt_install_state | default('latest') }}" - name: php | install 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 @@ -77,7 +85,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: