|
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 |
| - |
8 | 1 | .PHONY := help
|
9 | 2 | .DEFAULT_GOAL := help
|
10 | 3 |
|
11 |
| -help: |
12 |
| - @grep -E '^[a-zA-Z-]+:.*?## .*$$' Makefile | awk 'BEGIN {FS = ":.*?## "}; {printf "[32m%-27s[0m %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" |
19 | 10 |
|
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 "[32m%-27s[0m %s\n", $$1, $$2}'; |
26 | 13 |
|
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}; |
29 | 19 |
|
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}; |
32 | 23 |
|
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}; |
37 | 27 |
|
38 |
| -.install-ansible: |
39 |
| - @[ ! -f "`which ansible`" ] && brew install ansible || exit 0; |
| 28 | +#todo |
| 29 | +lint: ## Run lint |
| 30 | + @exit 0; |
40 | 31 |
|
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; |
0 commit comments