From 904dda68839f2f79cc72ba33078f7e1c3493a1b0 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Sat, 18 Feb 2023 09:29:36 -0600 Subject: [PATCH] Add support for openSUSE (#35) * Add openSUSE for initial testing. * Add package names for openSUSE Zypper. * Add commands for Zypper. Do apt clean after autoremove. * Add cronie to openSUSE. * Remove warn parameter for newer version of Ansible. * Commenting warn worked, removing it completely. * Add libvulkan1 since it's a dependency for GNOME. * Fix order of lynis and nmap. Thought I had already done this before? * Start adding package names for openSUSE. * Create the sshd_config file if it is not already present. * Fix OS in conditional. * Save the command for checking ansible variables. * Use openSUSE family since Tumbleweed and Leap are considered different distros. * Get rid of 2nd flathub repo, no longer use the dl. version.. * Add status update for openSUSE. * Reword sentence. * Add Brave Browser to openSUSE. * Script is running successfully now when Workstation is enabled. * Add status of openSUSE Leap. * Add space. * No longer use install-new-recommends. --- README.md | 13 +++++++++ facts/general/package.yml | 28 ++++++++++++++++++- facts/workstation/package.yml | 9 ++++++ local.yml | 3 +- setup.sh | 4 +++ tasks/general/software/packages.yml | 14 ++++++++-- tasks/general/software/services.yml | 4 +-- tasks/general/software/telegraf.yml | 1 - tasks/workstation/linux/software/brave.yml | 10 +++++++ tasks/workstation/linux/software/flatpaks.yml | 7 ----- 10 files changed, 78 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index e63c216..01b1eca 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,15 @@ This setup is specific to the maintainer's devices and needs. You're welcome to Workstation: 100% Server: 100% +## Suse Family +### openSUSE Tumbleweed v2022-02-17 +Generic: 100% +Workstation: 100% + +### openSUSE Leap 15.4 +Generic: 100% +Workstation: Currently failing at `[Workstation | Linux | Flatpak Distro | Package Manager | Install From Repo]` with message `Problem: nothing provides libedataserver-1.2.so.24 needed by the to be installed evolution-data-server-32bit-3.34.4-3.3.1.x86_64`. + ## Currently Supported Unix Systems ### FreeBSD 12, 13 100%, although GUI is not working completely on 13 yet (dash-to-dock doesn't compile). @@ -46,3 +55,7 @@ Specifically for the Pinephone. Eventually some of the scripts and install files will be put into the files folder. This will allow initializing systems outside of the maintainer's home network. There may also be a refactor of task-specific facts to be in their task file so that some playbooks can be more self-sufficient and be provided to the community without hacking. The original goal was to never define facts in tasks, but the benefit has yet to be seen for some tasks. Shared facts will definitely continue to exist under the facts tree. + +## Other Notes +### Get Setup Values +Use this command to see the variables for a system: `ansible localhost -m setup --connection=local`. \ No newline at end of file diff --git a/facts/general/package.yml b/facts/general/package.yml index 4a34aab..55cd207 100644 --- a/facts/general/package.yml +++ b/facts/general/package.yml @@ -52,6 +52,16 @@ cron: cronie when: ansible_pkg_mgr == "dnf" +- name: General | Facts | Package | zypper + set_fact: + sshfs: sshfs + locate: mlocate + opensshd: openssh + tar: tar + microcode_amd: ucode-amd + microcode_intel: ucode-intel + when: ansible_pkg_mgr == "zypper" + - name: General | Facts | Package | Update Commands | Helpers set_fact: @@ -67,8 +77,8 @@ update_package_manager: | echo "*** Apt ***" && sudo apt update && - sudo apt clean {{ update_accept_var }} && sudo apt autoremove {{ update_accept_var }} && + sudo apt clean {{ update_accept_var }} && sudo dpkg --configure -a && sudo apt --fix-broken --fix-missing install && sudo apt dist-upgrade --allow-downgrades --fix-broken --fix-missing {{ update_accept_var }} && @@ -132,6 +142,22 @@ sudo dnf upgrade {{ update_accept_var }} && when: ansible_pkg_mgr in ("dnf") +- name: General | Facts | Package | Update Commands | zypper + set_fact: + update_package_manager: | + echo "*** Zypper ***" && + sudo zypper refresh && + sudo zypper cleanlocks && + sudo zypper purge-kernels && + sudo zypper clean -a && + sudo zypper patch {{ update_accept_var }} && + sudo zypper update {{ update_accept_var }} && + sudo zypper dist-upgrade {{ update_accept_var }} && + # This is a neat feature, but is installing things like GIMP from the + # repos when it is already installed through Flatpak, so not needed. + #sudo zypper install-new-recommends && + when: ansible_pkg_mgr in ("zypper") + - name: General | Facts | Package | Update Commands | flatpak | check shell: which flatpak diff --git a/facts/workstation/package.yml b/facts/workstation/package.yml index 4a98cd0..37ef39f 100644 --- a/facts/workstation/package.yml +++ b/facts/workstation/package.yml @@ -89,3 +89,12 @@ font_awesome: python3-XStatic-Font-Awesome nfs: nfs-utils when: ansible_distribution == "Fedora" + + +- name: Workstation | Facts | Package | openSUSE + set_fact: + flatpak_distro: true + firefox_esr: firefox-esr-branding-openSUSE + font_awesome: fontawesome-fonts + nfs: utils-libnfs + when: ansible_os_family == "Suse" diff --git a/local.yml b/local.yml index ba682f9..1a64787 100644 --- a/local.yml +++ b/local.yml @@ -69,7 +69,7 @@ when: ansible_system == "Linux" and flatpak_distro - include: tasks/workstation/linux/software/brave.yml - when: ansible_pkg_mgr in ("apt", "dnf") and not mobile + when: ansible_pkg_mgr in ("apt", "dnf", "zypper") and not mobile - include: tasks/workstation/freebsd/software/packages.yml when: ansible_system == "FreeBSD" @@ -184,4 +184,3 @@ - include: tasks/general/tests/lynis.yml - include: tasks/general/tests/nmap.yml - diff --git a/setup.sh b/setup.sh index b4fc244..f1ecac1 100755 --- a/setup.sh +++ b/setup.sh @@ -85,6 +85,10 @@ if [[ `which ansible > /dev/null; echo $?` != 0 ]]; then sudo dnf install -y ansible git python3-libselinux sudo mkdir -p /etc/ansible sudo sh -c 'echo "localhost ansible_connection=local" > /etc/ansible/hosts' + elif [[ $os == *openSUSE* ]]; then + sudo zypper install -y ansible git + sudo mkdir -p /etc/ansible + sudo sh -c 'echo "localhost ansible_connection=local" > /etc/ansible/hosts' else echo -e "ERROR: OS not detected." echo -e "$os" diff --git a/tasks/general/software/packages.yml b/tasks/general/software/packages.yml index 93c670f..169b59d 100644 --- a/tasks/general/software/packages.yml +++ b/tasks/general/software/packages.yml @@ -72,11 +72,11 @@ when: ansible_distribution == "Ubuntu" ignore_errors: yes -- name: General | Software | Services | Install CROND (Looking at you, Fedora) +- name: General | Software | Services | Install CROND (Looking at you, Fedora+Mobian+openSUSE) package: name: "{{ cron }}" state: present - when: ansible_pkg_mgr == "dnf" or ansible_distribution == "Mobian" + when: ansible_pkg_mgr in ("dnf", "zypper") or ansible_distribution == "Mobian" - name: General | Software | Services | Install killall (Looking at you, Debian) package: @@ -93,6 +93,16 @@ state: present when: ansible_distribution == "Archlinux" +# openSUSE Tumbleweed comes without gnome-control-center being able to open +# properly. Hopefully just a one-time accident but I wanted bleeding edge so I +# guess I got it! Luckily was easy to figure out based on CLI error launching. +- name: General | Software | Services | Install Fix (Looking at you, openSUSE) + package: + name: + - libvulkan1 + state: present + when: ansible_pkg_mgr in ("zypper") + - name: General | Software | Packages | Update Software (Disabled) package: name: diff --git a/tasks/general/software/services.yml b/tasks/general/software/services.yml index 84e9f3e..c8ff0d1 100644 --- a/tasks/general/software/services.yml +++ b/tasks/general/software/services.yml @@ -36,7 +36,7 @@ regexp: '{{ item.key }}' line: '{{ item.value }} # MANAGED BY ANSIBLE' state: present - create: no + create: yes backup: yes loop: - { "key": '^[\#]?AllowUsers', "value": 'AllowUsers {{ user }}'} @@ -60,7 +60,7 @@ regexp: '{{ item.key }}' line: '{{ item.value }} # MANAGED BY ANSIBLE' state: present - create: no + create: yes backup: yes loop: - { "key": '^[\#]?AllowUsers', "value": 'AllowUsers root {{ user }}'} diff --git a/tasks/general/software/telegraf.yml b/tasks/general/software/telegraf.yml index 04162f5..6888b5c 100644 --- a/tasks/general/software/telegraf.yml +++ b/tasks/general/software/telegraf.yml @@ -48,7 +48,6 @@ shell: "{{ item }}" args: chdir: "{{ ansible_env.HOME }}/Downloads/" - warn: false loop: - mkdir -p {{ telegraf_path }} - mkdir -p {{ telegraf_config_path }} diff --git a/tasks/workstation/linux/software/brave.yml b/tasks/workstation/linux/software/brave.yml index 8d19ae0..62746c9 100644 --- a/tasks/workstation/linux/software/brave.yml +++ b/tasks/workstation/linux/software/brave.yml @@ -15,6 +15,7 @@ state: present when: ansible_pkg_mgr == "dnf" +# https://brave.com/linux/#debian-ubuntu-mint - name: Workstation | Software | Brave | Add Repo [apt] shell: "{{ item }}" loop: @@ -23,6 +24,7 @@ - apt update when: ansible_pkg_mgr == "apt" +# https://brave.com/linux/#fedora-centos-streamrhel - name: Workstation | Software | Brave | Add Repo [dnf] shell: "{{ item }}" loop: @@ -30,6 +32,14 @@ - rpm --import https://brave-browser-rpm-release.s3.brave.com/brave-core.asc when: ansible_pkg_mgr == "dnf" +# https://brave.com/linux/#opensuse +- name: Workstation | Software | Brave | Add Repo [zypper] + shell: "{{ item }}" + loop: + - rpm --import https://brave-browser-rpm-release.s3.brave.com/brave-core.asc + - sudo zypper addrepo https://brave-browser-rpm-release.s3.brave.com/brave-browser.repo + when: ansible_pkg_mgr == "zypper" + - name: Workstation | Software | Brave | Install package: name: diff --git a/tasks/workstation/linux/software/flatpaks.yml b/tasks/workstation/linux/software/flatpaks.yml index f632b0c..fc8a227 100644 --- a/tasks/workstation/linux/software/flatpaks.yml +++ b/tasks/workstation/linux/software/flatpaks.yml @@ -22,13 +22,6 @@ name: flathub state: present method: system - flatpakrepo_url: https://dl.flathub.org/repo/flathub.flatpakrepo - -- name: Workstation | Linux | Flatpak Distro | Flatpak | Add Flathub for System (#2) - flatpak_remote: - name: flathub2 - state: present - method: system flatpakrepo_url: https://flathub.org/repo/flathub.flatpakrepo