Skip to content

My own Ansible collection for development setup.

License

Notifications You must be signed in to change notification settings

fedejaure/dev-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Development Setup

GitHub release (latest SemVer) Tests License

pre-commit Contributor Covenant

My own Ansible collection for development setup (use by your own risk).

Features

Mac OS

Applications installed with Mac App Store

Applications installed with Homebrew Cask

Tools/Package installed with Homebrew

Tools installed with pipx

Other installed Tools

Quickstart

Starting from a brand-new Mac

  1. Ensure Apple's command line tools are installed (xcode-select --install to launch the installer).

  2. Download this repository to your local drive.

  3. Install requirements:

    Create a temporary virtualenv, activate the virtualenv and install ansible:

    $ /usr/bin/python3 -m venv .venv
    $ . .venv/bin/activate
    (.venv)$ pip3 install ansible
  4. Install ansible requirements ansible-galaxy install -r requirements.yml.

  5. Copy inventory.example into inventory.

  6. Run ansible-playbook playbooks/main.yml --ask-become-pass -i inventory.

Note: You need to agree to Xcode's license.

$ sudo xcodebuild -license

Configuring a remote Mac

Starting from a configured machine

  1. Clone this repository.

  2. Install dependencies:

    $ poetry install --no-root
    Using python3.10 (3.10.8)
    Creating virtualenv .venv
    Installing dependencies from lock file
    
    Package operations: 97 installs, 0 updates, 0 removals
    
    ...
  3. Activate the virtual environment:

    $ poetry shell
    Using python3.10 (3.10.8)
    Spawning shell within .venv
    (dev-setup)$
  4. Install required Ansible roles:

    (dev-setup)$ inv galaxy-install
  5. Configure the inventory file:

    • Local target:

      Copy inventory.example into inventory.

    • Remote target:

      Configure the inventory file as:

      [macos]
      <ip address or hostname of the target> ansible_user=<target user> ansible_python_interpreter=/usr/bin/python3

      On the target Mac:

      1. Ensure Apple's command line tools are installed (xcode-select --install to launch the installer).

      2. Go to System Preferences > Sharing.

      3. Enable 'Remote Login'.

      You can also enable remote login on the command line:

      $ sudo systemsetup -setremotelogin on

      Note: You need to agree to Xcode's license.

      $ sudo xcodebuild -license
  6. Run the playbook:

    (dev-setup)$ inv playbook --ask-pass --ask-become-pass
  7. Enjoy!

Running a specific set of tagged tasks

The tags available are:

  • always
  • dock
  • homebrew
  • mas
  • oh-my-zsh
  • pipx
  • pyenv

Overriding Defaults

You can override the defaults configured in default..config.yml by creating a .config.yml file and setting the overrides in that file. e.g.:

---
mas_email: "example@example.com"

homebrew_installed_packages:
  - git
  - openssl
  - readline
  - xz
  - sqlite
  - gcc
  - cmake
  - zlib
  - tcl-tk
  - pipx
  - luarocks
  - neovim
  - tmux
  - chezmoi
  - jesseduffield/lazydocker/lazydocker
  - esolitos/ipa/sshpass
  - htop
  - dust
  - duf
  - bat
  - fish
  - starship
  - awscli
  - tfenv
  - ffmpeg

homebrew_cask_apps:
  - firefox
  - google-chrome
  - docker
  - openvpn-connect
  - hpedrorodrigues/tools/dockutil
  - font-terminess-ttf-nerd-font
  - visual-studio-code
  - zoom
  - tad
  - keybase
  - obsidian
  - google-cloud-sdk
  - ultimaker-cura
  - elgato-stream-deck
  - spotify
  - alacritty

pyenv_python_versions:
  - 3.7.15
  - 3.8.15
  - 3.9.15
  - 3.10.8
  - 3.11.0

Development

To display available tasks run:

(dev-setup)$ inv --list
Available tasks:

  ansible-lint     Run ansible linter.
  clean            Run all clean sub-tasks.
  clean-python     Clean up python file artifacts.
  format           Format code.
  galaxy-install   Install ansible-galaxy requirements.
  hooks            Run pre-commit hooks.
  install-hooks    Install pre-commit hooks.
  lint             Run all linting.
  mypy             Run mypy.
  playbook         Run Ansible playbooks, executing the defined tasks on the targeted hosts.
  ruff             Run ruff.
  security         Run security related checks.
  tests            Run ansible molecule test.
  version          Bump version.
  yamllint         Run yamllint, a linter for YAML files.

Author Information

This playbook was created in 2020 by Federico Jaureguialzo.