env-ansible/facts/general/package.yml
Hyperling 89961ad08f
Fix update for Flatpak. (#8)
* Change to 2 spaced indent.

* Change flatpak to never "fail" so that update can be run on servers as well.

* Change indent to 2 spaces.

* Be fancier than an always-true.
2021-08-14 12:43:42 -05:00

95 lines
2.7 KiB
YAML

---
# Define program names for package builtin.
# This file is for ALL systems and should not include UI components.
- name: General | Facts | Packages | Parrot OS Fixes
set_fact:
ansible_pkg_mgr: "apt"
ansible_python_interpreter: "/usr/bin/python3"
when: ansible_distribution == "Parrot OS"
- name: General | Facts | Package | apt
set_fact:
sshfs: sshfs
locate: locate
opensshd: openssh-server
when: ansible_pkg_mgr == "apt"
- name: General | Facts | Package | pacman
set_fact:
sshfs: sshfs
locate: mlocate
opensshd: openssh
when: ansible_pkg_mgr == "pacman"
- name: General | Facts | Package | FreeBSD
set_fact:
sshfs: fusefs-sshfs
locate: htop # Placeholder to prevent errors, locate built into FreeBSD.
opensshd: htop # sshd comes installed on FreeBSD
ansible_python_interpreter: "/usr/local/bin/python3.8"
when: ansible_system == "FreeBSD"
- name: General | Facts | Package | Update Commands | Helpers
set_fact:
update_accept_var: '$accept'
- name: General | Facts | Package | Update Commands | apt
set_fact:
update_package_manager: |
echo "*** Apt ***" &&
sudo apt update &&
sudo apt autoremove {{ update_accept_var }} &&
sudo apt dist-upgrade {{ update_accept_var }} &&
when: ansible_pkg_mgr == "apt"
- name: General | Facts | Package | Update Commands | pacman
set_fact:
update_package_manager: |
echo "*** Pacman ***" &&
sudo pacman -Syyu &&
when: ansible_pkg_mgr == "pacman"
- name: General | Facts | Package | Update Commands | pkg
set_fact:
update_package_manager: |
echo "*** Pkg ***" &&
sudo pkg update &&
sudo pkg upgrade &&
when: ansible_pkg_mgr == "pkg"
- name: General | Facts | Package | Update Commands | parrot-upgrade
set_fact:
update_package_manager: |
parrot_mirrors_suck=true
echo "*** Parrot ***"
while [[ $parrot_mirrors_suck ]]; do
unset parrot_mirrors_suck
sudo parrot-upgrade
if [[ $? != 0 ]]; then
parrot_mirrors_suck=true
sudo apt update --fix-missing
fi
done &&
when: ansible_distribution == "Parrot OS"
- name: General | Facts | Package | Update Commands | flatpak | check
shell: which flatpak
register: flatpak_exec
ignore_errors: yes
- name: General | Facts | Package | Update Commands | flatpak | exists
set_fact:
update_flatpak: |
echo "*** Flatpak ***" &&
flatpak update {{ update_accept_var }} &&
when: flatpak_exec is defined and flatpak_exec.failed is defined and not flatpak_exec.failed
- name: General | Facts | Package | Update Commands | flatpak | not exists
set_fact:
update_flatpak: |
echo "*** Flatpak Not Installed ***" &&
when: update_flatpak is not defined