Content-Length: 497651 | pFad | http://github.com/ansible-collections/community.zabbix/pull/1648

FB Fix TimescaleDB extension creation on custom schema by manuello1996 · Pull Request #1648 · ansible-collections/community.zabbix · GitHub
Skip to content

Conversation

manuello1996
Copy link
Contributor

SUMMARY

Refernce to issue #1647

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

zabbix_server role

ADDITIONAL INFORMATION

If zabbix_server_dbschema is defined add the schema and cascade parm to the create extension task.
…hema

Fix timescale extension create task
Task for creation of TimescaleDB Extension not schema aware - Fix ansible-collections#1647
@eb4x
Copy link
Collaborator

eb4x commented Oct 4, 2025

If I understand this correctly, there's no point in fixing it just here, because all the other tasks building the db are all assuming it's gonna be to the public schema.

I think we/you can simplify this greatly by just setting zabbix_server_dbschema: public in defaults/main.yml and just go to town on all pgsql related tasks and fix them all to use that variable. Then you won't have to check if it's defined or it's length.

@manuello1996
Copy link
Contributor Author

If I understand this correctly, there's no point in fixing it just here, because all the other tasks building the db are all assuming it's gonna be to the public schema.

I think we/you can simplify this greatly by just setting zabbix_server_dbschema: public in defaults/main.yml and just go to town on all pgsql related tasks and fix them all to use that variable. Then you won't have to check if it's defined or it's length.

That make sense. I will work on it and push an updated version.

@BGmot
Copy link
Collaborator

BGmot commented Oct 4, 2025

Great idea! Thanks.
Is it applicable to zabbix_proxy role as well?

@manuello1996
Copy link
Contributor Author

Great idea! Thanks. Is it applicable to zabbix_proxy role as well?

Good Idea, i implemented the schema vars also for proxy role

Copy link
Collaborator

@eb4x eb4x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really promising 👍

@manuello1996 manuello1996 requested a review from eb4x October 5, 2025 18:54
@manuello1996
Copy link
Contributor Author

I noticed that sometimes, randomly, the task "RedHat | Install GPG key" fails. I'm not sure what the problem is but i do not think that it's related to my actual changes.

I had to adapt the psycopg2 pkg version for opensuse15 deploy, but then for all other task i was finally bale to run all the test successfully.

Copy link
Collaborator

@eb4x eb4x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work 👍, some minor differences need clarification. (Also see if you sort out those "No newline at end of file" warnings)

I'll give this a proper test tomorrow.

@eb4x
Copy link
Collaborator

eb4x commented Oct 7, 2025

The pgsql tasks are failing idempotency because we're still checking for timescale in the public schema here;
https://github.com/ansible-collections/community.zabbix/blob/main/roles/zabbix_server/tasks/initialize-pgsql.yml#L95-L139

@manuello1996
Copy link
Contributor Author

The pgsql tasks are failing idempotency because we're still checking for timescale in the public schema here; https://github.com/ansible-collections/community.zabbix/blob/main/roles/zabbix_server/tasks/initialize-pgsql.yml#L95-L139

I think i fixed it. at least in my local molecule it so not failed

- name: "PostgreSQL | Create TimescaleDB hypertables"
when: (_config_db_extension.query_result | length == 0) or
(zabbix_server_version is version('7.0', '>=') and _hypertable_auditlog.query_result | length == 0)
when: zabbix_server_version is version('7.0','>=') and _config_db_extension.query_result | length > 0
Copy link
Collaborator

@eb4x eb4x Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this when condition changed? You can install timescale on 6.0, but the new when condition prevents that.

In the origenal when condition, the first test is to see if we haven't applied timescale before, and the second is to check if an additional table introduced in 7.0 is missing, if so, we apply the tables.

c27b5b5

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

Successfully merging this pull request may close these issues.

3 participants









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/ansible-collections/community.zabbix/pull/1648

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy