Skip to content
/ hop Public

Some Ansible roles and playbooks to help me distro-hop 😜

License

Notifications You must be signed in to change notification settings

ggabriel96/hop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hop

Some Ansible roles and playbooks to help me distro-hop 😜

This has been tested only manually and on Fedora 34. So feel free to use it, but at your own risk. Always review code you find online before running it.

Quickstart

  1. Install Ansible and, optionally, Ansible Runner:

    pip install ansible ansible-runner
  2. Install needed Ansible collections:

    ansible-galaxy collection install ansible.posix community.crypto community.general
  3. Clone this repository. I will refer to the destination directory of the cloned repo as ${HOP_DIR}. You can set this variable for your current shell so you can directly copy and paste the commands provided here:

    export HOP_DIR=<the actual directory here>  # bash
    set -gx HOP_DIR <the actual directory here>  # fish
  4. Setup your playbook inside ${HOP_DIR}/project/. The playbook I use is project/fedora.yml, so I will use it in the command examples. Replace it with your own if not editing it directly. The Roles and variables section below describes the available roles and its variables.

  5. Run with either ansible-playbook (it comes with Ansible) or ansible-runner. Prefer ansible-runner when running the playbook multiple times, e.g. when experimenting, since it will automatically fill in your sudo password.

    • With ansible-playbook:

      ansible-playbook -K ${HOP_DIR}/project/fedora.yml
    • With ansible-runner:

      1. Tell your sudo password. Fill it in ${HOP_DIR}/env/passwords (replacing your sudo password; you can undo the changes when done).

      2. Run:

        ansible-runner run -p fedora.yml ${HOP_DIR}

Roles and variables

Roles are what provide the automation of tasks. The majority of them have variables which allow the customization of what they do. They are specified in two files inside every role directory (project/roles/<role>/):

  • defaults/main.yml (this is the main one)
  • vars/main.yml

Below is a list of the available roles and their important variables. Refer to project/fedora.yml for usage examples.

conda

Install miniconda using the official Linux installer.

Variables:

  • install_dir: installation directory. Defaults to ~/miniconda3/
debian

Install packages using apt.

Variables:

  • cleanup: whether to run autoclean and autoremove at the end. Defaults to yes
  • system_packages: list of packages to install. Defaults to [] (nothing)
  • update_all: whether to upgrade every installed package as first step. Defaults to yes
elementary os

Just delegates to the debian role. Refer to its description.

files

Download remote files or create links to local files.

Variables:

  • download: list of mappings describing files that should be downloaded. The available keys are url and dest. Defaults to [] (nothing)
  • link: list of mappings describing links that should be created. The available keys are src and dest. Defaults to [] (nothing)

In any case, the role will perform a backup of dest before replacing it. The backup will be placed at <dest>.backup-<datetime>, where <datetime> is a simplified version of the current date and time in ISO 8601 format. Note that the backup will end up beside dest if it's a file or inside it if it's a directory. Also, backups of already backed up directories will contain the older backups.

flatpak

Configure Flatpak and install packages.

Variables:

  • add_flathub: whether to add Flathub repository. Defaults to yes
  • packages: list of packages to install. Defaults to [] (nothing)
flutter

Install Flutter via snap.

Has no variables.

fonts

Shortcut to install some fonts I like (Fira Code, Google's Noto, and JetBrains Mono).

Variables:

  • fonts_target_dir: fonts installation directory. Defaults to ~/.local/share/fonts/
  • jetbrains_mono_version: version of the JetBrains Mono font to install. Defaults to 2.225. Choose a tag from the releases page
google-cloud-sdk

Install Google Cloud SDK using the official Linux installer. It's also possible to install it via the snap role.

Variables:

  • cloudsdk_install_dir: installation base directory. Defaults to ~/ (installer will create a dedicated directory in here)
install

Generic role to install system packages that share the name in Debian-based and RedHat-based distros.

Variables:

  • system: list of packages to install. Defaults to [] (nothing)
redhat

Install packages using dnf.

Variables:

  • cleanup: whether to run and autoremove at the end. Defaults to yes
  • system_packages: list of packages to install. Defaults to [] (nothing)
  • update_all: whether to upgrade every installed package as first step. Defaults to yes
rust

Install Rust using the official Linux installer.

Has no variables. Currently, accepts the default settings from the install script and does not modify PATH.

snap

Configure Snap and install packages.

Variables:

  • channel: channel to use to install the packages. Defaults to stable
  • classic_packages: list of packages requiring classic confinement to install. Defaults to [] (nothing)
  • packages: list of packages to install. Defaults to [] (nothing)
sysctl

Configure sysctl entries.

Variables:

  • sysctl_entries: mapping of entries and its values to set. Defaults to {} (nothing)
  • sysctl_reload: whether to reload sysctl after each entry. Defaults to yes
user

General user-related settings.

Variables:

  • git_user_email: email to globally set to git's user.email. Has no defaults and skips it if not provided
  • git_user_name: name to globally set to git's user.name. Has no defaults and skips it if not provided
  • ssh_keys: list of names of SSH keys to create, relative to ssh_keys_dir. Defaults to [] (nothing)
  • ssh_keys_comment: comment to add to every created key. Defaults to the value of the git_user_email variable or no comment if that's not provided
  • ssh_keys_dir: directory in which to create the keys. Defaults to ~/.ssh
  • ssh_keys_type: type of keys to create. Defaults to ed25519
  • user_login_shell: name of login shell to set for current user (separately installed). Defaults to bash
zoom

Download the official Zoom client and install it.

Has no variables.

About

Some Ansible roles and playbooks to help me distro-hop 😜

Topics

Resources

License

Stars

Watchers

Forks