Giter VIP home page Giter VIP logo

ansible's Introduction

Brad's Bootstrapping & dotfiles Manager

Overview

Ansible playbooks and roles for bootstrapping macOS and Linux workstations, and managing dotfiles. The playbooks are designed with no assumed prior knowledge of the system, and are meant to be run on a newly installed system. They are tested on the following system types:

  1. macOS systems x86_64, arm64
  2. Linux systems x86_64
    1. Fedora Workstation edition (spins may work but are unsupported)
    2. Fedora Server edition
    3. Ubuntu Desktop LTS (flavors may work but are unsupported)
    4. Ubuntu Server LTS
    5. Linux Mint Debian Edition

Running the Playbooks

  1. On macOS, log in to the App Store prior to running bootstrap, in order to install apps via mas

  2. Create a GitHub fine-grained token with the following account permissions:

    • Git SSH keys: Read and write
    • SSH signing keys: Read and write
  3. Create an inventory repository (see below)

  4. Download and run the install script:

    curl -sO https://dotfiles.franklybrad.com/install
    sh install [-b] [-g git_branch]
      -b  Skip installing Homebrew on Linux (default: install)
      -g  Specify the git branch of this repo to run (default: main)

Important

Do not pipe curl into sh as Ansible won't run in interactive mode and will skip setup prompts.

Upon completion:

  1. Record any secrets (e.g. Vault and SSH key passphrases)
  2. Perform a full reboot
  3. To install Logi Options+ for macOS, run open -a "~/Downloads/logioptionsplus_installer.app"

Setup Workflow

  1. Bootstrapping the OS: the install script installs the necessary packages to check out the repository and run Ansible; this includes Homebrew (excluding ARM systems), Python, and Git. This script requires sudo access on Linux only. Once setup, the script also runs the subsequent Ansible playbooks.

  2. Install Ansible requirements: the install_requirements playbook installs the necessary Ansible collections and roles.

  3. Create localhost inventory: the build_inventory playbook generates a host_vars file (for non-sensitive variables) and a localhost inventory file (for encrypted secrets), based on answers to the playbook prompts.

  4. System bootstrap: runs the site.yml playbook to execute all roles. When run from the install script, a temporary vault file is created and prompts only for the become password.

  5. Export to password manager: the password_manager.yml playbook imports encrypted secrets to a password manager (currently only 1Password is available).

Building Inventory

You should create an inventory repository prior to running the playbooks. Hosts are assigned to groups based on the system type and distribution, giving flexibility to variable precedent. The group names are based on the Ansible facts system and distribution; the all group is also available. See Splitting Out Host and Group Specific Data for more information.

The repository should match this layout:

  • files/: static files
  • group_vars/: configurations based on system type and distribution
  • host_vars/: configurations for specific systems
  • templates/: dynamic files

The host_vars file created by the build_inventory playbook is meant to be committed to the inventory repo. The inventory file assigns the host groups, along with containing vaulted secrets.

Vaulted Secrets

By default, these are the variables that are encrypted and saved to the inventory file:

  1. rsa SSH key passphrase
  2. ed25519 SSH key passphrase
  3. GitHub personal access token

Managing Dotfiles

Tasks that do not require sudo access are tagged with dotfiles. Likewise, tasks that do require sudo access are tagged with become. For convenience, Homebrew tasks are tagged install. This allows playbook runs that don't need a become password. For example:

ansible-playbook -J playbooks/site.yml --tags dotfiles --skip-tags become,install

ansible's People

Contributors

bradleyfrank avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ansible's Issues

Console prompt does not support certain unicode characters

When using a direct console connection (i.e. for servers) some portions of the Starship and Tmux output are garbled and/or difficult to read given the limitation of a basic console session. I should detect these connections (perhaps with tty) and offer an alternative prompt/tmux session.

Package versions in cache are not persisting

When the dotfiles playbook is run that does not include checking/installing all packages currently being installed from Github, the github_package_versions variable gets updated in the cache with only those packages that are being checked. This means the next time Ansible checks if a package needs to be installed, the default will be to install even if it's up-to-date.

The solution is probably to store the values as individual variables instead of in a dictionary.

Automate SSH key signing

A public SSH key is uploaded to GitHub upon creation, the key should also be used for signing.

Move Logi+ installer app after bootstrap

Instead of finding and copying the app manually, add a step to find logioptionsplus_installer.app (which was found in /opt/homebrew/Caskroom/logi-options-plus/1.30.0.7349) and move the program to ~/Downloads.

Add additional zsh completions

Some utilities are missing completions, e.g. vault. They should be added to .zshrc.

  • vault: complete -o nospace -C /usr/local/bin/vault vault
  • stern: source <(stern --completion=zsh)

Package ffmpeg on Linux pulls in vscode

For some reason, code package is pulled in as a dependency for ffmpeg. The "work-around" is to skip installing the VSCode repo when using the cli-only variant (keys off missing XDG_DESKTOP_SESSION environment variable) of a distro.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.