Add support for Fedora to various roles

This commit is contained in:
Kenneth Benzie 2023-05-30 19:48:16 -04:00
parent 8ef426139b
commit b560f9c7d9
25 changed files with 285 additions and 28 deletions

4
playbooks/1password.yaml Normal file
View File

@ -0,0 +1,4 @@
---
- hosts: localhost
roles:
- 1password

View File

@ -0,0 +1,22 @@
---
- name: add yum repository key
become: true
rpm_key:
key: https://downloads.1password.com/linux/keys/1password.asc
- name: add yum repository
become: true
yum_repository:
name: 1password
description: 1Password Stable Channel
baseurl: https://downloads.1password.com/linux/rpm/stable/$basearch
enabled: true
gpgcheck: true
repo_gpgcheck: true
gpgkey: ['https://downloads.1password.com/linux/keys/1password.asc']
- name: install yum package
become: true
yum:
name: 1password
state: latest

View File

@ -0,0 +1,6 @@
---
- name: install yum package
become: true
yum:
name: the_silver_searcher
state: latest

View File

@ -4,7 +4,6 @@
ansible_distribution == "Ubuntu" and ansible_distribution == "Ubuntu" and
ansible_distribution_version == "18.04" ansible_distribution_version == "18.04"
}}' }}'
- debug: msg={{use_github}}
- when: use_github - when: use_github
include_tasks: deb.yaml include_tasks: deb.yaml

View File

@ -0,0 +1,6 @@
---
- name: install yum package
become: true
yum:
name: bat
state: latest

View File

@ -0,0 +1,6 @@
---
- name: install yum package
become: true
yum:
name: curl
state: latest

View File

@ -0,0 +1,6 @@
---
- name: install yum package
become: true
yum:
name: fzf
state: latest

View File

@ -0,0 +1,12 @@
---
- name: add yum repository
become: true
get_url:
url: https://cli.github.com/packages/rpm/gh-cli.repo
dest: /etc/yum.repos.d/gh-cli.repo
- name: install dnf package
become: true
dnf:
name: gh
state: latest

View File

@ -0,0 +1,6 @@
---
- name: install dnf package
become: true
dnf:
name: htop
state: latest

View File

@ -0,0 +1,51 @@
---
- name: stat executable
stat:
path: '{{ansible_env.HOME}}/.local/bin/jp'
register: jp_stat
- name: get installed version
when: jp_stat.stat.exists
command: jp --version
changed_when: false
register: jp_version
- name: extract installed version
when: jp_stat.stat.exists
set_fact:
jp_installed_version:
'{{jp_version.stdout.strip() | regex_replace("^.*(\d+\.\d+\.\d+).*$", "\1")}}'
- name: get latest release
uri:
url: 'https://api.github.com/repos/jmespath/jp/releases/latest'
register: latest
- name: determine if jp needs installed
set_fact:
jp_needs_installed:
'{{not jp_stat.stat.exists or jp_installed_version != latest.json.tag_name}}'
arch_dict: {x86_64: amd64, arm64: arm64}
- name: select asset name
when: jp_needs_installed
set_fact:
asset_query:
'[?contains(name, `jp-linux-{{arch_dict[ansible_architecture]}}`)] | [0]'
- name: select asset
when: jp_needs_installed
set_fact:
asset: '{{latest.json.assets | to_json | from_json | json_query(asset_query)}}'
- name: create directory
when: jp_needs_installed
file:
path: '{{ansible_env.HOME}}/.local/bin'
state: directory
- name: install executable
when: jp_needs_installed
get_url:
url: '{{asset.browser_download_url}}'
dest: '{{ansible_env.HOME}}/.local/bin/jp'
mode: '0755'

View File

@ -0,0 +1,6 @@
---
- name: install dnf package
become: true
dnf:
name: jq
state: latest

View File

@ -0,0 +1,10 @@
---
- name: install dnf packages
become: true
dnf:
name:
- clang
- clang-tools-extra
- git-clang-format
- llvm
state: latest

View File

@ -0,0 +1,8 @@
---
- name: install yum package
become: true
yum:
name: neovim
state: latest
- include_tasks: Unix.yaml

View File

@ -0,0 +1,6 @@
---
- name: install yum package
become: true
yum:
name: nodejs
state: latest

View File

@ -8,3 +8,4 @@
- python3-pip - python3-pip
- python3-venv - python3-venv
- python3-virtualenv - python3-virtualenv
state: latest

View File

@ -0,0 +1,9 @@
---
- name: install yum packages
become: true
yum:
name:
- python3
- python3-pip
- python3-virtualenv
state: latest

View File

@ -0,0 +1,3 @@
---
sudo_owner: root
sudo_group: wheel

View File

@ -3,34 +3,10 @@
become: true become: true
apt: apt:
name: name:
- acpi
- gawk - gawk
- lm-sensors
- sysstat - sysstat
state: latest state: latest
- name: create systemd user unit directory - include_tasks: Linux.yaml
file:
state: directory
dest: ~/.config/systemd/user
- set_fact:
SYSTEM_INFO_SCRIPT_DIR: '{{ansible_env.HOME}}/.config/tmux/system-info'
- when: '"WSL" not in ansible_kernel'
set_fact:
SYSTEM_INFO_SCRIPT: '{{SYSTEM_INFO_SCRIPT_DIR}}/system-info-Linux.sh'
- when: '"WSL" in ansible_kernel'
set_fact:
SYSTEM_INFO_SCRIPT: '{{SYSTEM_INFO_SCRIPT_DIR}}/system-info-WSL.sh'
- name: install system-info systemd unit
template:
src: templates/system-info.service.j2
dest: ~/.config/systemd/user/system-info.service
notify: restart system-info
- name: enable system-info service
systemd:
name: system-info
scope: user
enabled: true
state: started

View File

@ -0,0 +1,28 @@
---
- name: create systemd user unit directory
file:
state: directory
dest: ~/.config/systemd/user
- set_fact:
SYSTEM_INFO_SCRIPT_DIR: '{{ansible_env.HOME}}/.config/tmux/system-info'
- when: '"WSL" not in ansible_kernel'
set_fact:
SYSTEM_INFO_SCRIPT: '{{SYSTEM_INFO_SCRIPT_DIR}}/system-info-Linux.sh'
- when: '"WSL" in ansible_kernel'
set_fact:
SYSTEM_INFO_SCRIPT: '{{SYSTEM_INFO_SCRIPT_DIR}}/system-info-WSL.sh'
- name: install system-info systemd unit
template:
src: templates/system-info.service.j2
dest: ~/.config/systemd/user/system-info.service
notify: restart system-info
- name: enable system-info service
systemd:
name: system-info
scope: user
enabled: true
state: started

View File

@ -0,0 +1,11 @@
---
- name: install dnf packages
become: true
dnf:
name:
- acpi
- lm_sensors
- sysstat
state: latest
- include_tasks: Linux.yaml

View File

@ -0,0 +1,6 @@
---
- name: install dnf package
become: true
dnf:
name: tidy
state: latest

View File

@ -0,0 +1,10 @@
---
- name: install yum packages
become: true
yum:
name:
- tmux
- sysstat
- urlview
- xsel
state: latest

View File

@ -0,0 +1,6 @@
---
- name: install dnf package
become: true
dnf:
name: tree
state: latest

View File

@ -0,0 +1,51 @@
---
- name: stat executable
stat:
path: '{{ansible_env.HOME}}/.local/bin/yq'
register: yq_stat
- name: get installed version
when: yq_stat.stat.exists
command: yq --version
changed_when: false
register: yq_version
- name: extract installed version
when: yq_stat.stat.exists
set_fact:
yq_installed_version:
'{{yq_version.stdout.strip() | regex_replace("^.*(\d+\.\d+\.\d+).*$", "\1")}}'
- name: get latest release
uri:
url: 'https://api.github.com/repos/mikefarah/yq/releases/latest'
register: latest
- name: determine if yq needs installed
set_fact:
yq_needs_installed:
'{{not yq_stat.stat.exists or yq_installed_version != latest.json.tag_name}}'
arch_dict: {x86_64: amd64, arm64: arm64}
- name: select asset name
when: yq_needs_installed
set_fact:
asset_query:
'[?contains(name, `yq_linux_{{arch_dict[ansible_architecture]}}`)] | [0]'
- name: select asset
when: yq_needs_installed
set_fact:
asset: '{{latest.json.assets | to_json | from_json | json_query(asset_query)}}'
- name: create directory
when: yq_needs_installed
file:
path: '{{ansible_env.HOME}}/.local/bin'
state: directory
- name: install executable
when: yq_needs_installed
get_url:
url: '{{asset.browser_download_url}}'
dest: '{{ansible_env.HOME}}/.local/bin/yq'
mode: '0755'

View File

@ -0,0 +1,8 @@
---
- name: install yum packages
become: true
yum:
name:
- zsh
- pinentry-tty
state: latest