Broke tasks out into roles rather than leaving them all in common

This commit is contained in:
Elia Farin
2024-10-30 13:45:57 -05:00
parent ead61b9fdc
commit 5f6cc4ae7b
10 changed files with 116 additions and 44 deletions

View File

@@ -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

View File

@@ -1,7 +1,11 @@
---
- name: Common program installation
hosts: localhost
remote_user: elia
hosts: all
become: yes
roles:
- common
- rpmfusion
- dnf
- codecs
- flatpak

29
group_vars/all Normal file
View File

@@ -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" }

2
hosts Normal file
View File

@@ -0,0 +1,2 @@
[all]
localhost

View File

@@ -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

View File

@@ -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

11
roles/dnf/tasks/main.yml Normal file
View File

@@ -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 }}"

View File

@@ -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 }}"

View File

@@ -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

5
setup.sh Normal file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env sh
echo "Installing ansible, please authenticate with sudo"
sudo dnf install -y ansible