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

Backup not done and some lint issues

Open michel-thomas opened this issue 1 year ago • 1 comments

Describe the bug I notice that in my deployments backup are not done.

I identify 2 problems with that:

  1. I only set netplan_backup_existing but is not considered to launch tasks/existing.yml
  2. Lint where not good so backup was not done

Expected behavior When only setting netplan_backup_existing (and not netplan_remove_existing), backup should be done.

I could make a PR with:

tasks/netplan.yml

- import_tasks: existing.yml
  when:
    - netplan_remove_existing or netplan_backup_existing

instead of

- import_tasks: existing.yml
  when:
    - netplan_remove_existing

And about lint, in tasks/existing.yml, add spaces before/after brackets for src: "{{ item['path'] }}" and dest: "{{ item['path'] }}.bk".

While reading this task, I also notice that removing tack does not have conditional about netplan_remove_existing, so maybe useful to add it:

- name: Removing Existing Configurations
  file:
    path: "{{ item['path'] }}"
    state: absent
  become: true
  with_items: "{{ _netplan_configs['files'] }}"
  when:
    - netplan_remove_existing
    - item['path'] != netplan_config_file
    - netplan_configuration != []

michel-thomas avatar Feb 01 '24 12:02 michel-thomas

@michel-thomas PR’s are welcome and very much appreciated

mrlesmithjr avatar Feb 03 '24 05:02 mrlesmithjr

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 13 '24 21:04 stale[bot]

I forget this issue. I try to contribute soon!

michel-thomas avatar Apr 15 '24 06:04 michel-thomas

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 15 '24 02:06 stale[bot]