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

Run 'backup' task only when backup tag is specified #824

Closed
giem-git opened this issue Dec 7, 2023 · 0 comments · Fixed by #825
Closed

Run 'backup' task only when backup tag is specified #824

giem-git opened this issue Dec 7, 2023 · 0 comments · Fixed by #825
Assignees

Comments

@giem-git
Copy link
Contributor

giem-git commented Dec 7, 2023

A number of config tasks in tdp_collection have a backup task, generally like this :

name: Backup configuration
ansible.builtin.copy:
    src: "{{ conf_dir }}/"
    dest: "{{ conf_dir }}.{{ ansible_date_time.epoch }}"
    remote_src: true
tags:
  - backup

This has two unwanted side effects :

  • make the playbook non idempotent (above backup task will be considered as changed)
  • clutter conf_dir parent directory (generaly /etc/) with copied backup directories.

This step should be run only when the backup tag is specified on the command line.
Proposed resolution would be to add the never special tag as specified in ansible documentation to all backup tasks

@giem-git giem-git self-assigned this Dec 7, 2023
@giem-git giem-git linked a pull request Dec 8, 2023 that will close this issue
2 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 a pull request may close this issue.

1 participant