From 5f6cc4ae7bbfc5661705e32b041b43fffc00c9eb Mon Sep 17 00:00:00 2001 From: Elia Farin Date: Wed, 30 Oct 2024 13:45:57 -0500 Subject: [PATCH] Broke tasks out into roles rather than leaving them all in common --- README.md | 20 +++++++++++++++- common.yml | 8 +++++-- group_vars/all | 29 +++++++++++++++++++++++ hosts | 2 ++ roles/codecs/tasks/main.yml | 24 +++++++++++++++++++ roles/common/tasks/main.yml | 42 +--------------------------------- roles/dnf/tasks/main.yml | 11 +++++++++ roles/flatpak/tasks/main.yml | 7 ++++++ roles/rpmfusion/tasks/main.yml | 12 ++++++++++ setup.sh | 5 ++++ 10 files changed, 116 insertions(+), 44 deletions(-) create mode 100644 group_vars/all create mode 100644 hosts create mode 100644 roles/codecs/tasks/main.yml create mode 100644 roles/dnf/tasks/main.yml create mode 100644 roles/flatpak/tasks/main.yml create mode 100644 roles/rpmfusion/tasks/main.yml create mode 100644 setup.sh diff --git a/README.md b/README.md index d3666f6..9ac1f7e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,20 @@ # ansible-fedora -Ansible scripts for installing and configuring my system + +To clone repo: + + sudo dnf install -y git + git clone git@github.com:phrequency-navigator/ansible-fedora.git + +To install dependancies: + + cd ansible-fedora + chmod u+x setup.sh + ./setup.sh + +Edit the "all" file in ./ansible-fedora/group_vars to customize the setup + + +Run the playbook + + cd fedora-ansible + ansible-playbook -i hosts --become --ask-become-pass common.yml \ No newline at end of file diff --git a/common.yml b/common.yml index 153cc28..053e0f8 100644 --- a/common.yml +++ b/common.yml @@ -1,7 +1,11 @@ --- - name: Common program installation - hosts: localhost - remote_user: elia + hosts: all become: yes roles: - common + - rpmfusion + - dnf + - codecs + - flatpak + diff --git a/group_vars/all b/group_vars/all new file mode 100644 index 0000000..0ef075c --- /dev/null +++ b/group_vars/all @@ -0,0 +1,29 @@ +release_ver: "41" +core_ver: "fc41" + +username: "" #MY SUDO USER HERE + +dnf_packages: + - rhythmbox + - terminator + - git + - neovim + - ranger + - htop + - screen + - tmux + - flatpak + - util-linux-user + - curl + - zsh + +flatpak_remotes: + - { name: "flathub", url: "https://dl.flathub.org/repo/flathub.flatpakrepo"} + +flatpaks: + - { remote: "flathub", package: "com.discordapp.Discord" } + - { remote: "flathub", package: "com.github.tchx84.Flatseal" } + - { remote: "flathub", package: "com.valvesoftware.Steam" } + - { remote: "flathub", package: "org.mozilla.firefox" } + - { remote: "flathub", package: "io.github.ungoogled_software.ungoogled_chromium" } + - { remote: "flathub", package: "org.videolan.VLC" } \ No newline at end of file diff --git a/hosts b/hosts new file mode 100644 index 0000000..e2ff33d --- /dev/null +++ b/hosts @@ -0,0 +1,2 @@ +[all] +localhost \ No newline at end of file diff --git a/roles/codecs/tasks/main.yml b/roles/codecs/tasks/main.yml new file mode 100644 index 0000000..74964b5 --- /dev/null +++ b/roles/codecs/tasks/main.yml @@ -0,0 +1,24 @@ +- name: DNF Swap ffmpeg + ansible.builtin.command: dnf swap ffmpeg-free ffmpeg --allowerasing + become: yes + become_user: root + become_method: sudo + +- name: install additional codecs + ansible.builtin.command: dnf update @multimedia --setopt="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin + become: yes + become_user: root + become_method: sudo + +- name: DNF Swap mesa-va-drivers + ansible.builtin.command: dnf swap mesa-va-drivers mesa-va-drivers-freeworld + become: yes + become_user: root + become_method: sudo + + +- name: DNF Swap mesa-vdpau-drivers + ansible.builtin.command: dnf swap mesa-vdpau-drivers mesa-vdpau-drivers-freeworld + become: yes + become_user: root + become_method: sudo diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index 1530b11..549bc7c 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -3,44 +3,4 @@ ansible.builtin.dnf: name: "*" state: latest - update_cache: yes - -- name: Install common programs - ansible.builtin.dnf: - name: - - terminator - - git - - neovim - - ranger - - podman - - htop - - ansible - - nmap - - nmap-ncat - - screen - - chromium - - clementine - - john - - hashcat - - flatpak - - util-linux-user - - curl - - zsh - state: present - -- name: Install Steam - ansible.builtin.dnf: - name: steam - state: latest - update_cache: yes - -- name: Add flathub source - community.general.flatpak_remote: - name: flathub - flatpakrepo_url: https://flathub.org/repo/flathub.flatpakrepo - state: present - -- name: Install Flatpaks - community.general.flatpak: - name: com.discordapp.Discord - state: present + update_cache: yes \ No newline at end of file diff --git a/roles/dnf/tasks/main.yml b/roles/dnf/tasks/main.yml new file mode 100644 index 0000000..28f94bd --- /dev/null +++ b/roles/dnf/tasks/main.yml @@ -0,0 +1,11 @@ +- name: Update installed packages + ansible.builtin.dnf: + name: "*" + state: latest + update_cache: yes + +- name: Install Packages + ansible.builtin.dnf: + name: "{{ item }}" + state: present + loop: "{{ dnf_packages }}" \ No newline at end of file diff --git a/roles/flatpak/tasks/main.yml b/roles/flatpak/tasks/main.yml new file mode 100644 index 0000000..21d2f11 --- /dev/null +++ b/roles/flatpak/tasks/main.yml @@ -0,0 +1,7 @@ +- name: install flatpak remotes + community.general.flatpak_remote: + name: "{{ item.name }}" + state: present + method: system + flatpakrepo_url: "{{ item.url }}" + loop: "{{ flatpak_remotes }}" \ No newline at end of file diff --git a/roles/rpmfusion/tasks/main.yml b/roles/rpmfusion/tasks/main.yml new file mode 100644 index 0000000..0a376a9 --- /dev/null +++ b/roles/rpmfusion/tasks/main.yml @@ -0,0 +1,12 @@ +- name: Install RPMFusion + ansible.builtin.dnf: + name: + - https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-{{ release_ver }}.noarch.rpm + - https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-{{ release_ver }}.noarch.rpm + state: present + +- name: DNF Update + ansible.builtin.dnf: + name: "*" + state: latest + update_cache: yes \ No newline at end of file diff --git a/setup.sh b/setup.sh new file mode 100644 index 0000000..d48f5a4 --- /dev/null +++ b/setup.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env sh + + +echo "Installing ansible, please authenticate with sudo" +sudo dnf install -y ansible \ No newline at end of file