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

Add cron role #275

Merged
merged 5 commits into from
Mar 6, 2023
Merged

Add cron role #275

merged 5 commits into from
Mar 6, 2023

Conversation

mrsrvman
Copy link
Contributor

@mrsrvman mrsrvman commented Mar 6, 2023

Two example:

  • pgbackrest
  • wal-g

@vitabaks
Copy link
Owner

vitabaks commented Mar 6, 2023

@mrsrvman thank you so much for your contribution!

It's funny, but today I planned to add a task for the crontab configuration for wal-g. But I like the idea of having a separate role because it's a more universal solution and you can add any tasks.

Now that we can set tasks for pgbackrest in the cron_jobs variable, the pgbackrest_cron variable is now redundant, please delete it. And "Crontab pgbackrest" task.

vars/main.yml Outdated Show resolved Hide resolved
vars/main.yml Show resolved Hide resolved
vars/main.yml Outdated Show resolved Hide resolved
vars/main.yml Outdated Show resolved Hide resolved
loop: "{{ cron_jobs }}"
when:
- cron_jobs is defined and cron_jobs | length > 0
- remove_postgres is defined and remove_postgres | bool
Copy link
Owner

Choose a reason for hiding this comment

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

In this case, the role must be added to the remove_cluster.yml playbook

roles/cron/tasks/main.yml Outdated Show resolved Hide resolved
vars/main.yml Outdated
# day: "*"
# month: "*"
# weekday: "*"
# job: "[ '200' = $(curl -s -o /dev/null -w '\\%{http_code}' http://{{ hostvars[inventory_hostname]['inventory_hostname'] }}:8008) ] && /usr/local/bin/wal-g backup-push"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This command allows you to determine the master according to patroni

[ '200' = $(curl -s -o /dev/null -w '\%{http_code}' http://{{ hostvars[inventory_hostname]['inventory_hostname'] }}:8008) ]

Example for bash
curl -s -o /dev/null -w '%{http_code}' http://10.48.5.196:8008

vars/main.yml Outdated Show resolved Hide resolved
Co-authored-by: Vitaliy Kukharik <[email protected]>
@vitabaks vitabaks merged commit 33aa4bb into vitabaks:master Mar 6, 2023
@vitabaks vitabaks mentioned this pull request Mar 6, 2023
8 tasks
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.

2 participants