Skip to content

Commit 368da53

Browse files
Removed dotbot + refactored ansible playbook
1 parent 8e04f51 commit 368da53

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+303
-1086
lines changed

.editorconfig

-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@ indent_size = 2
1212

1313
[{Makefile,**.mk}]
1414
indent_style = tab
15-

.github/workflows/ansible-lint.yml

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
name: ansible-lint
2-
on: [push, pull_request]
3-
2+
on: [push]
43
jobs:
54
build:
65
runs-on: ubuntu-latest
7-
86
steps:
97
- uses: actions/checkout@v3
108
with:
119
fetch-depth: 0
12-
1310
- name: Run ansible-lint
1411
uses: ansible/ansible-lint-action@main
1512
with:
16-
path: "${{ github.workspace }}/andrew-kandyba/dotfiles/ansible/local.yaml"
13+
path: "${{ github.workspace }}/andrew-kandyba/dotfiles/ansible/playbook.yml"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vault_key

.gitmodules

-4
This file was deleted.

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 andrew-kandyba
3+
Copyright (c) 2024 andrew-kandyba
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

+25-33
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,34 @@
1-
DOTBOT_DIR := "$(PWD)/dotbot"
2-
DOTBOT_BIN := "bin/dotbot"
3-
DOTBOT_CONFIG := "$(PWD)/dotbot.yaml"
4-
5-
PLAYBOOK := "$(PWD)/ansible/local.yaml"
6-
BASEDIR := "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7-
81
.PHONY := help
92
.DEFAULT_GOAL := help
103

11-
help:
12-
@grep -E '^[a-zA-Z-]+:.*?## .*$$' Makefile | awk 'BEGIN {FS = ":.*?## "}; {printf "%-27s %s\n", $$1, $$2}'
13-
14-
run: ## Run setup
15-
@cd "${BASEDIR}"
16-
@git -C "${DOTBOT_DIR}" submodule sync --quiet --recursive
17-
@git submodule update --init --recursive "${DOTBOT_DIR}"
18-
@"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASEDIR}" -c "${DOTBOT_CONFIG}"
4+
BREW_INSTALLER := "https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh"
5+
PLAYBOOK := ${PWD}/ansible/playbook.yml
6+
INVENTORIES := ${PWD}/ansible/inventories/home
7+
VAULT := ${PWD}/ansible/inventories/home/group_vars/home
8+
VAULT_PASSWORD := ${PWD}/vault_key
9+
VAULT_PASSWORD_UNDEFINED := "Vault password is undefined"
1910

20-
run-lint: ## Run ansible-lint
21-
@[ -f "`which ansible-lint`" ] && ansible-lint --offline -p "${PLAYBOOK}"
22-
23-
## Internal stuff
24-
.install-git-submodules:
25-
@git submodule update --init --recursive
11+
help:
12+
@grep -E '^[a-zA-Z-]+:.*?## .*$$' Makefile | awk 'BEGIN {FS = ":.*?## "}; {printf "%-27s %s\n", $$1, $$2}';
2613

27-
.install-brew:
28-
@[ ! -f "`which brew`" ] && sudo curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | /bin/bash || exit 0;
14+
play: ## Run playbook
15+
@[ ! -f ${VAULT_PASSWORD} ] && echo ${VAULT_PASSWORD_UNDEFINED} && exit 1 || exit 0;
16+
@[ ! -f "`which brew`" ] && sudo curl -fsSL ${BREW_INSTALLER} | /bin/bash || exit 0;
17+
@[ ! -f "`which ansible`" ] && brew install ansible || exit 0;
18+
@ansible-playbook -i ${INVENTORIES} --vault-password-file ${VAULT_PASSWORD} ${PLAYBOOK};
2919

30-
.install-neovim-plugins:
31-
@[ -f "`which nvim`" ] && nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync' || exit 0;
20+
encrypt: ## Encrypt vault
21+
@[ ! -f ${VAULT_PASSWORD} ] && echo ${VAULT_PASSWORD_UNDEFINED} && exit 1 || exit 0;
22+
@ansible-vault encrypt --vault-password-file ${VAULT_PASSWORD} ${VAULT};
3223

33-
.install-oh-my-zsh:
34-
@[ ! -d ~/.oh-my-zsh ] && curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh | /bin/bash && \
35-
ln -sf $(PWD)/../oh-my-zsh/themes/unicorn.zsh-theme ~/.oh-my-zsh/themes/unicorn.zsh-theme && \
36-
ln -sf $(PWD)/../oh-my-zsh/.zshrc ~/.zshrc || exit 0;
24+
decrypt: ## Decrypt vault
25+
@[ ! -f ${VAULT_PASSWORD} ] && echo ${VAULT_PASSWORD_UNDEFINED} && exit 1 || exit 0;
26+
@ansible-vault decrypt --vault-password-file ${VAULT_PASSWORD} ${VAULT};
3727

38-
.install-ansible:
39-
@[ ! -f "`which ansible`" ] && brew install ansible || exit 0;
28+
#todo
29+
lint: ## Run lint
30+
@exit 0;
4031

41-
.run-playbook:
42-
@cd $(PWD)/ansible && ansible-playbook --connection=local --inventory 127.0.0.1, local.yaml
32+
#todo
33+
tests: ## Run tests
34+
@exit 0;

README.md

+17-99
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,25 @@
1-
# .dotfiles
1+
# .dotfiles (MacOSX)
22

3-
[![ansible-lint](https://github.com/andrew-kandyba/dotfiles/actions/workflows/ansible-lint.yml/badge.svg)](https://github.com/andrew-kandyba/dotfiles/actions/workflows/ansible-lint.yml)   [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)  
3+
[![ansible-lint](https://github.com/andrew-kandyba/dotfiles/actions/workflows/ansible-lint.yml/badge.svg)](https://github.com/andrew-kandyba/dotfiles/actions/workflows/ansible-lint.yml)   [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)  
44

5-
This is a repo for my OS X dotfiles.
6-
Bootstrap is based on the [dotbot](https://github.com/anishathalye/dotbot).
5+
Bootstrap is based on the `make` + [ansible 🤖](https://docs.ansible.com/ansible/latest/getting_started/introduction.html).
76

8-
## Installation
9-
10-
```sh
11-
> git clone git@github.com:andrew-kandyba/dotfiles.git .dotfiles
12-
> cd .dotfiles
13-
14-
> make run
15-
```
16-
17-
## Make commands
18-
19-
```sh
20-
> 🐼 .dotfiles: make
21-
22-
run Run setup
23-
run-lint Run ansible-lint
24-
```
25-
26-
## Contents
27-
28-
```
29-
Tools:
30-
31-
- 1password
32-
- ansible
33-
- ansible-lint
34-
- appcleaner
35-
- bat
36-
- bfg
37-
- brew
38-
- composer
39-
- ctop
40-
- deepl
41-
- dive
42-
- docker
43-
- docker-compose
44-
- docker-slim
45-
- fd
46-
- font-fira-code-nerd-font
47-
- git
48-
- git-secrets
49-
- gnupg
50-
- hadolint
51-
- homebrew/cask-fonts
52-
- htop
53-
- jsonlint
54-
- k6
55-
- kitty
56-
- mkcert
57-
- molecule
58-
- neovim
59-
- ngrok
60-
- oh-my-zsh
61-
- ripgrep
62-
- sublime-text
63-
- tmux
64-
- tree
65-
- trivy
66-
- trufflesecurity/trufflehog/trufflehog
67-
- tunnelblick
68-
- vagrant
69-
- virtualbox
70-
- yamllint
71-
- zoom
72-
```
7+
## Usage
8+
```bash
9+
> git clone git@github.com:andrew-kandyba/dotfiles.git
10+
> cd ./dotfiles
7311

12+
> xcode-select --install # install make (optional)
13+
> make play
7414
```
75-
Neovim plugins:
7615

77-
- packer
16+
## Make
17+
```bash
18+
> make
7819

79-
- AndrewRadev/splitjoin.vim
80-
- airblade/vim-rooter
81-
- akinsho/bufferline.nvim
82-
- farmergreg/vim-lastplace
83-
- hrsh7th/nvim-cmp
84-
- jessarcher/vim-heritage
85-
- karb94/neoscroll.nvim
86-
- kyazdani42/nvim-tree.lua
87-
- leoluz/nvim-dap-go
88-
- lewis6991/gitsigns.nvim
89-
- lukas-reineke/indent-blankline.nvim
90-
- mfussenegger/nvim-dap
91-
- nelstrom/vim-visual-star-search
92-
- neovim/nvim-lspconfig
93-
- nvim-lualine/lualine.nvim
94-
- nvim-telescope/telescope.nvim
95-
- nvim-treesitter/nvim-treesitter
96-
- ray-x/go.nvim
97-
- rcarriga/nvim-dap-ui
98-
- sheerun/vim-polyglot
99-
- sickill/vim-pasta
100-
- theHamsta/nvim-dap-virtual-text
101-
- tpope/vim-commentary
102-
- tpope/vim-repeat
103-
- tpope/vim-sleuth
104-
- tpope/vim-surround
105-
- tpope/vim-unimpaired
106-
- windwp/nvim-autopairs
20+
play Run playbook
21+
encrypt Encrypt vault
22+
decrypt Decrypt vault
23+
lint Run lint
24+
tests Run tests
10725
```

ansible/.gitignore

-1
This file was deleted.

ansible/ansible.cfg

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ become_user = root
55
log_path = ./ansible.log
66
roles_path = ./roles
77
interpreter_python = auto_silent
8+
inventory_ignore_extensions = files, templates
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
$ANSIBLE_VAULT;1.1;AES256
2+
61623132643862313935656663366365663037333164623434383038353632353930663932613430
3+
3538643533323532376166346236666261393032363637310a346163626233333139373961313830
4+
64623665336634363865356330313364653134353634303231643633396161666330306532366462
5+
3638656230353164620a633562396435326536666466623031333032373230303732326635376432
6+
30663263316232656432616264303833626234353966393161303934373435363335356565363966
7+
63663566386365303539633731333338383361653265323033613832343034333933613935313436
8+
34366163633861626538356636303136653561316430663765313661396230613835373330623063
9+
34383034643561343132

ansible/inventories/home/hosts.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
home:
3+
hosts: 🏡
4+
vars:
5+
ansible_connection: local
6+
ansible_python_interpreter: auto_silent

ansible/local.yaml

-5
This file was deleted.

ansible/playbook.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
- name: $HOME sweet $HOME
3+
hosts: home
4+
gather_facts: no
5+
roles:
6+
- brew
7+
- git
8+
- zsh

ansible/roles/brew/tasks/main.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
- name: Installing formula packages
3+
community.general.homebrew:
4+
name: "{{ brew.formula_packages }}"
5+
state: present
6+
7+
- name: Installing cask packages
8+
community.general.homebrew_cask:
9+
name: "{{ brew.cask_packages }}"
10+
state: present
11+
12+
- name: Installing fonts
13+
community.general.homebrew_cask:
14+
name: "{{ brew.fonts }}"
15+
state: present

ansible/roles/brew/vars/main.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
brew:
3+
formula_packages:
4+
- nvm
5+
cask_packages:
6+
- 1password
7+
- bruno
8+
- docker
9+
- firefox
10+
- iterm2
11+
- phpstorm
12+
- raycast
13+
- sublime-text
14+
- telegram-desktop
15+
- virtualbox
16+
fonts:
17+
- font-fira-code-nerd-font

ansible/roles/git/tasks/main.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
- name: Installing packages
3+
community.general.homebrew:
4+
name: "{{ git.packages }}"
5+
state: present
6+
7+
- name: Create .gitconfig from <{{ git.config.template }}>
8+
ansible.builtin.template:
9+
src: "{{ git.config.template }}"
10+
dest: "{{ git.config.dest }}"
11+
12+
- name: Create .gitignore from <{{ git.ignore.template }}>
13+
ansible.builtin.template:
14+
src: "{{ git.ignore.template }}"
15+
dest: "{{ git.ignore.dest }}"
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[user]
2+
name = "{{ vault.git.name }}"
3+
email = "{{ vault.git.email }}"
4+
[core]
5+
autocrlf = input
6+
excludesfile = "{{ git.ignore.dest }}"
7+
[merge]
8+
conflictstyle = diff3
9+
ff = false
10+
[push]
11+
default = current
12+
[init]
13+
defaultBranch = "{{ git.branch }}"
14+
[diff]
15+
tool = difftastic
16+
[difftool]
17+
prompt = false
18+
[difftool "difftastic"]
19+
cmd = difft "$LOCAL" "$REMOTE"
20+
[pager]
21+
difftool = true
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.env
22
.idea
33
.DS_Store
4+
*.log

ansible/roles/git/vars/main.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
git:
3+
branch: main
4+
config:
5+
dest: ~/.gitconfig
6+
template: templates/.gitconfig.j2
7+
ignore:
8+
dest: ~/.gitignore
9+
template: templates/.gitignore.j2
10+
packages:
11+
- difftastic
12+
- git
13+
- git-secrets
14+

ansible/roles/localhost/tasks/main.yml

-34
This file was deleted.

0 commit comments

Comments
 (0)