GithubHelp home page GithubHelp logo

tgallacher / ansible-macbook-setup Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 65 KB

๐Ÿ๐Ÿ’ป Ansible playbook to configure and manage my Mac dev set up.

License: Other

Shell 12.75% Jinja 87.25%
ansible

ansible-macbook-setup's Introduction

MacBook Ansible Playbook

Ansible playbook to configure and manage my Mac(s). A much overdue attempt to bring consistency between macbooks used for work, home, etc and to self document changes I want to keep -- and can never remember why/what I changed when I find something new.

This is heavily based on and inspired by the fantastic work by Jeff Geerling and his mac-dev-playbook.

Installation

First time run

There is a cyclic dependency here: we use Ansible to automate most of the config and setup, but that requires Python v3+, which we want to install using Homebrew. Therefore, we need a few manual tasks first before we kick on automation wheel. To semi-automate these steps, and maintain a more up to date list, see -- and use -- bootstrap.sh.

The bootstrap.sh file will also run ansible for you!

Running after updates

  1. Run ansible-galaxy install -r requirements.yml;
  2. Run ansible-playbook -K main.yml inside this directory. Enter your account password when prompted.

Note: If some Homebrew commands fail, you might need to agree to Xcode's license or fix some other Homebrew issue. Run brew doctor to see if this is the case.

Running a specific set of tagged tasks

You can filter which part of the provisioning process to run by specifying the set of tags using ansible-playbook's --tags flag. The tags available:

  • tools - Taks relating to installing tooling
  • config - Taks relating to custom configuration of the OS
  • ui - Tasks affecting the OS UI

Example:

$ ansible-playbook main.yml -i inventory -K --tags "config"

Customising

To see what variables exist for cusotmising the install, check the defaults/*.yml files or the docs for the installed ansible roles.

Running this playbook without any changes will bring in my dev setup on your mac; this is almost certainly not what you're after. Instead, override the defaults by supplying any file named config*.yml. For example, you can customize the installed packages and apps with something like:

# Use `homebrew_installed_packages` to override all installed formulae with your own choice
# Use `homebrew_installed_addn_packages` to add additional formulae whilst retaining my default ones
#
# Same variables apply for Casks. See `defaults/homebrew.yml`
homebrew_installed_packages:
  - cowsay
  - git
  - go

My dotfiles are also installed, in addition to an .osx script for configuring OSX to my preference.

Finally, there are a few other preferences and settings added on for various apps and services.

Testing the Playbook

Changes are tested in a fresh install of OSX in a VM (using VirtualBox) before being run on a new Mac. This is based Jeff's approach, although I have curated my own instructions for this process here.

ansible-macbook-setup's People

Contributors

tgallacher avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

ansible-macbook-setup's Issues

Fix vscode extension var name

The defaults/vscode.yml file currently uses the Ansible role variable name, visual_studio_code_extensions, instead of the custom variable name, vscode_install_extensions.

As a result, no extensions are installed when running this.

Enable "Keyboard Navigation"

Need to automatically set "keyboard navigation" (i.e. tabs).

This setting is located under the UI: System Preferences > Keyboard > Shortcuts (tab)> checkbox at bottom

Update keyboard mappings

Switch to "Natural Text" preset in the item profile for being able to quickly set up jumping around by word boundary using the option+arrow keys.

See: https://apple.stackexchange.com/a/293988 for more details of how

NB: Currently this is manually done by trying to automate remapping certain keys in the profile, but it doesn't appear to be transferrable easily across machines.

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.