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

Fedora support broken #1610

Closed
Wunderharke opened this issue Feb 9, 2022 · 6 comments
Closed

Fedora support broken #1610

Wunderharke opened this issue Feb 9, 2022 · 6 comments

Comments

@Wunderharke
Copy link
Contributor

Wunderharke commented Feb 9, 2022

I suspect a095acc to broke my installation.
Im using Feora 35 with ntpd and the task [matrix-base : Ensure yum packages are installed] fails with No package ntp available.
When switching to systemd-timesyncd the same error occurs.

ansible --version

ansible 2.9.27
  config file = /opt/matrix-docker-ansible-deploy/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.9/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.9.10 (main, Jan 17 2022, 00:00:00) [GCC 11.2.1 20210728 (Red Hat 11.2.1-1)]

@spantaleev
Copy link
Owner

spantaleev commented Feb 9, 2022

I didn't know we even support Fedora.

You can manually set what ntp service and package to use by redefining matrix_ntpd_package and matrix_ntpd_service in your vars.yml file.

To debug what's going on, it might be helpful to try temporarily adding this at the top of roles/matrix-base/defaults/main.yml:

- debug: var="ansible_os_family"

- debug: var="ansible_distribution_major_version"

- fail: msg="Stop here"

.. and then re-running the playbook (ansible-playbook .... --tags=setup-all) to observe what it says.

We may then be able to adjust our conditional statements for matrix_ntpd_package and matrix_ntpd_service so that they work for Fedora.


I suppose other things may be breaking on Fedora as well, besides this ntp stuff.

@Wunderharke
Copy link
Contributor Author

Wunderharke commented Feb 9, 2022

Yes it worked for me pretty much out of the box until I accidentally removed /matrix and had to run the setup again. I use an external nginx proxy on the host to deal with firewall rules.

The issue was Changes/NtpReplacement, so I defined: matrix_ntpd_package = ntpsec and matrix_ntpd_service = ntpd.
I will do some debugging and give feedback regarding the detected os_family.

Unfortunately I ran into another problem namely:

TASK [matrix-client-element : Ensure Element themes repository is pulled]
fatal: [XXX -> 127.0.0.1]: FAILED! => changed=false 
  before: 6ef331cf302e0094ed0225b1dedec83cbdc0e54d
  msg: Local modifications exist in repository (force=no).

Should I open another issue for this?

@Wunderharke
Copy link
Contributor Author

The variables you provided unfortunately did not work but I ran aansible -m setup localhost | grep -e ansible_os_family -e ansible_distribution_major_version
which returned:

        "ansible_distribution_major_version": "34",
        "ansible_os_family": "RedHat",

So no error on this end. But if I am reading a095acc correct then systemd-timesyncd should be the default for RedHat and Version > 7

@spantaleev
Copy link
Owner

TASK [matrix-client-element : Ensure Element themes repository is pulled]
fatal: [XXX -> 127.0.0.1]: FAILED! => changed=false
before: 6ef331cf302e0094ed0225b1dedec83cbdc0e54d
msg: Local modifications exist in repository (force=no).

This indicates that you've made changes to the Element themes repository that's cloned in roles/matrix-client-element/files/scratchpad/themes. You shouldn't be making changes there. You can go to that directory and run git status to see what you've changed. To fix things up, delete the whole roles/matrix-client-element/files/scratchpad/themes directory and the playbook will regenerate it.


So no error on this end. But if I am reading a095acc correct then systemd-timesyncd should be the default for RedHat and Version > 7

If you're getting:

"ansible_distribution_major_version": "34",
"ansible_os_family": "RedHat",

.. then I also expect that the conditional statement we have since a095acc will indeed make it use systemd-timesyncd. It's a lucky coincidence, but it's probably the right thing to do.

I expect that the matrix-server-base role will choose the setup_redhat8.yml path here:

- include_tasks: "{{ role_path }}/tasks/server_base/setup_redhat.yml"
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version < '8'
- include_tasks: "{{ role_path }}/tasks/server_base/setup_redhat8.yml"
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version > '7'

.. which means it should be dying here for you:

- name: Ensure yum packages are installed
yum:
name:
- "{{ matrix_ntpd_package }}"
state: latest
update_cache: true

Can you modify the name of this task (e.g. Ensure yum packages are installed -> Ensure yum packages are installed on RedHat 8) and verify that it really dies at this task?

You can also add this somewhere and see what it says:

- debug: var="matrix_ntpd_package"

- debug: var="matrix_ntpd_service"

@Wunderharke
Copy link
Contributor Author

This indicates that you've made changes to the Element themes repository that's cloned in roles/matrix-client-element/files/scratchpad/themes. You shouldn't be making changes there. You can go to that directory and run git status to see what you've changed. To fix things up, delete the whole roles/matrix-client-element/files/scratchpad/themes directory and the playbook will regenerate it.

Indeed, build.py was modified even tho I don't remember to have tampered with this file ...
After deleting the folder and setting the correct packages the setup now runs through without problems.

Can you modify the name of this task (e.g. Ensure yum packages are installed -> Ensure yum packages are installed on RedHat 8) and verify that it really dies at this task?

I removed the manual ntp_package definition and modified the task.
To my surprise it is running setup_redhat.yml even though the debug shows correct values for os_family and major_version:

TASK [matrix-base : debug] *****************************************************
ok: [XXX] => 
  ansible_os_family: RedHat

TASK [matrix-base : debug] *****************************************************
ok: [XXX] => 
  ansible_distribution_major_version: '34'

TASK [matrix-base : debug] *****************************************************
ok: [XXX] => 
  matrix_ntpd_package: ntp

TASK [matrix-base : debug] *****************************************************
ok: [XXX] => 
  matrix_ntpd_service: ntpd

TASK [matrix-base : Ensure yum packages are installed on CentOS 7] *************
fatal: [XXX]: FAILED! => changed=false 
  failures:
  - No package ntp available.
  msg: Failed to install some of the specified packages
  rc: 1
  results: []

@spantaleev
Copy link
Owner

spantaleev commented Feb 9, 2022

That was helpful! I believe I've fixed this in 7330992. See the commit description for more information on what the problem was.

spantaleev added a commit to spantaleev/nextcloud-docker-ansible-deploy that referenced this issue Feb 9, 2022
Fedora 35 is:

- `ansible_os_family = 'RedHat'`
- `ansible_distribution_major_version = '35'`

Our RedHat checks against v7/v8 are really for RHEL derivatives (CentOS, Rockylinux,
AlmaLinux), but the same checks (by coincidence) apply for Fedora 35.

The problem is that `'35' > '7'` (comparing these as strings) is
`false`.

This patch makes sure that we always cast
`ansible_distribution_major_version` to an integer.

Related to spantaleev/matrix-docker-ansible-deploy#1610

Original fix here: spantaleev/matrix-docker-ansible-deploy@7330992
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

2 participants