Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should not remove files owned by system packages #17

Open
martinwe-adfinis opened this issue Jan 28, 2022 · 1 comment
Open

Should not remove files owned by system packages #17

martinwe-adfinis opened this issue Jan 28, 2022 · 1 comment

Comments

@martinwe-adfinis
Copy link

ISSUE TYPE
  • Bug Report
ANSIBLE VERSION
$ ansible --version
ansible 2.10.8
  config file = None
  configured module search path = ['/home/martinwe/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
CONFIGURATION
$ ansible-config dump --only-changed

(no output)

OS / ENVIRONMENT
$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
SUMMARY

In tasks/installation.yml, this role removes the following files and/or directories on Ubuntu 20.04:

  • /etc/mysql/mariadb.conf.d/
  • /etc/mysql/my.cnf
  • /etc/conf.d/mysql.conf

(potentially other files on other distributions, I haven't checked very thoroughly)

The issue is that some of these files are owned by distribution packages:

# dpkg -S /etc/mysql/{mariadb.conf.d,my.cnf,conf.d/mysql.cnf}
mariadb-server-10.3, mariadb-common, mariadb-client-10.3: /etc/mysql/mariadb.conf.d
dpkg-query: no path found matching pattern /etc/mysql/my.cnf
mysql-common: /etc/mysql/conf.d/mysql.cnf

Any update for these packages would thus cause these files to reappear, and potentially break existing configuration (or at least I assume that there is some reason why these files are removed in the first place).

STEPS TO REPRODUCE
  1. Apply this role;
  2. Reinstall/upgrade one of the affected packages (e.g. directly or as part of an apt upgrade);
  3. Reapply this role (potentially in check mode), and see that it would have to remove these files again.
EXPECTED RESULTS

An Ansible role should not simply delete package-provided files, or at least it should put mechanisms in place to ensure that they will not randomly reappear.

ACTUAL RESULTS

The configuration files reappear and thus require an Ansible run after a reinstallation/upgrade to avoid potential breakage.

Suggested solution: Evaluate why the files must be removed in the first place, and find a solution that fixes the actual problem (potentially it simply requires commenting out a problematic line in the default configuration).

martinwe-adfinis added a commit that referenced this issue Mar 30, 2022
For more details, see the upstream-reported issue [1].

[1] #17
@martinwe-adfinis
Copy link
Author

To work around the issue, I've created https://github.com/adfinis-sygroup/ansible-role-mariadb/tree/fix/spurious_changes to at least "fix" it for Ubuntu 20.04 for now (note that this is merely a case of "works for me"—there is no guarantee that it won't cause any issues anywhere else).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant