Skip to content

Commit

Permalink
More cleanup for RHEL 6 -> 7 using leapp_upgrade_type custom.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffmcutter committed Mar 17, 2024
1 parent 047c961 commit bfb6526
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
34 changes: 20 additions & 14 deletions roles/upgrade/tasks/disable-previous-repo-files.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
---
- name: disable-previous-repo-files | Backup repo files
ansible.builtin.copy:
remote_src: true
src: "/etc/yum.repos.d/{{ item }}"
dest: "/etc/yum.repos.d/{{ item }}.{{ ansible_date_time.iso8601_basic_short }}"
owner: root
group: root
mode: "0644"
loop: "{{ __repo_files }}"
- name: disable-previous-repo-files | Stat repo file
ansible.builtin.stat:
path: /etc/yum.repos.d/{{ item }}
register: __repo_file_stat

- name: disable-previous-repo-files | Remove repo files
ansible.builtin.file:
path: "/etc/yum.repos.d/{{ item }}"
state: absent
loop: "{{ __repo_files }}"
- name: disable-previous-repo-files | Block to backup and remove repo file if found
when: __repo_file_stat.stat.exists
block:
- name: disable-previous-repo-files | Backup repo files
ansible.builtin.copy:
remote_src: true
src: /etc/yum.repos.d/{{ item }}
dest: /etc/yum.repos.d/{{ item }}.{{ ansible_date_time.iso8601_basic_short }}
owner: root
group: root
mode: "0644"

- name: disable-previous-repo-files | Remove repo files
ansible.builtin.file:
path: /etc/yum.repos.d/{{ item }}
state: absent

...
4 changes: 2 additions & 2 deletions roles/upgrade/tasks/leapp-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@

- name: leapp-upgrade | Include disable-previous-repo-files.yml
ansible.builtin.include_tasks: disable-previous-repo-files.yml
vars:
__repo_files: "{{ repo_files_to_remove_at_upgrade }}"
loop:
"{{ repo_files_to_remove_at_upgrade }}"
when: leapp_upgrade_type == "custom"

- name: leapp-upgrade | Start Leapp OS upgrade
Expand Down
8 changes: 3 additions & 5 deletions roles/upgrade/tasks/redhat-upgrade-tool-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@
# So upgrade-and-reboot.yml can succed.

Check failure on line 48 in roles/upgrade/tasks/redhat-upgrade-tool-upgrade.yml

View workflow job for this annotation

GitHub Actions / Check for spelling errors

succed ==> succeed
- name: redhat-upgrade-tool-upgrade | Disable redhat-upgrade-cmdline-instrepo.repo
ansible.builtin.include_tasks: disable-previous-repo-files.yml
vars:
__repo_files:
- redhat-upgrade-cmdline-instrepo.repo
loop:
- redhat-upgrade-cmdline-instrepo.repo
when: leapp_upgrade_type == "custom"

- name: redhat-upgrade-tool-upgrade | Include update-and-reboot.yml
Expand All @@ -64,8 +63,7 @@

- name: redhat-upgrade-tool-upgrade | Include disable-previous-repo-files.yml
ansible.builtin.include_tasks: disable-previous-repo-files.yml
vars:
__repo_files: "{{ repo_files_to_remove_at_upgrade }}"
loop: "{{ repo_files_to_remove_at_upgrade }}"
when: leapp_upgrade_type == "custom"

- name: Install RPM Key for RHEL 7 ISO Repository

Check failure on line 69 in roles/upgrade/tasks/redhat-upgrade-tool-upgrade.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

name[prefix]

Task name should start with 'redhat-upgrade-tool-upgrade | '.
Expand Down

0 comments on commit bfb6526

Please sign in to comment.