Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wayofdev/ansible-role-dotfiles
Installs chezmoi and your preferred dotfiles repository using Ansible role on macOS or Linux
https://github.com/wayofdev/ansible-role-dotfiles
ansible automation chezmoi dotfiles macos mdm osx osx-setup
Last synced: about 2 months ago
JSON representation
Installs chezmoi and your preferred dotfiles repository using Ansible role on macOS or Linux
- Host: GitHub
- URL: https://github.com/wayofdev/ansible-role-dotfiles
- Owner: wayofdev
- License: gpl-3.0
- Created: 2022-05-01T20:13:00.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-06-29T08:49:38.000Z (over 2 years ago)
- Last Synced: 2023-03-04T01:07:53.758Z (almost 2 years ago)
- Topics: ansible, automation, chezmoi, dotfiles, macos, mdm, osx, osx-setup
- Language: Makefile
- Homepage: https://wayof.dev
- Size: 101 KB
- Stars: 8
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Ansible Role: Chezmoi for macOS
Role is used to automate installation and setup of [chezmoi](https://thekelleys.org.uk/dnsmasq/doc.html) on macOS, Ubuntu and Debian systems.
If you **like/use** this role, please consider **starring** it. Thanks!
### โ Why should I use a dotfile manager?
> Dotfile managers give you the combined benefit of a consistent environment everywhere with an undo command and a restore from backup.
> As the core of our development environments become increasingly standardized (e.g. using git at both home and work), and we further customize them, at the same time we increasingly work in ephemeral environments like Docker containers, virtual machines, and GitHub Codespaces.
> In the same way that nobody would use an editor without an undo command, or develop software without a version control system, chezmoi brings the investment that you have made in mastering your tools to every environment that you work in.
### โ Why Chezmoi for dotfiles?
When I decided to develop a role for my dotfiles I did some research over existing dotfile managers. Chezmoi has a great comparison table over other managers. Check this [comparison table](https://www.chezmoi.io/comparison-table/).
## ๐ Requirements
- **Homebrew**: Requires `homebrew` already installed (you can use `wayofdev.homebrew` to install it on your macOS).
- Up-to-date version of ansible. During maintenance/development, we stick to ansible versions and will use new features if they are available (and update `meta/main.yml` for the minimum version).
- Compatible OS. See [compatibility](#-compatibility) table.
- Role has dependencies on third-party roles on different operating systems. See `requirements.yml` and [dependencies](#-dependencies) section.
## ๐ง Role Variables
Available variables are listed below, along with example values (see `defaults/main.yml`):
### โ Structure
```yaml
# From where should we take dotfiles?
# Example repository: "https://github.com/benmezger/dotfiles"
# By default, my personal is used.
dotfiles_repository_url: "https://github.com/lotyp/dotfiles.git"
dotfiles_repository_branch: master
```
## ๐ Example Playbook
```yaml
---
- hosts: all# is needed when running over SSH
environment:
- PATH: "/usr/local/bin:/usr/local/sbin:/opt/homebrew/bin:{{ ansible_env.PATH }}"roles:
- wayofdev.homebrew
- wayofdev.dotfiles
```
## โ๏ธ Development
To install dependencies and start development you can check contents of our `Makefile`
**Install** [poetry](https://github.com/python-poetry/poetry) using [poetry-bin](https://github.com/gi0baro/poetry-bin) and all dev python dependencies:
```bash
$ make install
```**Install** only python dependencies, assuming that you already have poetry:
```bash
$ make install-deps
```**Install** all git hooks:
```bash
$ make hooks
```**Lint** all role files:
```bash
$ make lint
```
## ๐งช Testing
You can check `Makefile` to get full list of commands for remote and local testing. For local testing you can use these comands to test whole role or separate tasks:
### โ on localhost
> :warning: **Notice**: By defaut all tests are running against your local machine!
```bash
# run molecule tests on localhost
$ poetry run molecule test --scenario-name default-macos-on-localhost -- -vvv# or with make command
$ make m-local# choose which tags will be included
$ export TASK_TAGS="dotfiles-install,dotfiles-configure"; make m-local# runs molecule with docker driver
$ poetry run molecule test --scenario-name default -- -vvv# or with make file
$ make m-linux
```
### โ over SSH
```bash
# run molecule scenarios against remote machines over SSH
# this will need VM setup and configuration
$ poetry run molecule test --scenario-name default-macos-over-ssh -- -vvv$ make m-remote
# tags also can be passed
$ export TASK_TAGS="dotfiles-install,dotfiles-configure"
$ make m-remote
```
## ๐ฆ Dependencies
Installation handled by `Makefile` and requirements are defined in `requirements.yml`
### โ for all
- [ansible.community.general](https://docs.ansible.com/ansible/latest/collections/community/general/index.html)
### โ only macOS
- [elliotweiser.osx-command-line-tools](https://galaxy.ansible.com/elliotweiser/osx-command-line-tools/)
- [wayofdev.homebrew](https://galaxy.ansible.com/wayofdev/homebrew)### โ only Linux
- [geerlingguy.git](https://galaxy.ansible.com/geerlingguy/git)
## ๐งฉ Compatibility
This role has been tested on these systems:
| system / container | tag |
| :----------------- | -------- |
| macos | monterey |
| macos | big-sur |
| ubuntu | latest |
| debian | latest |
## ๐ค License
[![Licence](https://img.shields.io/github/license/wayofdev/ansible-role-dotfiles?style=for-the-badge&color=blue)](./LICENSE)
## ๐๐ผโโ๏ธ Author Information
This role was created in **2022** by [lotyp / wayofdev](https://github.com/wayofdev).
## ๐ซก Contributors