Skip to content

iesen/mac-env-setup

Repository files navigation

Mac Environment Provisioning with Ansible

Introduction

This ansible project is my Mac OSX development environment initializer for my taste.

Most configurations are customized for my needs. But you can change most of the preferences by editing variables.yml for your needs.

Prerequisites

We need some setup before using ansible provisioning tasks.

Required scripts are inside preqs folder.

Here are the requirements for provisioning environment

  • Homebrew setup (brew_install.sh)
  • Python setup via homebrew (python3_install.sh)
  • Ansible setup via pip (ansible_install.sh)

Task Categories

Various tasks are done in the project. These can be categorized following:

  • Installing software
    • Brew packages and casks
  • Configuring development tools
    • java
    • nvm for managing node.js installations
    • Visual Studio Code extensions, keymap, user settings
    • Git user properties, aliases, cred manager
    • Git ssh keys, and remote repo setup (only gitlab supported now)
    • Intellij IDE plugins
  • OSX customizations
    • Menu datetime format
    • Finder status bar, path bar, hidden folders
    • Dock items
    • Keybindings (home, end fixing)
  • Terminal and shell beautification
    • oh-my-zsh installation
    • zsh config customization
    • Pure shell installation
    • Powerline and nerd fonts setup
    • Terminal theme setup

Running the playbook

Before running the playbook first time, you should install any required roles or collections from ansible galaxy, using following command.

% ansible-galaxy install -r requirements.yml

All dependencies will be installed.

If you want to manage ssh keys then you need to create a secure config using ansible-vault

ansible-vault create secret.yml

After setting vault password, you need to provide ssh key config using the following format. (Gitlab api key is necessary) Name of the key should match the configuration provided in variables.yml file.

ssh_key_git_remote:
  id_ed25519:
    remote_name: gitlab
    remote_type: gitlab
    remote_url: https://gitlab.trendyol.com
    remote_expires_at_days: 365
    api_key: gitlab_api_key

After that playbook can be run with the following command

ansible-playbook -i inventory main.yml -K --ask-vault-pass

if not using ssh keys

ansible-playbook -i inventory main.yml -K

Your sudo password may be asked for multiple times. (if you have cask with sudo)

You can also run only some parts of the playbook by specifying tags

ansible-playbook -i inventory main.yml --tags "package_install,vscode"

Customization

You can customize tasks with variables.yml file.

Screenshot of my terminal

Image of my terminal

Future work

  • Playbook for updating packages and software (with version options)

Notes

Installed and available fonts can be viewed via

brew -S nerdfont

Available terminal themes for osx can be selected from the following link: https://github.com/lysyi3m/macos-terminal-themes

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published