ansible-grafana icon indicating copy to clipboard operation
ansible-grafana copied to clipboard

Apt repo doesn't update

Open till opened this issue 5 years ago • 8 comments

What happened?

I ran an older release of this role on a host and got an error about packagecloud.io. I update this role (to 0.16.1) and re-ran — still the same error.

Did you expect to see some different?

I expected the role to install Grafana.

How to reproduce it (as minimally and precisely as possible):

  • run older release of this role (and get error)
  • update this role
  • re-run and get the same error

Environment

  • Debian Stretch
  • Role version:

    0.16.0

  • Ansible playbook execution Logs:

TASK [cloudalchemy.grafana : Install dependencies] *****************************
FAILED - RETRYING: Install dependencies (5 retries left).
FAILED - RETRYING: Install dependencies (4 retries left).
FAILED - RETRYING: Install dependencies (3 retries left).
FAILED - RETRYING: Install dependencies (2 retries left).
FAILED - RETRYING: Install dependencies (1 retries left).
 [WARNING]: Updating cache and auto-installing missing dependency: python-apt
fatal: [foo]: FAILED! => {"attempts": 5, "changed": false, "cmd": "apt-get update", "msg": "E: The repository 'https://packagecloud.io/grafana/stable/debian stretch Release' does no longer have a Release file.", "rc": 100, "stderr": "E: The repository 'https://packagecloud.io/grafana/stable/debian stretch Release' does no longer have a Release file.\n", "stderr_lines": ["E: The repository 'https://packagecloud.io/grafana/stable/debian stretch Release' does no longer have a Release file."], "stdout": "Hit:1 http://packages.icinga.com/debian icinga-stretch InRelease\nIgn:2 http://ftp.de.debian.org/debian stretch InRelease\nHit:3 http://security.debian.org/debian-security stretch/updates InRelease\nHit:4 http://ftp.de.debian.org/debian stretch-updates InRelease\nHit:5 http://ftp.de.debian.org/debian stretch-backports InRelease\nHit:6 http://ftp.de.debian.org/debian stretch Release\nIgn:7 http://repo.r1soft.com/apt stable InRelease\nHit:8 http://repo.r1soft.com/apt stable Release\nIgn:11 https://packagecloud.io/grafana/stable/debian stretch InRelease\nErr:12 https://packagecloud.io/grafana/stable/debian stretch Release\n  404  Not Found\nReading package lists...\n", "stdout_lines": ["Hit:1 http://packages.icinga.com/debian icinga-stretch InRelease", "Ign:2 http://ftp.de.debian.org/debian stretch InRelease", "Hit:3 http://security.debian.org/debian-security stretch/updates InRelease", "Hit:4 http://ftp.de.debian.org/debian stretch-updates InRelease", "Hit:5 http://ftp.de.debian.org/debian stretch-backports InRelease", "Hit:6 http://ftp.de.debian.org/debian stretch Release", "Ign:7 http://repo.r1soft.com/apt stable InRelease", "Hit:8 http://repo.r1soft.com/apt stable Release", "Ign:11 https://packagecloud.io/grafana/stable/debian stretch InRelease", "Err:12 https://packagecloud.io/grafana/stable/debian stretch Release", "  404  Not Found", "Reading package lists..."]}

Anything else we need to know?:

Yep, I fixed this by rm /etc/apt/source.list.d/grafana.list

What's weird, after that and a successful run, it re-created the repo as:

/etc/apt/sources.list.d/packages_grafana_com_oss_deb.list

till avatar Jan 21 '20 13:01 till

I don't see this as a bug with this role, but with how grafana handled repository migration. The role doesn't manage apt repository configuration files and just installs grafana from whatever was specified in grafana docs https://github.com/cloudalchemy/ansible-grafana/blob/master/tasks/install.yml#L31-L53

This role is already blown to unmanageable proportions and I would like to not add workarounds to things upstream grafana does.

paulfantom avatar Jan 21 '20 13:01 paulfantom

@paulfantom well, arguable I think repos should be configurable. Not my use-case, but I know plenty orgs who run their own apt mirror, etc..

Anyhow, it wasn't about that anyway, more like, why didn't the repo update. Or is this an Ansible problem?

till avatar Jan 21 '20 19:01 till

Anyhow, it wasn't about that anyway, more like, why didn't the repo update. Or is this an Ansible problem?

Looking closer it actually might have been an unpredicted issue with the role and execution of apt_repository module. In that module we are not setting filename and ansible tries to create repo file based on repo url. This might have caused to create a second grafana repo and confuse apt.


I think repos should be configurable

It is not a question of what should be a feature, but of maintainability of said feature. Right now there are too many features and workarounds in this repository to even consider adding new ones. Currently, I am in the process of removing stuff so repository could be easier to maintain, but it will take quite some time.

paulfantom avatar Jan 22 '20 16:01 paulfantom

@paulfantom I pushed hard to get the dashboard support into Ansible. I can send a PR. Can you make a list of refactorings you want? I will try to help!

till avatar Jan 23 '20 08:01 till

Making dashboard management via ansible is in the first place on the todo list. PR is already at https://github.com/cloudalchemy/ansible-grafana/pull/195, but it seems ansible module is buggy. I get failures in my local tests and I didn't have time to investigate it more (as far as I remember, it was something with message parameter in ansible module), so if you could help with this it would be awesome!.

Next thing would be to remove mechanisms for downloading stuff from grafana.net and maybe providing it as an example in README.md. This part of code is super crazy and IMHO should be handled by an ansible module (which may live here or be part of ansible project, basically this issue: https://github.com/ansible/ansible/issues/52636)

On top of that there are few issues marked as enhancements I would love to see here, but also probably as an ansible module. I was even thinking of developing ansible modules here and later promoting them to ansible/ansible.

We can also meet for coffee and discuss roadmap :smile:

paulfantom avatar Jan 23 '20 14:01 paulfantom

You need this, probably: https://github.com/ansible-collections/grafana/pull/11

Don't ask me how to use it yet, but collections is the new thing.

till avatar Jan 23 '20 16:01 till

@paulfantom oh, and we should definitely meet for coffee. Are you on Twitter? Maybe we can DM to find a time and place. I am here @klimpong.

till avatar Jan 23 '20 16:01 till

Seems like we'll need to incorporate this collection into the role or provide some instructions on how to install it. But I don't think this is necessary right now or in near future.


I am @paulfantom on twitter :)

paulfantom avatar Jan 23 '20 18:01 paulfantom

This role has been deprecated in favor of a the grafana-ansible-collection collection.

SuperQ avatar May 31 '23 04:05 SuperQ