diff --git a/CHANGELOG.md b/CHANGELOG.md index 73ac03296..cb09ef169 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Breaking Changes +* **role:gitlab_ce**: `gitlab-dump.service` runs `gitlab-backup create STRATEGY=copy`, as the GitLab documentation recommends for a running instance, so the dump no longer fails with "file changed as we read it". GitLab copies each of its file stores (uploads, CI artifacts, LFS objects, the container registry, ...) to the backup path before archiving it, one after the other, so `gitlab_ce__rb_gitlab_rails_backup_path` needs free space for the largest of them on top of the archive. Grow the filesystem of the backup path if necessary. * **role:sshd, playbook:setup_basic**: sshd turns new connections away earlier while many logins are pending (`MaxStartups 10:30:60` instead of the OpenSSH default `10:30:100`), as the CIS Benchmarks require, and `MaxStartups` is configurable with `sshd__max_startups__host_var` / `sshd__max_startups__group_var`. A `MaxStartups` set through `sshd__raw` no longer takes effect, move it to the variable. Hosts with many simultaneous SSH logins need a higher value, for example `'100:30:200'` on GitLab hosts ([#723](https://github.com/Linuxfabrik/lfops/issues/723)). * **role:grav, playbook:setup_grav**: The code of Grav, its configuration, pages, plugins and themes belong to `root`, so a hole in Grav or a plugin can no longer plant code in the site. The web server only writes `assets`, `backup`, `cache`, `images`, `logs`, `tmp`, `user/accounts` and `user/data`, and only these keep the SELinux type `httpd_sys_rw_content_t`. Grav, its plugins and themes are updated as `root` by `grav-selfupgrade-.timer` and `grav-update-.timer`, which replace `grav-selfupgrade.timer` and `grav-update.timer`, so several Grav sites on one host are each updated. Run other `bin/gpm` commands with `grav-gpm ` instead of `sudo -u apache bin/gpm`, which now fails, and deploy content below `user/` as `root`. The role no longer installs the Admin Panel, which could not save anything anymore, and drops `grav__skip_admin` and `grav__users`; it lists the Admin Panel plugins still installed at the end of the play, for you to remove. The vHost no longer accepts `POST`, and `setup_grav` no longer sets the SELinux boolean `httpd_can_network_connect`, which keeps its current value. * **role:apache_httpd**: The `proxy` vHost template waits 30 instead of 5 seconds for the backend, so slower responses no longer end in a 502, and a hanging backend holds the connection longer. Set `conf_proxy_timeout: 5` on the vHost to keep the previous value. @@ -82,6 +83,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +* **role:fangfrisch**: `fangfrisch__urlhaus_auth_key` sets the abuse.ch Auth-Key and enables the URLhaus signatures. +* **role:mount**: The `mode` subkey of `mount__mounts__*_var` sets the mode of the root of a mounted filesystem. * **role:php**: `php__opcache_blacklist__host_var` / `php__opcache_blacklist__group_var` exclude files from OPcache, and the role creates the blacklist file that `opcache.blacklist_filename` already pointed to. * **role:libreoffice**: `libreoffice__client_apache: true` also works on Debian and Ubuntu. * **plugin:bitwarden_item, module:bitwarden_item**: Reach `bw serve` through a Unix socket instead of the loopback port, so its file permissions decide which local users get at the vault. Needs bw CLI 2025.9.0 or newer. Set `LFOPS_BITWARDEN_UNIX_SOCKET` to the path of the socket. @@ -251,6 +254,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +* **role:php**: On the Red Hat family, PHP modules from the inventory that are already installed as a dependency of another package are marked as user-installed, so `dnf autoremove` no longer removes them once that package is gone. +* **role:sshd**: `sshd__sftp_subsystem` from the inventory takes effect, where the role always deployed its own default. +* **role:fangfrisch**: Without `fangfrisch__urlhaus_auth_key`, Fangfrisch no longer tries to download the URLhaus signatures, which failed with `401 Unauthorized` on every refresh. +* **role:wordpress, playbook:setup_wordpress**: Installs `php-mysqlnd` instead of `php-pecl-mysql`, the obsolete `mysql_*` extension that WordPress does not use, and removes `php-pecl-mysql` from existing hosts. If another application on the host still needs it, add `php-pecl-mysql` with `state: 'present'` to `php__modules__host_var`. +* **role:icinga2_agent**: The run fails if the host cannot be added to the Icinga Director, for example because of a wrong login, instead of continuing as if it had been added. +* **role:mount**: The role no longer resets the owner and mode of the root of a mounted filesystem to `root:root` and `0755` on every run, and no longer fails on an NFS export with `root_squash`. `owner` and `group` are only applied where a mount sets them, and reach the mounted filesystem in the first run. +* **role:gitlab_ce**: `gitlab-dump.service` fails when the backup fails, so `systemctl --failed` and the monitoring notice it, instead of always reporting success. +* **role:duplicity**: `duba` no longer removes old backups of a path whose backup failed in the same run. +* **role:duplicity**: `duba` reports a missing or invalid `/etc/duba/duba.json` with an error message and exit code 201 or 203 instead of a Python traceback. * **role:grav, playbook:setup_grav**: OPcache no longer fills up with recompiled copies of Grav's file list caches and no longer throws away its whole cache every few days. * **role:repo_epel**: On Rocky 10 and RHEL 10, EPEL follows the minor release of the host, so the daily system update no longer fails on EPEL packages built for a RHEL minor release the host does not have yet. * **role:mariadb_server**: With `skip_name_resolve`, the `proxies_priv` warning in the MariaDB error log also goes away on servers that carry the entry for `root` instead of `mysql`. diff --git a/extensions/molecule/duplicity/verify.yml b/extensions/molecule/duplicity/verify.yml index 25c71da1a..880b961e8 100644 --- a/extensions/molecule/duplicity/verify.yml +++ b/extensions/molecule/duplicity/verify.yml @@ -26,6 +26,37 @@ that: '"usage: duba" in __molecule__duba_help_result["stdout"]' fail_msg: '{{ __molecule__duba_help_result | to_json }}' + # A missing or invalid config file is reported with an error message and duba's own exit + # code, not with a Python traceback (exit code 222). + - name: 'duba --config=/nonexistent' + ansible.builtin.command: '/usr/local/bin/duba --config=/nonexistent' + changed_when: false + failed_when: false + register: '__molecule__duba_missing_config_result' + + - name: 'Deploy /tmp/molecule-duba-invalid.json' + ansible.builtin.copy: + dest: '/tmp/molecule-duba-invalid.json' + content: '{invalid' + mode: 0o600 + + - name: 'duba --config=/tmp/molecule-duba-invalid.json' + ansible.builtin.command: '/usr/local/bin/duba --config=/tmp/molecule-duba-invalid.json' + changed_when: false + failed_when: false + register: '__molecule__duba_invalid_config_result' + + - name: 'Assert that duba reports a missing and an invalid config file' + ansible.builtin.assert: + that: + - '__molecule__duba_missing_config_result["rc"] == 201' + - '"ERROR: duba - I/O error: No such file or directory while opening or reading /nonexistent" in __molecule__duba_missing_config_result["stderr"]' + - '__molecule__duba_invalid_config_result["rc"] == 203' + - '"ERROR: duba - JSON decode error in /tmp/molecule-duba-invalid.json" in __molecule__duba_invalid_config_result["stderr"]' + - '"Traceback" not in __molecule__duba_missing_config_result["stdout"] ~ __molecule__duba_missing_config_result["stderr"]' + - '"Traceback" not in __molecule__duba_invalid_config_result["stdout"] ~ __molecule__duba_invalid_config_result["stderr"]' + fail_msg: '{{ [__molecule__duba_missing_config_result, __molecule__duba_invalid_config_result] | to_json }}' + # Ask gpg whether the master key is imported and trusted ultimately ("u" in field 2 of the # colon listing), since the role encrypts every backup to it. - name: 'gpg --list-keys --with-colons {{ duplicity__gpg_encrypt_master_key }}' @@ -350,7 +381,8 @@ # One failed source has to fail the whole run, also if the other sources finish after it. # A regular file in place of the backup directory of the divided entry "broken" breaks its - # backup, the other sources still back up fine. + # backup, the other sources still back up fine. duba must not remove old backups of the + # path whose backup failed, while it still cleans up the others. - name: 'mkdir /srv/duba-molecule/divided/broken' ansible.builtin.file: path: '/srv/duba-molecule/divided/broken' @@ -381,6 +413,14 @@ - '__molecule__duba_journal_result["stdout_lines"] | select("search", "ERROR: duba - Exit code [0-9]+: .* file:///var/backups/duba-molecule/srv/duba-molecule/divided/broken$") | list | length > 0' fail_msg: '{{ __molecule__duba_journal_result["stdout_lines"] }}' + - name: 'Assert that duba skipped the cleanup of the broken source only' + ansible.builtin.assert: + that: + - '__molecule__duba_journal_result["stdout_lines"] | select("search", "WARNING: duba - Skipping the cleanup of /srv/duba-molecule/divided/broken, since its backup failed.$") | list | length > 0' + - '__molecule__duba_journal_result["stdout_lines"] | select("search", "Running: .* remove-older-than .* file:///var/backups/duba-molecule/srv/duba-molecule/divided/broken$") | list | length == 0' + - '__molecule__duba_journal_result["stdout_lines"] | select("search", "Running: .* remove-older-than .* file:///var/backups/duba-molecule/srv/duba-molecule/plain$") | list | length > 0' + fail_msg: '{{ __molecule__duba_journal_result["stdout_lines"] }}' + - name: 'rm -rf /srv/duba-molecule/divided/broken /var/backups/duba-molecule/srv/duba-molecule/divided/broken' ansible.builtin.file: path: '{{ item }}' diff --git a/extensions/molecule/gitlab_ce/verify.yml b/extensions/molecule/gitlab_ce/verify.yml index d98bcc53a..07fcecb16 100644 --- a/extensions/molecule/gitlab_ce/verify.yml +++ b/extensions/molecule/gitlab_ce/verify.yml @@ -1,5 +1,6 @@ # Checks that GitLab runs and that its bundled NGINX uses the settings of gitlab.rb: the -# listen port, the registry and the real IP of a request from a trusted proxy. +# listen port, the registry and the real IP of a request from a trusted proxy. Also checks that +# gitlab-dump.service writes a backup and fails when the dump fails. - name: 'Verify GitLab CE' hosts: 'systems_under_test' gather_facts: false @@ -69,3 +70,72 @@ retries: 5 delay: 2 changed_when: false + + # A dump of the running instance has to succeed and leave an archive in the backup path. + - name: 'systemctl start gitlab-dump.service' # noqa command-instead-of-module (a oneshot run, not a state) + ansible.builtin.command: 'systemctl start gitlab-dump.service' + changed_when: false + failed_when: false + register: '__molecule__gitlab_dump_result' + + - name: 'journalctl --unit=gitlab-dump.service --lines=60' + ansible.builtin.command: 'journalctl --unit=gitlab-dump.service --no-pager --lines=60' + changed_when: false + register: '__molecule__gitlab_dump_journal_result' + + - name: 'find /backup/gitlab -name *_gitlab_backup.tar' + ansible.builtin.find: + paths: '/backup/gitlab' + patterns: '*_gitlab_backup.tar' + register: '__molecule__gitlab_dump_find_result' + + - name: 'Assert that the dump succeeded and wrote an archive' + ansible.builtin.assert: + that: + - '__molecule__gitlab_dump_result["rc"] == 0' + - '__molecule__gitlab_dump_find_result["matched"] > 0' + fail_msg: '{{ __molecule__gitlab_dump_journal_result["stdout_lines"] }}' + + # Without PostgreSQL the database dump fails, and the unit has to fail with it, so that + # `systemctl --failed` and the monitoring notice a broken backup. + - name: 'gitlab-ctl stop postgresql' + ansible.builtin.command: 'gitlab-ctl stop postgresql' + changed_when: false + + - name: 'systemctl start gitlab-dump.service # without PostgreSQL' # noqa command-instead-of-module (a oneshot run, not a state) + ansible.builtin.command: 'systemctl start gitlab-dump.service' + changed_when: false + failed_when: false + register: '__molecule__gitlab_dump_failed_result' + + - name: 'systemctl is-failed gitlab-dump.service' # noqa command-instead-of-module (read-only state query) + ansible.builtin.command: 'systemctl is-failed gitlab-dump.service' + changed_when: false + failed_when: false + register: '__molecule__gitlab_dump_is_failed_result' + + - name: 'gitlab-ctl start postgresql' + ansible.builtin.command: 'gitlab-ctl start postgresql' + changed_when: false + + - name: 'systemctl reset-failed gitlab-dump.service' # noqa command-instead-of-module (clears the state the test left behind) + ansible.builtin.command: 'systemctl reset-failed gitlab-dump.service' + changed_when: false + failed_when: false + + - name: 'Assert that gitlab-dump.service failed without PostgreSQL' + ansible.builtin.assert: + that: + - '__molecule__gitlab_dump_failed_result["rc"] != 0' + - '__molecule__gitlab_dump_is_failed_result["stdout"] == "failed"' + fail_msg: '{{ [__molecule__gitlab_dump_failed_result, __molecule__gitlab_dump_is_failed_result] | to_json }}' + + # the following verify run and the idempotence step need a GitLab that answers again + - name: 'curl http://127.0.0.1:8090/users/sign_in (after the PostgreSQL restart)' + ansible.builtin.uri: + url: 'http://127.0.0.1:8090/users/sign_in' + status_code: 200 + register: '__molecule__gitlab_sign_in_after_result' + until: '__molecule__gitlab_sign_in_after_result is not failed' + retries: 30 + delay: 10 diff --git a/extensions/molecule/mount/converge.yml b/extensions/molecule/mount/converge.yml index d91e9209d..8281f7fbf 100644 --- a/extensions/molecule/mount/converge.yml +++ b/extensions/molecule/mount/converge.yml @@ -14,6 +14,31 @@ creates: '/var/tmp/lfops-molecule.img' executable: '/bin/bash' + # the filesystem of the mount that sets owner, group and mode in group_vars + - name: 'truncate --size=300M /var/tmp/lfops-molecule-owned.img; mkfs.xfs /var/tmp/lfops-molecule-owned.img' + ansible.builtin.shell: + cmd: | + set -o errexit + truncate --size=300M /var/tmp/lfops-molecule-owned.img + mkfs.xfs -q /var/tmp/lfops-molecule-owned.img + creates: '/var/tmp/lfops-molecule-owned.img' + executable: '/bin/bash' + - name: 'Converge mount playbook' ansible.builtin.import_playbook: 'linuxfabrik.lfops.mount' + + +# What the admin of a share does: give its root an owner and a mode of its own. The mount sets +# neither in group_vars, so the role has to leave both alone. In the idempotence step the role +# runs before this play again, and would report a change if it reset them. +- name: 'Change owner and mode of the root of the mounted filesystem' + hosts: 'systems_under_test' + gather_facts: false + tasks: + + - name: 'chown nobody /srv/lfops-molecule; chmod 1777 /srv/lfops-molecule' + ansible.builtin.file: + path: '/srv/lfops-molecule' + owner: 'nobody' + mode: 0o1777 diff --git a/extensions/molecule/mount/inventory/group_vars/systems_under_test.yml b/extensions/molecule/mount/inventory/group_vars/systems_under_test.yml index 17c410712..7c7f18c05 100644 --- a/extensions/molecule/mount/inventory/group_vars/systems_under_test.yml +++ b/extensions/molecule/mount/inventory/group_vars/systems_under_test.yml @@ -6,3 +6,12 @@ mount__mounts__group_var: fstype: 'xfs' opts: 'loop' state: 'mounted' + # owner, group and mode from the inventory reach the root of the mounted filesystem + - path: '/srv/lfops-molecule-owned' + src: '/var/tmp/lfops-molecule-owned.img' + fstype: 'xfs' + opts: 'loop' + owner: 'nobody' + group: 'daemon' + mode: '0750' + state: 'mounted' diff --git a/extensions/molecule/mount/verify.yml b/extensions/molecule/mount/verify.yml index 671eaa869..567b69eb0 100644 --- a/extensions/molecule/mount/verify.yml +++ b/extensions/molecule/mount/verify.yml @@ -1,8 +1,30 @@ -- name: 'Verify mount relabels a freshly created filesystem' +- name: 'Verify mount relabels a freshly created filesystem and only sets the owner and mode it is given' hosts: 'systems_under_test' gather_facts: false tasks: + # Both paths have to be mount points, otherwise the checks below look at plain directories. + - name: 'findmnt --noheadings --output=TARGET /srv/lfops-molecule; findmnt ... /srv/lfops-molecule-owned' + ansible.builtin.command: 'findmnt --noheadings --output=TARGET {{ item }}' + loop: + - '/srv/lfops-molecule' + - '/srv/lfops-molecule-owned' + changed_when: false + + - name: 'stat --format="%U %G %a" /srv/lfops-molecule /srv/lfops-molecule-owned' + ansible.builtin.command: 'stat --format="%U %G %a" /srv/lfops-molecule /srv/lfops-molecule-owned' + changed_when: false + register: '__molecule__owner_mode_result' + + # The first mount sets no owner, group or mode, so it keeps what converge.yml gave the root + # of its filesystem after mounting. The second one gets what group_vars sets. + - name: 'Assert the owner, group and mode of the roots of the mounted filesystems' + ansible.builtin.assert: + that: + - '__molecule__owner_mode_result["stdout_lines"][0] == "nobody root 1777"' + - '__molecule__owner_mode_result["stdout_lines"][1] == "nobody daemon 750"' + fail_msg: '{{ __molecule__owner_mode_result["stdout_lines"] }}' + # What the relabelling is for: the mount point and what is created on it carry the context # the policy assigns to the path, not unlabeled_t, which confined services may not access. - name: 'touch /srv/lfops-molecule/probe' diff --git a/extensions/molecule/setup_wordpress/converge.yml b/extensions/molecule/setup_wordpress/converge.yml index 9507fa253..114f575bd 100644 --- a/extensions/molecule/setup_wordpress/converge.yml +++ b/extensions/molecule/setup_wordpress/converge.yml @@ -4,6 +4,27 @@ - name: 'Converge setup_wordpress playbook' ansible.builtin.import_playbook: 'linuxfabrik.lfops.setup_wordpress' +# What a host installed by an older release looks like: `php-mysql` resolved to php-pecl-mysql, +# which pulled in php-mysqlnd as a dependency. The following plays have to migrate it. Only once, +# so that the idempotence run does not start over. +- name: 'Put the PHP MySQL packages into the state an older release left behind' + hosts: 'systems_under_test' + become: true + tasks: + + - name: 'dnf install php-mysql; dnf mark remove php-mysqlnd' + ansible.builtin.shell: |- + set -o errexit + dnf --assumeyes install php-mysql + dnf mark remove php-mysqlnd + rpm --query php-pecl-mysql + touch /var/lib/lfops-molecule-legacy-php-mysql + args: + creates: '/var/lib/lfops-molecule-legacy-php-mysql' + when: + - 'ansible_facts["os_family"] == "RedHat"' + + # Further instances on the same host, as pseudo hosts in the inventory would deploy them: the # same playbook again, with the variables of the instance overriding those from group_vars. # Together with the instance at the root of wordpress.example.com they cover an instance in a diff --git a/extensions/molecule/setup_wordpress/verify.yml b/extensions/molecule/setup_wordpress/verify.yml index 2c722fda1..83aa6618b 100644 --- a/extensions/molecule/setup_wordpress/verify.yml +++ b/extensions/molecule/setup_wordpress/verify.yml @@ -555,3 +555,39 @@ - '__molecule__wordpress_config_nobody_result["rc"] != 0' - '"Permission denied" in __molecule__wordpress_config_nobody_result["stderr"]' fail_msg: 'nobody read wp-config.php: rc={{ __molecule__wordpress_config_nobody_result["rc"] }}, {{ __molecule__wordpress_config_nobody_result["stderr"] }}' + + # WordPress talks to MariaDB through mysqli. The obsolete ext/mysql (php-pecl-mysql), which + # the package name `php-mysql` resolves to with a Remi module stream, must not be loaded. + - name: 'php -m' + ansible.builtin.command: 'php -m' + register: '__molecule__wordpress_php_modules_result' + changed_when: false + + - name: 'Assert that PHP loads mysqli and not ext/mysql' + ansible.builtin.assert: + that: + - '"mysqli" in __molecule__wordpress_php_modules_result["stdout_lines"]' + - '"mysqlnd" in __molecule__wordpress_php_modules_result["stdout_lines"]' + - '"mysql" not in __molecule__wordpress_php_modules_result["stdout_lines"]' + fail_msg: '{{ __molecule__wordpress_php_modules_result["stdout_lines"] }}' + + # converge.yml puts php-pecl-mysql back with php-mysqlnd as its dependency. The role has to + # remove the former without leaving the latter to `dnf autoremove`. + - name: 'dnf repoquery: php-pecl-mysql, reason of php-mysqlnd, unneeded packages' + ansible.builtin.shell: |- + set -o errexit + echo "installed: $(dnf --quiet repoquery --installed --queryformat '%{name}' php-pecl-mysql)" + echo "reason: $(dnf --quiet repoquery --installed --queryformat '%{reason}' php-mysqlnd)" + echo "unneeded: $(dnf --quiet repoquery --unneeded --queryformat '%{name}' | grep --line-regexp php-mysqlnd || true)" + register: '__molecule__wordpress_php_mysqlnd_result' + changed_when: false + when: + - 'ansible_facts["os_family"] == "RedHat"' + + - name: 'Assert that php-pecl-mysql is gone and php-mysqlnd survives dnf autoremove' + ansible.builtin.assert: + that: + - '__molecule__wordpress_php_mysqlnd_result["stdout_lines"] == ["installed: ", "reason: user", "unneeded: "]' + fail_msg: '{{ __molecule__wordpress_php_mysqlnd_result["stdout_lines"] }}' + when: + - 'ansible_facts["os_family"] == "RedHat"' diff --git a/roles/duplicity/README.md b/roles/duplicity/README.md index 741419dee..6f37024e2 100644 --- a/roles/duplicity/README.md +++ b/roles/duplicity/README.md @@ -141,7 +141,7 @@ duplicity__swift_login: `duplicity__backup_retention_time` -* The retention time of the backups. Time Formats: `s`, `m`, `h`, `D`, `W`, `M`, or `Y`. `duba` removes a backup chain (a full backup and its incrementals) only once its newest backup is older than this, so with the defaults and one backup a day the oldest backup you can restore is between 31 and 61 days old. `duba` only cleans up the paths that exist on the host when it runs: the backup chains of a removed directory, of an entry removed below a `divide: true` source, or of a source set to `state: 'absent'` stay in the storage until they are deleted by hand there. +* The retention time of the backups. Time Formats: `s`, `m`, `h`, `D`, `W`, `M`, or `Y`. `duba` removes a backup chain (a full backup and its incrementals) only once its newest backup is older than this, so with the defaults and one backup a day the oldest backup you can restore is between 31 and 61 days old. In a run in which the backup of a path fails, `duba` does not clean up that path, so a path whose backups keep failing keeps its old backups. `duba` only cleans up the paths that exist on the host when it runs: the backup chains of a removed directory, of an entry removed below a `divide: true` source, or of a source set to `state: 'absent'` stay in the storage until they are deleted by hand there. * Type: String. * Default: `'30D'` diff --git a/roles/duplicity/templates/usr/local/bin/duba.j2 b/roles/duplicity/templates/usr/local/bin/duba.j2 index fcc698627..f3b0ce130 100644 --- a/roles/duplicity/templates/usr/local/bin/duba.j2 +++ b/roles/duplicity/templates/usr/local/bin/duba.j2 @@ -20,7 +20,7 @@ import time # pylint: disable=C0413 from traceback import format_exc # pylint: disable=C0413 __author__ = 'Linuxfabrik GmbH, Zurich/Switzerland' -__version__ = '2026102905' +__version__ = '2026111201' DESCRIPTION = 'Do a massive parallel backup to a Swift storage backend with duplicity.' @@ -137,8 +137,10 @@ def parse_args(argv): class Duba: def __init__(self, config_file='/etc/duba/duba.json'): - self.config = self.load_config(config_file) + # the logger comes first, since load_config() reports its errors with it self.logger = self.init_logging() + self.config = self.load_config(config_file) + self.create_logdir() self.duplicity_version = self.get_duplicity_version() # self.use_concurrency = self.duplicity_version >= (3, 0, 0) @@ -154,14 +156,16 @@ class Duba: )) logger.addHandler(console_logger) + return logger + + + def create_logdir(self): # try creating logfile directory for duplicity try: os.mkdir(self.config.get('logdir', '/var/log/duplicity'), 0o640) except OSError: pass - return logger - def load_config(self, config_file): # load config file @@ -169,7 +173,7 @@ class Duba: with open(config_file, 'r') as f: config = f.read() except IOError as e: - self.logger.exception(f'I/O error: {e.strerror} while opening or reading {config_file}') + self.logger.error(f'I/O error: {e.strerror} while opening or reading {config_file}') sys.exit(201) except: self.logger.exception(f'Unknown error opening or reading {config_file}') @@ -179,7 +183,7 @@ class Duba: try: return json.loads(config) except json.JSONDecodeError as e: - self.logger.exception(f'JSON decode error: {e}') + self.logger.error(f'JSON decode error in {config_file}: {e}') sys.exit(203) @@ -322,7 +326,8 @@ class Duba: return cmd - def run_cmd_in_background(self, cmd, env, running_procs, max_procs, failed_retcs): + def run_cmd_in_background(self, cmd, env, running_procs, max_procs, failed_retcs, + path=None, failed_paths=None): # start duplicity in the background # * start n processes: start up to (cpu-cores + 1) nice processes to backup as # much as possible @@ -331,7 +336,7 @@ class Duba: # * use compression: saves money on external storages; bottleneck is always your uplink # and return immediately try: - running_procs.append(subprocess.Popen(cmd, env=env)) + proc = subprocess.Popen(cmd, env=env) except OSError as e: self.logger.exception(f'OS Error "{e.errno} {e.strerror}" calling command "{cmd}"') sys.exit(205) @@ -341,26 +346,30 @@ class Duba: except Exception as e: self.logger.exception(f'Unknown error "{e}" while calling command "{cmd}"') sys.exit(207) + # the path this process works on, for reap_finished_procs() + proc.duba_path = path + running_procs.append(proc) # don't start more than max cpu processes while True: time.sleep(0.5) - self.reap_finished_procs(running_procs, failed_retcs) + self.reap_finished_procs(running_procs, failed_retcs, failed_paths) if len(running_procs) <= max_procs: # allow launching of another process break - def wait_for_running_procs(self, running_procs, failed_retcs): + def wait_for_running_procs(self, running_procs, failed_retcs, failed_paths=None): while running_procs: time.sleep(0.5) - self.reap_finished_procs(running_procs, failed_retcs) + self.reap_finished_procs(running_procs, failed_retcs, failed_paths) - def reap_finished_procs(self, running_procs, failed_retcs): + def reap_finished_procs(self, running_procs, failed_retcs, failed_paths=None): # Collect the exit code of every finished process, not just of the last one # polled, so that one failed source fails the whole run. Iterates over a copy, - # since finished processes are removed from the list. + # since finished processes are removed from the list. The path of a failed + # process is added to `failed_paths`, if given. for proc in list(running_procs): retc = proc.poll() if retc is None: @@ -371,6 +380,8 @@ class Duba: if retc not in (0, 13): self.logger.error(f"Exit code {retc}: {' '.join(proc.args)}") failed_retcs.append(retc) + if failed_paths is not None: + failed_paths.add(proc.duba_path) def divide_source_dir(self, src_path): @@ -395,6 +406,7 @@ class Duba: cpu_count = min(os.sysconf('SC_NPROCESSORS_ONLN'), 6) env = self.set_env(self.config.get('env', {})) backup_failed_retcs = [] + backup_failed_paths = set() cleanup_failed_retcs = [] # iterate over backup dirs and spawn processes @@ -417,12 +429,13 @@ class Duba: self.logger.info(f"Running: {' '.join(cmd)}") self.run_cmd_in_background( - cmd, env, running_procs, cpu_count, backup_failed_retcs + cmd, env, running_procs, cpu_count, backup_failed_retcs, + path=f, failed_paths=backup_failed_paths ) # wait here for all processes to finish self.logger.debug('All duplicity processes started, waiting for them to finish.') - self.wait_for_running_procs(running_procs, backup_failed_retcs) + self.wait_for_running_procs(running_procs, backup_failed_retcs, backup_failed_paths) self.logger.info('Backup done.') self.logger.info('Starting cleanup...') @@ -439,6 +452,11 @@ class Duba: continue for f in src['filelist']: + # Without a new backup, nothing replaces the backups the cleanup removes: a + # path that keeps failing would lose every chain but its last one over time. + if f in backup_failed_paths: + self.logger.warning(f'Skipping the cleanup of {f}, since its backup failed.') + continue cmd = self.build_duplicity_cleanup_command(f) self.logger.info(f"Running: {' '.join(cmd)}") diff --git a/roles/fangfrisch/README.md b/roles/fangfrisch/README.md index 4ce842940..395610ff4 100644 --- a/roles/fangfrisch/README.md +++ b/roles/fangfrisch/README.md @@ -14,6 +14,12 @@ Any [LFOps playbook](https://github.com/Linuxfabrik/lfops/blob/main/playbooks/RE * On Rocky 9+, the EPEL repository (role: [linuxfabrik.lfops.repo_epel](https://github.com/Linuxfabrik/lfops/tree/main/roles/repo_epel)) and the CRB ("Code Ready Builder") repository (role: [linuxfabrik.lfops.repo_baseos](https://github.com/Linuxfabrik/lfops/tree/main/roles/repo_baseos)) must be enabled so `python3-virtualenv` can be installed. +## How the Role Behaves + +* Fangfrisch always downloads the [Sanesecurity](https://sanesecurity.com/) signatures. The SecuriteInfo and URLhaus signatures need an account with the provider and are only downloaded once `fangfrisch__securiteinfo_customer_id` or `fangfrisch__urlhaus_auth_key` is set. +* On its next refresh, Fangfrisch removes the signatures it downloaded from a source that is no longer enabled. + + ## Tags `fangfrisch` @@ -35,6 +41,12 @@ Any [LFOps playbook](https://github.com/Linuxfabrik/lfops/blob/main/playbooks/RE * Type: String. * Default: unset +`fangfrisch__urlhaus_auth_key` + +* Set this to enable downloading signatures from [URLhaus](https://urlhaus.abuse.ch/). Requires an Auth-Key from the [abuse.ch Authentication Portal](https://auth.abuse.ch/). +* Type: String. +* Default: unset + `fangfrisch__timer_enabled` * Enables or disables the hourly fangfrisch timer to automatically update the signatures, analogous to `systemctl enable/disable`. @@ -44,8 +56,9 @@ Any [LFOps playbook](https://github.com/Linuxfabrik/lfops/blob/main/playbooks/RE Example: ```yaml # optional -fangfrisch__securiteinfo_customer_id: 'IVQyhw7Yszua6pzUhlGPVowucenHt2wQe9iXDfwsMOfheeOUakB28irj5JyDsKF4e81LkLbNUtMHcUGL9EVKOJ9WxSSv4ySjBhY0vngBDunEPlixtGTBB6f1mvaTqXzz' +fangfrisch__securiteinfo_customer_id: 'linuxfabrik' fangfrisch__timer_enabled: false +fangfrisch__urlhaus_auth_key: 'linuxfabrik' ``` diff --git a/roles/fangfrisch/templates/etc/fangfrisch.conf.j2 b/roles/fangfrisch/templates/etc/fangfrisch.conf.j2 index 9383ee3de..f5f5579dd 100644 --- a/roles/fangfrisch/templates/etc/fangfrisch.conf.j2 +++ b/roles/fangfrisch/templates/etc/fangfrisch.conf.j2 @@ -1,5 +1,5 @@ # {{ ansible_managed }} -# 2025012201 +# 2026111201 [DEFAULT] # Other sections inherit values from DEFAULT and may also overwrite values. @@ -12,11 +12,16 @@ on_update_timeout = 42 [sanesecurity] enabled = true -[urlhaus] -enabled = true - -{% if fangfrisch__securiteinfo_customer_id is defined and fangfrisch__securiteinfo_customer_id | length %} +{% if fangfrisch__securiteinfo_customer_id is defined and fangfrisch__securiteinfo_customer_id | length > 0 %} [securiteinfo] enabled = true customer_id = {{ fangfrisch__securiteinfo_customer_id }} + +{% endif %} +{# abuse.ch only serves the URLhaus signatures with an auth key. Without one, Fangfrisch requests + them with its placeholder key, and every refresh logs a 401 for this source. #} +{% if fangfrisch__urlhaus_auth_key is defined and fangfrisch__urlhaus_auth_key | length > 0 %} +[urlhaus] +enabled = true +auth_key = {{ fangfrisch__urlhaus_auth_key }} {% endif %} diff --git a/roles/gitlab_ce/README.md b/roles/gitlab_ce/README.md index ebf45c755..657224e6d 100644 --- a/roles/gitlab_ce/README.md +++ b/roles/gitlab_ce/README.md @@ -11,6 +11,8 @@ This role installs and configures [GitLab CE](https://about.gitlab.com/), includ ## How the Role Behaves +* `gitlab-dump.service` runs `gitlab-backup create STRATEGY=copy` into `gitlab_ce__rb_gitlab_rails_backup_path`, and fails if a part of the dump fails. With `STRATEGY=copy`, as the GitLab documentation recommends for a running instance, GitLab copies each of its file stores (uploads, CI artifacts, LFS objects, the container registry, ...) to the backup path before archiving it, one after the other. On top of the archive, the backup path therefore needs free space for the largest of them. GitLab stays available during the dump. +* `/etc/gitlab/gitlab.rb` and `/etc/gitlab/gitlab-secrets.json` are not part of the dump, back up `/etc/gitlab` separately. The `duplicity` role does so by default. * `gitlab-dump.service` runs with `Nice=19`, best-effort IO priority 7 and `CPUWeight=` / `IOWeight=` of `20` (systemd default: `100`), so the dump does not slow down the application on a busy host. The weights only take effect under contention. `IOWeight=` only has an effect on block devices that use the BFQ IO scheduler; with `none` or `mq-deadline`, as on a RHEL 9 VM with virtio disks, it is ignored. * The role does not configure sshd. Git over SSH opens one connection per `git fetch` or `git push`, so CI jobs or scripts that update many repositories at once exceed the `MaxStartups` of the [sshd](https://github.com/Linuxfabrik/lfops/tree/main/roles/sshd) role, and sshd refuses some of them. Set `sshd__max_startups__group_var: '100:30:200'` for GitLab hosts in the inventory, the value the [GitLab documentation](https://docs.gitlab.com/topics/git/troubleshooting_git/) suggests. diff --git a/roles/gitlab_ce/templates/etc/systemd/system/gitlab-dump.service.j2 b/roles/gitlab_ce/templates/etc/systemd/system/gitlab-dump.service.j2 index 25786b972..450d43539 100644 --- a/roles/gitlab_ce/templates/etc/systemd/system/gitlab-dump.service.j2 +++ b/roles/gitlab_ce/templates/etc/systemd/system/gitlab-dump.service.j2 @@ -1,13 +1,16 @@ # {{ ansible_managed }} -# 2026101301 +# 2026111201 [Unit] Description=Dumps (Backups) for GitLab [Service] -# ignore "Warning: Your gitlab.rb and gitlab-secrets.json files contain sensitive data and are not included in this backup" -# by prefixing the path with a minus sign (we backup /etc using other tools, so its safe to ignore the warning) -ExecStart=-/usr/bin/gitlab-backup create +# No `-` prefix: gitlab-backup exits with 1 if a part of the dump failed, and the unit has to +# fail then. The warning that gitlab.rb and gitlab-secrets.json are not part of the backup does +# not change the exit code (lib/backup/manager.rb and lib/tasks/gitlab/backup.rb, GitLab 19.5). +# STRATEGY=copy copies the files to the backup path before archiving them, so tar does not +# fail with "file changed as we read it" on a running instance. +ExecStart=/usr/bin/gitlab-backup create STRATEGY=copy Type=oneshot User=root # the dump must not slow down GitLab and the applications behind it. Nice= and the CPU / IO diff --git a/roles/icinga2_agent/tasks/main.yml b/roles/icinga2_agent/tasks/main.yml index 6c2491ca6..0ff1eb13b 100644 --- a/roles/icinga2_agent/tasks/main.yml +++ b/roles/icinga2_agent/tasks/main.yml @@ -261,12 +261,13 @@ validate_certs: '{{ icinga2_agent__validate_certs }}' register: '__icinga2_agent__director_host_result' # The Director answers 422 "Trying to recreate icinga_host" for a host it already has, which - # is the expected answer on every run after the first one. - changed_when: '__icinga2_agent__director_host_result["status"] == 201' + # is the expected answer on every run after the first one. Every other answer is an error + # (wrong login, Director or IcingaWeb2 down, another 422), and without a response there is + # neither a status nor a JSON body. + changed_when: '__icinga2_agent__director_host_result["status"] | d(0) == 201' failed_when: - - '__icinga2_agent__director_host_result["status"] != 201' - - '"Trying to recreate" not in __icinga2_agent__director_host_result["json"]["error"] | d("")' - ignore_errors: true + - '__icinga2_agent__director_host_result["status"] | d(0) != 201' + - '"Trying to recreate" not in (__icinga2_agent__director_host_result["json"] | d({}))["error"] | d("")' when: - 'icinga2_agent__icingaweb2_user_login is defined and icinga2_agent__icingaweb2_user_login | length > 0' diff --git a/roles/mount/README.md b/roles/mount/README.md index 2c2ea6fe0..d8671940d 100644 --- a/roles/mount/README.md +++ b/roles/mount/README.md @@ -8,6 +8,7 @@ This role installs NFS and CIFS client utilities when necessary and configures m ## How the Role Behaves +* The role creates a missing mount point as `root:root` with mode `0755` and never changes an existing one, so the owner and mode of the root of a mounted filesystem stay as they are on the share. Only where a mount sets `owner`, `group` or `mode`, the role applies them to the path after mounting, that is to the root of the mounted filesystem. On an NFS export with `root_squash` this fails, since root may not change them there; set them on the NFS server instead. * A freshly created filesystem carries no SELinux labels, so confined services such as Apache httpd are denied access to it. When SELinux is not disabled and the mount point of a mounted filesystem is still `unlabeled_t`, the role runs `restorecon -R` on it once. A filesystem that already carries labels is not touched, so a context set by hand, for example with `chcon`, survives. NFS and CIFS shares get their context from the mount options and are never relabeled. @@ -15,7 +16,7 @@ This role installs NFS and CIFS client utilities when necessary and configures m `mount` -* Installs nfs-utils/cifs on RedHat-Based systems or nfs-common/cifs-utils on Debian-Based systems, creates the corresponding directories for the mount points, alters `/etc/fstab` and mounts the volumes. +* Installs nfs-utils/cifs on RedHat-Based systems or nfs-common/cifs-utils on Debian-Based systems, creates missing directories for the mount points, alters `/etc/fstab`, mounts the volumes and applies the `owner`, `group` and `mode` set for a mount. * Relabels a mounted filesystem with `restorecon -R` while its mount point carries no SELinux label (`unlabeled_t`), as on a freshly created volume. * Triggers: none. @@ -44,9 +45,15 @@ This role installs NFS and CIFS client utilities when necessary and configures m * `group`: - * Optional. Group of the mount point directory. + * Optional. Group of the root of the mounted filesystem. * Type: String. - * Default: `'root'` + * Default: unset, the group is left as it is + + * `mode`: + + * Optional. Mode of the root of the mounted filesystem, as a quoted octal number, for example `'0750'`. + * Type: String. + * Default: unset, the mode is left as it is * `opts`: @@ -55,9 +62,9 @@ This role installs NFS and CIFS client utilities when necessary and configures m * `owner`: - * Optional. Owner of the mount point directory. + * Optional. Owner of the root of the mounted filesystem. * Type: String. - * Default: `'root'` + * Default: unset, the owner is left as it is * `state`: @@ -87,6 +94,7 @@ mount__mounts__host_var: src: '/dev/sdb1' owner: 'myuser' group: 'mygroup' + mode: '0750' opts: 'defaults' state: 'mounted' ``` diff --git a/roles/mount/tasks/main.yml b/roles/mount/tasks/main.yml index f5363c614..4f483152f 100644 --- a/roles/mount/tasks/main.yml +++ b/roles/mount/tasks/main.yml @@ -34,14 +34,43 @@ + (mount__mounts__combined_var | selectattr("state", "undefined") | list)) | selectattr("fstype", "equalto", "cifs") | list | length > 0' + # An octal number without quotes arrives as a decimal one (0o750 as 488), which the file module + # would apply as it is. + - name: 'Assert that the mode of a mount is a quoted octal number' + ansible.builtin.assert: + that: + - 'item["mode"] is string' + - 'item["mode"] is regex("^[0-7]{3,4}$")' + quiet: true + fail_msg: 'The mode of the mount {{ item["path"] }} has to be a string such as "0750", got {{ item["mode"] }}.' + loop: '{{ mount__mounts__combined_var | selectattr("mode", "defined") }}' + loop_control: + label: '{{ item["path"] }}' + + - name: 'stat mount-point' + ansible.builtin.stat: + path: '{{ item["path"] }}' + loop: '{{ mount__mounts__combined_var }}' + loop_control: + label: '{{ item["path"] }}' + register: '__mount__stat_result' + + # Only a missing mount point is created. From the second run on, the path is the root of the + # mounted filesystem, whose owner and mode belong to the share (e.g. 0777 on an NFS export, + # where root may not even be allowed to change them). - name: 'mkdir -p mount-point' ansible.builtin.file: - path: '{{ item["path"] }}' + path: '{{ item["item"]["path"] }}' state: 'directory' - owner: '{{ item["owner"] | d("root") }}' - group: '{{ item["group"] | d("root") }}' + owner: 'root' + group: 'root' mode: 0o755 - loop: '{{ mount__mounts__combined_var }}' + loop: '{{ __mount__stat_result["results"] }}' + loop_control: + label: '{{ item["item"]["path"] }}' + when: + - 'not item["stat"]["exists"]' + - 'item["item"]["state"] | d("mounted") != "absent"' - name: 'Mount volumes' ansible.posix.mount: @@ -52,6 +81,22 @@ fstype: '{{ item["fstype"] }}' loop: '{{ mount__mounts__combined_var }}' + # After mounting, so that it reaches the root of the mounted filesystem right away, and only + # what the inventory asks for. + - name: 'chown / chmod mount-point' + ansible.builtin.file: + path: '{{ item["path"] }}' + state: 'directory' + owner: '{{ item["owner"] | d(omit) }}' + group: '{{ item["group"] | d(omit) }}' + mode: '{{ item["mode"] | d(omit) }}' + loop: '{{ mount__mounts__combined_var }}' + loop_control: + label: '{{ item["path"] }}' + when: + - 'item["owner"] is defined or item["group"] is defined or item["mode"] is defined' + - 'item["state"] | d("mounted") != "absent"' + # A freshly created filesystem carries no SELinux labels, so everything on it is unlabeled_t # and confined services such as httpd are denied access ("does not contain SELinux labels" # when mounting). Relabel a mounted filesystem whose mount point is still unlabeled, which diff --git a/roles/php/README.md b/roles/php/README.md index 7e961a9ea..3a5d2748c 100644 --- a/roles/php/README.md +++ b/roles/php/README.md @@ -103,6 +103,7 @@ Any [LFOps playbook](https://github.com/Linuxfabrik/lfops/blob/main/playbooks/RE `php:modules` * Installs and removes the PHP modules from `php__modules__combined_var`. +* On the Red Hat family, marks modules that are already installed as a dependency of another package as user-installed (`dnf mark install`), so `dnf autoremove` does not remove them once that other package is gone. * Triggers: none. `php:state` diff --git a/roles/php/tasks/main.yml b/roles/php/tasks/main.yml index 0ebd3da04..a4e151837 100644 --- a/roles/php/tasks/main.yml +++ b/roles/php/tasks/main.yml @@ -99,6 +99,32 @@ ansible.builtin.debug: var: 'php__modules__combined_var' + # A module that is already installed as a dependency of another package keeps the reason + # "dependency", even if it is asked for by name later: the install below is a no-op for it + # (`dnf install` answers "Nothing to do"). As soon as the package that pulled it in goes away, + # for example php-pecl-mysql, which requires php-mysqlnd, `dnf autoremove` would take the + # module with it. So mark the modules from the inventory as user-installed, before anything + # is removed. Verified with dnf 4.7 on Rocky 8, dnf 4.14 on Rocky 9 and dnf 4.20 on Rocky 10. + - name: 'dnf --quiet repoquery --installed --queryformat "%{name} %{reason}" ...' + ansible.builtin.command: + argv: '{{ ["dnf", "--quiet", "repoquery", "--installed", "--queryformat", "%{name} %{reason}"] + __php__modules_present }}' + register: '__php__modules_reason_result' + changed_when: false + check_mode: false + when: + - 'ansible_facts["os_family"] == "RedHat"' + - '__php__modules_present | length > 0' + + - name: 'dnf mark install ... # modules that are installed as a dependency only' + ansible.builtin.command: + argv: '{{ ["dnf", "mark", "install"] + __php__modules_dependency }}' + changed_when: true + vars: + __php__modules_dependency: '{{ __php__modules_reason_result["stdout_lines"] | d([]) + | select("search", " dependency$") | map("regex_replace", " dependency$", "") | unique }}' + when: + - '__php__modules_dependency | length > 0' + - name: 'Ensure PHP modules are absent' # providing the packages as a list is much more faster than looping for each ansible.builtin.package: @@ -108,12 +134,14 @@ - name: 'Ensure PHP modules are present' # providing the packages as a list is much more faster than looping for each ansible.builtin.package: - name: '{{ (php__modules__combined_var | selectattr("state", "defined") | selectattr("state", "ne", "absent") | map(attribute="name")) - + (php__modules__combined_var | selectattr("state", "undefined") | map(attribute="name")) }}' + name: '{{ __php__modules_present }}' state: 'present' retries: 3 # ride out a brief outage of the package repository delay: 10 + vars: + __php__modules_present: '{{ (php__modules__combined_var | selectattr("state", "defined") | selectattr("state", "ne", "absent") | map(attribute="name")) + + (php__modules__combined_var | selectattr("state", "undefined") | map(attribute="name")) }}' tags: - 'php' - 'php:modules' diff --git a/roles/sshd/defaults/main.yml b/roles/sshd/defaults/main.yml index 45aa70b8e..6c5a44a65 100644 --- a/roles/sshd/defaults/main.yml +++ b/roles/sshd/defaults/main.yml @@ -32,6 +32,7 @@ sshd__permit_root_login: 'no' # upstream default: 'prohibit-password' sshd__port: 22 sshd__service_enabled: true sshd__service_state: 'started' +sshd__sftp_subsystem: '{{ __sshd__sftp_subsystem }}' sshd__tcp_keep_alive: false sshd__use_dns: false sshd__x11_forwarding: false diff --git a/roles/sshd/meta/argument_specs.yml b/roles/sshd/meta/argument_specs.yml index 8b1320593..261826f35 100644 --- a/roles/sshd/meta/argument_specs.yml +++ b/roles/sshd/meta/argument_specs.yml @@ -1,3 +1,6 @@ +# sshd__sftp_subsystem is deliberately absent: its default in defaults/main.yml references +# __sshd__sftp_subsystem from vars/.yml, which is not loaded yet when argument_specs +# validation runs at role entry. It is documented in the README instead. argument_specs: main: options: @@ -165,13 +168,6 @@ argument_specs: description: >- Runtime state of the sshd service. - sshd__sftp_subsystem: - type: 'str' - required: false - description: >- - Command used for the sftp subsystem. Defaults to the - platform-specific path in `vars/`. - sshd__use_dns: type: 'bool' required: false diff --git a/roles/sshd/vars/Debian.yml b/roles/sshd/vars/Debian.yml index 29735e173..b20b5a7d2 100644 --- a/roles/sshd/vars/Debian.yml +++ b/roles/sshd/vars/Debian.yml @@ -1,2 +1,2 @@ __sshd__service_name: 'ssh' -sshd__sftp_subsystem: '/usr/lib/openssh/sftp-server' +__sshd__sftp_subsystem: '/usr/lib/openssh/sftp-server' diff --git a/roles/sshd/vars/RedHat.yml b/roles/sshd/vars/RedHat.yml index 38047c586..39689b04e 100644 --- a/roles/sshd/vars/RedHat.yml +++ b/roles/sshd/vars/RedHat.yml @@ -1,2 +1,2 @@ __sshd__service_name: 'sshd' -sshd__sftp_subsystem: '/usr/libexec/openssh/sftp-server' +__sshd__sftp_subsystem: '/usr/libexec/openssh/sftp-server' diff --git a/roles/sshd/vars/Ubuntu.yml b/roles/sshd/vars/Ubuntu.yml index 29735e173..b20b5a7d2 100644 --- a/roles/sshd/vars/Ubuntu.yml +++ b/roles/sshd/vars/Ubuntu.yml @@ -1,2 +1,2 @@ __sshd__service_name: 'ssh' -sshd__sftp_subsystem: '/usr/lib/openssh/sftp-server' +__sshd__sftp_subsystem: '/usr/lib/openssh/sftp-server' diff --git a/roles/wordpress/defaults/main.yml b/roles/wordpress/defaults/main.yml index b85d1ffd1..a18cdb34f 100644 --- a/roles/wordpress/defaults/main.yml +++ b/roles/wordpress/defaults/main.yml @@ -54,8 +54,15 @@ wordpress__php__modules__dependent_var: state: 'present' - name: 'php-intl' state: 'present' - - name: 'php-mysql' + # Not `php-mysql`: with a Remi module stream that name resolves to php-pecl-mysql, the obsolete + # ext/mysql, which only pulls in php-mysqlnd as a dependency. WordPress uses mysqli from + # php-mysqlnd. + - name: 'php-mysqlnd' state: 'present' + # Migration: hosts installed with `php-mysql` still carry it. The php role marks php-mysqlnd as + # user-installed before it removes this one, so `dnf autoremove` leaves php-mysqlnd alone. + - name: 'php-pecl-mysql' + state: 'absent' - name: 'php-zip' state: 'present'