diff --git a/tasks/general/software/packages.yml b/tasks/general/software/packages.yml index 89b8f47..feaa8b7 100644 --- a/tasks/general/software/packages.yml +++ b/tasks/general/software/packages.yml @@ -1,31 +1,76 @@ --- # Cross-platform package management. -- name: General | Software | Packages | Fix Parrot OS (zypper) -# They have zypper higher in the path, but it's really apt renamed. -# Probably for "security", but package module does not use the ansible_pkg_mgr variable -# so resetting the value to apt doesn't work. Just going to move it. - ansible.builtin.shell: "mv `which zypper` `which zypper`.zz.`date +%Y%m%d`" - register: parrotos_zypper_removed - ignore_errors: true +- name: General | Software | Packages | Fix Parrot OS + block: + + - name: General | Software | Packages | Fix Parrot OS | zypper + # They have zypper higher in the path, but it's really apt renamed. + # Probably for "security", but package module does not use the ansible_pkg_mgr variable + # so resetting the value to apt doesn't work. Just going to move it. + ansible.builtin.shell: "mv `which zypper` `which zypper`.zz.`date +%Y%m%d`" + register: parrotos_zypper_removed + changed_when: parrotos_zypper_removed.rc == 0 + ignore_errors: true + + - name: General | Software | Packages | Fix Parrot OS | zypper | Exit Incoming + ansible.builtin.debug: + msg: "A silly zypper file was renamed successfully. Please try running Ansible again." + when: parrotos_zypper_removed is defined and not parrotos_zypper_removed.failed + + - name: General | Software | Packages | Fix Parrot OS | zypper | Exiting + ansible.builtin.shell: exit 1 + register: shell_check + changed_when: shell_check.rc == 0 + when: parrotos_zypper_removed is defined and not parrotos_zypper_removed.failed + + # More Parrot OS junk. They have a command called update in /usr/bin. Doesn't + # have sudo or anything in it. Hide it in preference for .bashrc update function. + - name: General | Software | Packages | Fix Parrot OS | update + ansible.builtin.shell: "mv `which update` `which update`.zz.`date +%Y%m%d`" + register: shell_check + changed_when: shell_check.rc == 0 + ignore_errors: true + when: ansible_distribution == "Parrot OS" -- name: General | Software | Packages | Fix Parrot OS (zypper), Exit Incoming - ansible.builtin.debug: - msg: "A silly zypper file was renamed successfully. Please try running Ansible again." - when: ansible_distribution == "Parrot OS" and parrotos_zypper_removed is defined and not parrotos_zypper_removed.failed +- name: General | Software | Packages | pacman + block: -- name: General | Software | Packages | Fix Parrot OS (zypper), Exiting - ansible.builtin.shell: exit 1 - when: ansible_distribution == "Parrot OS" and parrotos_zypper_removed is defined and not parrotos_zypper_removed.failed + - name: General | Software | Packages | pacman | pacman.conf + ansible.builtin.lineinfile: + path: "/etc/pacman.conf" + regexp: '{{ item.key }}' + line: '{{ item.value }} # MANAGED BY ANSIBLE' + state: present + create: true + backup: true + mode: "0644" + loop: + - { "key": '^[\#]?ParallelDownloads', "value": 'ParallelDownloads 3'} -# More Parrot OS junk. They have a command called update in /usr/bin. Doesn't -# have sudo or anything in it. Hide it in preference for .bashrc update function. -- name: General | Software | Packages | Fix Parrot OS 2 (update) - ansible.builtin.shell: "mv `which update` `which update`.zz.`date +%Y%m%d`" - ignore_errors: true - when: ansible_distribution == "Parrot OS" + # TBD / TODO: Do the mirrorlist files and distros based on facts in case ever using Arch, Manjaro, etc. + # Same with the blocklist for sites like Berkeley which rate limit VPNs. + - name: General | Software | Packages | pacman | Artix + block: + - name: General | Software | Packages | pacman | Artix | rate-mirrors | Install + ansible.builtin.package: + name: + - rate-mirrors + state: present + + - name: General | Software | Packages | pacman | Artix | rate-mirrors | Update Lists + ansible.builtin.shell: "{{ item }}" + register: shell_check + changed_when: shell_check.rc == 0 + loop: + - "rate-mirrors artix | grep -v berkeley | sudo tee /etc/pacman.d/mirrorlist" + - "rate-mirrors arch | grep -v berkeley | sudo tee /etc/pacman.d/mirrorlist-arch" + + when: ansible_service_mgr == "runit" + + when: ansible_pkg_mgr == "pacman" - name: General | Software | Packages | Cache Refresh (Apt and Pacman) ansible.builtin.package: @@ -35,6 +80,8 @@ - name: General | Software | Packages | Cache Refresh (FreeBSD) ansible.builtin.shell: pkg update + register: shell_check + changed_when: shell_check.rc == 0 when: ansible_system == "FreeBSD" - name: General | Software | Packages | Install Software