diff --git a/Ansible/ansible.cfg b/Ansible/ansible.cfg new file mode 100644 index 0000000..1f7181c --- /dev/null +++ b/Ansible/ansible.cfg @@ -0,0 +1,16 @@ +[defaults] +bin_ansible_callbacks = True +callbacks_enabled = ansible.posix.profile_tasks, ansible.posix.timer +remote_user = eryn +roles_path = roles +stdout_callback = community.general.yaml + +[connection] +pipelining = true + +[ssh_connection] +ssh_args = -o ControlMaster=auto -o ControlPersist=60s + +[vault] +username = ansible-infrastructure-vault +keyname = default diff --git a/Ansible/local.yml b/Ansible/local.yml new file mode 100644 index 0000000..f18a2d6 --- /dev/null +++ b/Ansible/local.yml @@ -0,0 +1,7 @@ +--- +- name: Local + hosts: localhost + tasks: + - name: Set up dotfiles + ansible.builtin.include_role: + name: dotfiles diff --git a/emacs b/Ansible/roles/dotfiles/files/emacs/emacs similarity index 100% rename from emacs rename to Ansible/roles/dotfiles/files/emacs/emacs diff --git a/gitconfig b/Ansible/roles/dotfiles/files/git/gitconfig similarity index 100% rename from gitconfig rename to Ansible/roles/dotfiles/files/git/gitconfig diff --git a/gitignore b/Ansible/roles/dotfiles/files/git/gitignore similarity index 100% rename from gitignore rename to Ansible/roles/dotfiles/files/git/gitignore diff --git a/mutt/mailcap b/Ansible/roles/dotfiles/files/mutt/mailcap similarity index 100% rename from mutt/mailcap rename to Ansible/roles/dotfiles/files/mutt/mailcap diff --git a/muttrc b/Ansible/roles/dotfiles/files/mutt/muttrc similarity index 92% rename from muttrc rename to Ansible/roles/dotfiles/files/mutt/muttrc index 6ec822c..19b0b9b 100644 --- a/muttrc +++ b/Ansible/roles/dotfiles/files/mutt/muttrc @@ -19,9 +19,9 @@ set timeout=300 set imap_keepalive=300 # Caching -set header_cache="~/.mutt/cache/headers" -set message_cachedir="~/.mutt/cache/bodies" -set certificate_file="~/.mutt/certificates" +set header_cache="~/.local/state/mutt/cache/headers" +set message_cachedir="~/.local/state/mutt/cache/bodies" +set certificate_file="~/.local/state/mutt/certificates" set use_from=yes set envelope_from=yes @@ -50,14 +50,14 @@ hdr_order Date: From: To: Cc: Subject: # Aliases set reverse_alias=yes -set alias_file="~/.mutt/aliases" +set alias_file="~/.config/mutt/aliases" # Composing and Sending set edit_headers=yes set include=yes # HTML email :( -set mailcap_path="~/.mutt/mailcap" +set mailcap_path="~/.config/mutt/mailcap" auto_view text/html alternative_order text/html text/plain text/enriched diff --git a/mutt/view_attachment.sh b/Ansible/roles/dotfiles/files/mutt/view_attachment.sh similarity index 100% rename from mutt/view_attachment.sh rename to Ansible/roles/dotfiles/files/mutt/view_attachment.sh diff --git a/config/nvim/UltiSnips/lua.snippets b/Ansible/roles/dotfiles/files/neovim/UltiSnips/lua.snippets similarity index 100% rename from config/nvim/UltiSnips/lua.snippets rename to Ansible/roles/dotfiles/files/neovim/UltiSnips/lua.snippets diff --git a/config/nvim/UltiSnips/python.snippets b/Ansible/roles/dotfiles/files/neovim/UltiSnips/python.snippets similarity index 100% rename from config/nvim/UltiSnips/python.snippets rename to Ansible/roles/dotfiles/files/neovim/UltiSnips/python.snippets diff --git a/config/nvim/after/ftplugin/css.lua b/Ansible/roles/dotfiles/files/neovim/after/ftplugin/css.lua similarity index 100% rename from config/nvim/after/ftplugin/css.lua rename to Ansible/roles/dotfiles/files/neovim/after/ftplugin/css.lua diff --git a/config/nvim/after/ftplugin/gitcommit.vim b/Ansible/roles/dotfiles/files/neovim/after/ftplugin/gitcommit.vim similarity index 100% rename from config/nvim/after/ftplugin/gitcommit.vim rename to Ansible/roles/dotfiles/files/neovim/after/ftplugin/gitcommit.vim diff --git a/config/nvim/after/ftplugin/gohtmltmpl.lua b/Ansible/roles/dotfiles/files/neovim/after/ftplugin/gohtmltmpl.lua similarity index 100% rename from config/nvim/after/ftplugin/gohtmltmpl.lua rename to Ansible/roles/dotfiles/files/neovim/after/ftplugin/gohtmltmpl.lua diff --git a/config/nvim/after/ftplugin/lua.lua b/Ansible/roles/dotfiles/files/neovim/after/ftplugin/lua.lua similarity index 100% rename from config/nvim/after/ftplugin/lua.lua rename to Ansible/roles/dotfiles/files/neovim/after/ftplugin/lua.lua diff --git a/config/nvim/after/ftplugin/python.lua b/Ansible/roles/dotfiles/files/neovim/after/ftplugin/python.lua similarity index 100% rename from config/nvim/after/ftplugin/python.lua rename to Ansible/roles/dotfiles/files/neovim/after/ftplugin/python.lua diff --git a/config/nvim/after/ftplugin/rust.lua b/Ansible/roles/dotfiles/files/neovim/after/ftplugin/rust.lua similarity index 100% rename from config/nvim/after/ftplugin/rust.lua rename to Ansible/roles/dotfiles/files/neovim/after/ftplugin/rust.lua diff --git a/config/nvim/after/ftplugin/zsh.lua b/Ansible/roles/dotfiles/files/neovim/after/ftplugin/zsh.lua similarity index 100% rename from config/nvim/after/ftplugin/zsh.lua rename to Ansible/roles/dotfiles/files/neovim/after/ftplugin/zsh.lua diff --git a/config/nvim/after/plugin/gitgutter.lua b/Ansible/roles/dotfiles/files/neovim/after/plugin/gitgutter.lua similarity index 100% rename from config/nvim/after/plugin/gitgutter.lua rename to Ansible/roles/dotfiles/files/neovim/after/plugin/gitgutter.lua diff --git a/config/nvim/after/plugin/treesitter.lua b/Ansible/roles/dotfiles/files/neovim/after/plugin/treesitter.lua similarity index 100% rename from config/nvim/after/plugin/treesitter.lua rename to Ansible/roles/dotfiles/files/neovim/after/plugin/treesitter.lua diff --git a/config/nvim/after/syntax/css.vim b/Ansible/roles/dotfiles/files/neovim/after/syntax/css.vim similarity index 100% rename from config/nvim/after/syntax/css.vim rename to Ansible/roles/dotfiles/files/neovim/after/syntax/css.vim diff --git a/config/nvim/ftdetect/gohtmltmpl.lua b/Ansible/roles/dotfiles/files/neovim/ftdetect/gohtmltmpl.lua similarity index 100% rename from config/nvim/ftdetect/gohtmltmpl.lua rename to Ansible/roles/dotfiles/files/neovim/ftdetect/gohtmltmpl.lua diff --git a/config/nvim/ftdetect/zsh.lua b/Ansible/roles/dotfiles/files/neovim/ftdetect/zsh.lua similarity index 100% rename from config/nvim/ftdetect/zsh.lua rename to Ansible/roles/dotfiles/files/neovim/ftdetect/zsh.lua diff --git a/config/nvim/init.lua b/Ansible/roles/dotfiles/files/neovim/init.lua similarity index 100% rename from config/nvim/init.lua rename to Ansible/roles/dotfiles/files/neovim/init.lua diff --git a/config/nvim/lua/autocommands.lua b/Ansible/roles/dotfiles/files/neovim/lua/autocommands.lua similarity index 100% rename from config/nvim/lua/autocommands.lua rename to Ansible/roles/dotfiles/files/neovim/lua/autocommands.lua diff --git a/config/nvim/lua/colors.lua b/Ansible/roles/dotfiles/files/neovim/lua/colors.lua similarity index 100% rename from config/nvim/lua/colors.lua rename to Ansible/roles/dotfiles/files/neovim/lua/colors.lua diff --git a/config/nvim/lua/configuration.lua b/Ansible/roles/dotfiles/files/neovim/lua/configuration.lua similarity index 100% rename from config/nvim/lua/configuration.lua rename to Ansible/roles/dotfiles/files/neovim/lua/configuration.lua diff --git a/config/nvim/lua/diagnostics.lua b/Ansible/roles/dotfiles/files/neovim/lua/diagnostics.lua similarity index 100% rename from config/nvim/lua/diagnostics.lua rename to Ansible/roles/dotfiles/files/neovim/lua/diagnostics.lua diff --git a/config/nvim/lua/gui.lua b/Ansible/roles/dotfiles/files/neovim/lua/gui.lua similarity index 100% rename from config/nvim/lua/gui.lua rename to Ansible/roles/dotfiles/files/neovim/lua/gui.lua diff --git a/config/nvim/lua/keys.lua b/Ansible/roles/dotfiles/files/neovim/lua/keys.lua similarity index 100% rename from config/nvim/lua/keys.lua rename to Ansible/roles/dotfiles/files/neovim/lua/keys.lua diff --git a/config/nvim/lua/lsp.lua b/Ansible/roles/dotfiles/files/neovim/lua/lsp.lua similarity index 100% rename from config/nvim/lua/lsp.lua rename to Ansible/roles/dotfiles/files/neovim/lua/lsp.lua diff --git a/config/nvim/lua/treesitter.lua b/Ansible/roles/dotfiles/files/neovim/lua/treesitter.lua similarity index 100% rename from config/nvim/lua/treesitter.lua rename to Ansible/roles/dotfiles/files/neovim/lua/treesitter.lua diff --git a/config/nvim/syntax/gocsstmpl.vim b/Ansible/roles/dotfiles/files/neovim/syntax/gocsstmpl.vim similarity index 100% rename from config/nvim/syntax/gocsstmpl.vim rename to Ansible/roles/dotfiles/files/neovim/syntax/gocsstmpl.vim diff --git a/nethackrc b/Ansible/roles/dotfiles/files/nethack/nethackrc similarity index 100% rename from nethackrc rename to Ansible/roles/dotfiles/files/nethack/nethackrc diff --git a/screenrc b/Ansible/roles/dotfiles/files/screen/screenrc similarity index 100% rename from screenrc rename to Ansible/roles/dotfiles/files/screen/screenrc diff --git a/tmux.conf b/Ansible/roles/dotfiles/files/tmux/tmux.conf similarity index 100% rename from tmux.conf rename to Ansible/roles/dotfiles/files/tmux/tmux.conf diff --git a/vimrc b/Ansible/roles/dotfiles/files/vim/vimrc similarity index 100% rename from vimrc rename to Ansible/roles/dotfiles/files/vim/vimrc diff --git a/zsh/func/append_to_path b/Ansible/roles/dotfiles/files/zsh/functions/append_to_path similarity index 100% rename from zsh/func/append_to_path rename to Ansible/roles/dotfiles/files/zsh/functions/append_to_path diff --git a/zsh/func/binary_exists b/Ansible/roles/dotfiles/files/zsh/functions/binary_exists similarity index 100% rename from zsh/func/binary_exists rename to Ansible/roles/dotfiles/files/zsh/functions/binary_exists diff --git a/zsh/func/connect_ssh_agent b/Ansible/roles/dotfiles/files/zsh/functions/connect_ssh_agent similarity index 100% rename from zsh/func/connect_ssh_agent rename to Ansible/roles/dotfiles/files/zsh/functions/connect_ssh_agent diff --git a/zsh/func/darwin-icloud-drive-path b/Ansible/roles/dotfiles/files/zsh/functions/darwin-icloud-drive-path similarity index 100% rename from zsh/func/darwin-icloud-drive-path rename to Ansible/roles/dotfiles/files/zsh/functions/darwin-icloud-drive-path diff --git a/zsh/func/darwin/darwin-hardware-model b/Ansible/roles/dotfiles/files/zsh/functions/darwin/darwin-hardware-model similarity index 100% rename from zsh/func/darwin/darwin-hardware-model rename to Ansible/roles/dotfiles/files/zsh/functions/darwin/darwin-hardware-model diff --git a/zsh/func/darwin/darwin-os-build b/Ansible/roles/dotfiles/files/zsh/functions/darwin/darwin-os-build similarity index 100% rename from zsh/func/darwin/darwin-os-build rename to Ansible/roles/dotfiles/files/zsh/functions/darwin/darwin-os-build diff --git a/zsh/func/darwin/darwin-os-version b/Ansible/roles/dotfiles/files/zsh/functions/darwin/darwin-os-version similarity index 100% rename from zsh/func/darwin/darwin-os-version rename to Ansible/roles/dotfiles/files/zsh/functions/darwin/darwin-os-version diff --git a/zsh/func/darwin_configure_screenshots_directory b/Ansible/roles/dotfiles/files/zsh/functions/darwin_configure_screenshots_directory similarity index 100% rename from zsh/func/darwin_configure_screenshots_directory rename to Ansible/roles/dotfiles/files/zsh/functions/darwin_configure_screenshots_directory diff --git a/zsh/func/darwin_init_once b/Ansible/roles/dotfiles/files/zsh/functions/darwin_init_once similarity index 100% rename from zsh/func/darwin_init_once rename to Ansible/roles/dotfiles/files/zsh/functions/darwin_init_once diff --git a/zsh/func/do_init_functions b/Ansible/roles/dotfiles/files/zsh/functions/do_init_functions similarity index 100% rename from zsh/func/do_init_functions rename to Ansible/roles/dotfiles/files/zsh/functions/do_init_functions diff --git a/zsh/func/finder b/Ansible/roles/dotfiles/files/zsh/functions/finder similarity index 100% rename from zsh/func/finder rename to Ansible/roles/dotfiles/files/zsh/functions/finder diff --git a/zsh/func/g b/Ansible/roles/dotfiles/files/zsh/functions/g similarity index 100% rename from zsh/func/g rename to Ansible/roles/dotfiles/files/zsh/functions/g diff --git a/zsh/func/homebrew-prefix b/Ansible/roles/dotfiles/files/zsh/functions/homebrew-prefix similarity index 100% rename from zsh/func/homebrew-prefix rename to Ansible/roles/dotfiles/files/zsh/functions/homebrew-prefix diff --git a/zsh/func/import_cacert b/Ansible/roles/dotfiles/files/zsh/functions/import_cacert similarity index 100% rename from zsh/func/import_cacert rename to Ansible/roles/dotfiles/files/zsh/functions/import_cacert diff --git a/zsh/func/init_app_environments b/Ansible/roles/dotfiles/files/zsh/functions/init_app_environments similarity index 100% rename from zsh/func/init_app_environments rename to Ansible/roles/dotfiles/files/zsh/functions/init_app_environments diff --git a/zsh/func/init_configure_ls b/Ansible/roles/dotfiles/files/zsh/functions/init_configure_ls similarity index 100% rename from zsh/func/init_configure_ls rename to Ansible/roles/dotfiles/files/zsh/functions/init_configure_ls diff --git a/zsh/func/init_profile_darwin b/Ansible/roles/dotfiles/files/zsh/functions/init_profile_darwin similarity index 100% rename from zsh/func/init_profile_darwin rename to Ansible/roles/dotfiles/files/zsh/functions/init_profile_darwin diff --git a/zsh/func/init_profile_darwin_say_hello b/Ansible/roles/dotfiles/files/zsh/functions/init_profile_darwin_say_hello similarity index 100% rename from zsh/func/init_profile_darwin_say_hello rename to Ansible/roles/dotfiles/files/zsh/functions/init_profile_darwin_say_hello diff --git a/zsh/func/init_rc_aliases b/Ansible/roles/dotfiles/files/zsh/functions/init_rc_aliases similarity index 100% rename from zsh/func/init_rc_aliases rename to Ansible/roles/dotfiles/files/zsh/functions/init_rc_aliases diff --git a/zsh/func/init_rc_configure_completion b/Ansible/roles/dotfiles/files/zsh/functions/init_rc_configure_completion similarity index 100% rename from zsh/func/init_rc_configure_completion rename to Ansible/roles/dotfiles/files/zsh/functions/init_rc_configure_completion diff --git a/zsh/func/init_rc_configure_prompt b/Ansible/roles/dotfiles/files/zsh/functions/init_rc_configure_prompt similarity index 100% rename from zsh/func/init_rc_configure_prompt rename to Ansible/roles/dotfiles/files/zsh/functions/init_rc_configure_prompt diff --git a/zsh/func/init_rc_configure_zle b/Ansible/roles/dotfiles/files/zsh/functions/init_rc_configure_zle similarity index 100% rename from zsh/func/init_rc_configure_zle rename to Ansible/roles/dotfiles/files/zsh/functions/init_rc_configure_zle diff --git a/zsh/func/init_rc_fpath_darwin b/Ansible/roles/dotfiles/files/zsh/functions/init_rc_fpath_darwin similarity index 100% rename from zsh/func/init_rc_fpath_darwin rename to Ansible/roles/dotfiles/files/zsh/functions/init_rc_fpath_darwin diff --git a/zsh/func/init_rc_linux b/Ansible/roles/dotfiles/files/zsh/functions/init_rc_linux similarity index 100% rename from zsh/func/init_rc_linux rename to Ansible/roles/dotfiles/files/zsh/functions/init_rc_linux diff --git a/zsh/func/init_rc_tilde_paths b/Ansible/roles/dotfiles/files/zsh/functions/init_rc_tilde_paths similarity index 100% rename from zsh/func/init_rc_tilde_paths rename to Ansible/roles/dotfiles/files/zsh/functions/init_rc_tilde_paths diff --git a/Ansible/roles/dotfiles/files/zsh/functions/init_site_environment b/Ansible/roles/dotfiles/files/zsh/functions/init_site_environment new file mode 100644 index 0000000..b4f382b --- /dev/null +++ b/Ansible/roles/dotfiles/files/zsh/functions/init_site_environment @@ -0,0 +1,9 @@ +#!/usr/bin/env zsh +# Eryn Wells + +function init_site_environments +{ + export ERYNWELLS_ME_SITE="$HOME/Developer/erynwells.me" +} + +init_site_environments "$@" diff --git a/Ansible/roles/dotfiles/files/zsh/functions/init_website_environment b/Ansible/roles/dotfiles/files/zsh/functions/init_website_environment new file mode 100644 index 0000000..e1f791e --- /dev/null +++ b/Ansible/roles/dotfiles/files/zsh/functions/init_website_environment @@ -0,0 +1,9 @@ +#!/usr/bin/env zsh +# Eryn Wells + +function init_website_environments +{ + export ERYNWELLS_ME_SITE="$HOME/Developer/erynwells.me" +} + +init_website_environments "$@" diff --git a/zsh/func/init_xcode b/Ansible/roles/dotfiles/files/zsh/functions/init_xcode similarity index 100% rename from zsh/func/init_xcode rename to Ansible/roles/dotfiles/files/zsh/functions/init_xcode diff --git a/zsh/func/init_zsh_functions b/Ansible/roles/dotfiles/files/zsh/functions/init_zsh_functions similarity index 100% rename from zsh/func/init_zsh_functions rename to Ansible/roles/dotfiles/files/zsh/functions/init_zsh_functions diff --git a/zsh/func/init_zsh_history b/Ansible/roles/dotfiles/files/zsh/functions/init_zsh_history similarity index 100% rename from zsh/func/init_zsh_history rename to Ansible/roles/dotfiles/files/zsh/functions/init_zsh_history diff --git a/zsh/func/init_zsh_options b/Ansible/roles/dotfiles/files/zsh/functions/init_zsh_options similarity index 100% rename from zsh/func/init_zsh_options rename to Ansible/roles/dotfiles/files/zsh/functions/init_zsh_options diff --git a/zsh/func/list_tmux_sessions b/Ansible/roles/dotfiles/files/zsh/functions/list_tmux_sessions similarity index 100% rename from zsh/func/list_tmux_sessions rename to Ansible/roles/dotfiles/files/zsh/functions/list_tmux_sessions diff --git a/zsh/func/load_module b/Ansible/roles/dotfiles/files/zsh/functions/load_module similarity index 100% rename from zsh/func/load_module rename to Ansible/roles/dotfiles/files/zsh/functions/load_module diff --git a/zsh/func/neovim_init_once b/Ansible/roles/dotfiles/files/zsh/functions/neovim_init_once similarity index 100% rename from zsh/func/neovim_init_once rename to Ansible/roles/dotfiles/files/zsh/functions/neovim_init_once diff --git a/zsh/func/nethack b/Ansible/roles/dotfiles/files/zsh/functions/nethack similarity index 100% rename from zsh/func/nethack rename to Ansible/roles/dotfiles/files/zsh/functions/nethack diff --git a/zsh/func/open-xcode b/Ansible/roles/dotfiles/files/zsh/functions/open-xcode similarity index 100% rename from zsh/func/open-xcode rename to Ansible/roles/dotfiles/files/zsh/functions/open-xcode diff --git a/zsh/func/prepend_to_path b/Ansible/roles/dotfiles/files/zsh/functions/prepend_to_path similarity index 100% rename from zsh/func/prepend_to_path rename to Ansible/roles/dotfiles/files/zsh/functions/prepend_to_path diff --git a/zsh/func/prompt_colorize b/Ansible/roles/dotfiles/files/zsh/functions/prompt_colorize similarity index 100% rename from zsh/func/prompt_colorize rename to Ansible/roles/dotfiles/files/zsh/functions/prompt_colorize diff --git a/zsh/func/prompt_loquacious_setup b/Ansible/roles/dotfiles/files/zsh/functions/prompt_loquacious_setup similarity index 100% rename from zsh/func/prompt_loquacious_setup rename to Ansible/roles/dotfiles/files/zsh/functions/prompt_loquacious_setup diff --git a/zsh/func/refresh_system_tags b/Ansible/roles/dotfiles/files/zsh/functions/refresh_system_tags similarity index 100% rename from zsh/func/refresh_system_tags rename to Ansible/roles/dotfiles/files/zsh/functions/refresh_system_tags diff --git a/zsh/func/setup-cpython b/Ansible/roles/dotfiles/files/zsh/functions/setup-cpython similarity index 100% rename from zsh/func/setup-cpython rename to Ansible/roles/dotfiles/files/zsh/functions/setup-cpython diff --git a/zsh/func/setup_android b/Ansible/roles/dotfiles/files/zsh/functions/setup_android similarity index 100% rename from zsh/func/setup_android rename to Ansible/roles/dotfiles/files/zsh/functions/setup_android diff --git a/zsh/func/solarized b/Ansible/roles/dotfiles/files/zsh/functions/solarized similarity index 100% rename from zsh/func/solarized rename to Ansible/roles/dotfiles/files/zsh/functions/solarized diff --git a/zsh/func/up b/Ansible/roles/dotfiles/files/zsh/functions/up similarity index 100% rename from zsh/func/up rename to Ansible/roles/dotfiles/files/zsh/functions/up diff --git a/zsh/func/update-path b/Ansible/roles/dotfiles/files/zsh/functions/update-path similarity index 100% rename from zsh/func/update-path rename to Ansible/roles/dotfiles/files/zsh/functions/update-path diff --git a/Ansible/roles/dotfiles/files/zsh/functions/weeknotes b/Ansible/roles/dotfiles/files/zsh/functions/weeknotes new file mode 100644 index 0000000..9381644 --- /dev/null +++ b/Ansible/roles/dotfiles/files/zsh/functions/weeknotes @@ -0,0 +1,15 @@ +#!/usr/bin/env zsh + +autoload init_website_environment + +function weeknotes +{ + init_website_environment + + YEAR=`date '+%Y'` + WEEK_NUMBER=`date '+%V'` + PAGE_PATH=blog/${YEAR}/weeknotes-${YEAR}w${WEEK_NUMBER}.md + UPCOMING_SUNDAY=`${ERYNWELLS_ME_SITE}/scripts/next_sunday.py` +} + +weeknotes "$@" diff --git a/Ansible/roles/dotfiles/files/zsh/zshenv b/Ansible/roles/dotfiles/files/zsh/zshenv index ead3559..540ecba 100644 --- a/Ansible/roles/dotfiles/files/zsh/zshenv +++ b/Ansible/roles/dotfiles/files/zsh/zshenv @@ -9,7 +9,9 @@ function init-env-fpath { local -r fpath_candidates=( \ "$HOME/.zsh/${SYS}-functions" \ - "$HOME/.zsh/func" \ + "$HOME/.zsh/init-env-functions" \ + "$HOME/.zsh/init-rc-functions" \ + "$HOME/.zsh/functions" \ ) # Process the array in reverse order (`Oa` means "descending index order", diff --git a/Ansible/roles/dotfiles/handlers/main.yml b/Ansible/roles/dotfiles/handlers/main.yml new file mode 100644 index 0000000..dfc89e5 --- /dev/null +++ b/Ansible/roles/dotfiles/handlers/main.yml @@ -0,0 +1,4 @@ +--- +- name: Rediscover package manager + ansible.builtin.setup: + gather_subset: pkg_mgr diff --git a/Ansible/roles/dotfiles/tasks/darwin/bootstrap.yml b/Ansible/roles/dotfiles/tasks/darwin/bootstrap.yml new file mode 100644 index 0000000..0474ec1 --- /dev/null +++ b/Ansible/roles/dotfiles/tasks/darwin/bootstrap.yml @@ -0,0 +1,3 @@ +--- +- name: (macOS) Configure homebrew + ansible.builtin.include_tasks: homebrew.yml diff --git a/Ansible/roles/dotfiles/tasks/darwin/homebrew.yml b/Ansible/roles/dotfiles/tasks/darwin/homebrew.yml new file mode 100644 index 0000000..2ac20c6 --- /dev/null +++ b/Ansible/roles/dotfiles/tasks/darwin/homebrew.yml @@ -0,0 +1,37 @@ +--- +- name: (macOS | homebrew) Does the brew command exist? + ansible.builtin.stat: + path: /opt/homebrew/bin/brew + register: _dotfiles_homebrew_brew + +- name: (macOS | homebrew) Install Homebrew + when: not _dotfiles_homebrew_brew.stat.exists + block: + - name: (macOS | homebrew) Create temporary file for install script + ansible.builtin.tempfile: + state: file + prefix: homebrew-install + register: _dotfiles_homebrew_install_script + + - name: (macOS | homebrew) Set up homebrew + block: + - name: (macOS | homebrew) Fetch install script + ansible.builtin.get_url: + url: https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh + dest: "{{ _dotfiles_homebrew_install_script.path }}" + mode: "0644" + + - name: (macOS | homebrew) Run install script + ansible.builtin.command: + cmd: bash {{ _dotfiles_homebrew_install_script.path }} + environment: + NONINTERACTIVE: 1 + + - name: (macOS | homebrew) Gather package manager facts + ansible.builtin.setup: + gather_subset: pkg_mgr + always: + - name: (macOS | homebrew) Remove temporary install script + ansible.builtin.file: + path: "{{ _dotfiles_homebrew_install_script.path }}" + state: absent diff --git a/Ansible/roles/dotfiles/tasks/dotfiles.yml b/Ansible/roles/dotfiles/tasks/dotfiles.yml new file mode 100644 index 0000000..389ab23 --- /dev/null +++ b/Ansible/roles/dotfiles/tasks/dotfiles.yml @@ -0,0 +1,28 @@ +--- +- name: (dotfiles) ZSH + ansible.builtin.include_tasks: zsh.yml + tags: [ always, dotfiles_shell, dotfiles_zsh ] + +- name: (dotfiles) Vim + ansible.builtin.include_tasks: vim.yml + tags: [ always, dotfiles_vim ] + +- name: (dotfiles) Emacs + ansible.builtin.include_tasks: emacs.yml + tags: dotfiles_emacs + +- name: (dotfiles) Git + ansible.builtin.include_tasks: git.yml + tags: [ always, dotfiles_git ] + +- name: (dotfiles) Mutt + ansible.builtin.include_tasks: mutt.yml + tags: dotfiles_mutt + +- name: (dotfiles) Shell utilities + ansible.builtin.include_tasks: shell_utilities.yml + tags: dotfiles_shell + +- name: (dotfiles) Nethack + ansible.builtin.include_tasks: nethack.yml + tags: dotfiles_nethack diff --git a/Ansible/roles/dotfiles/tasks/emacs.yml b/Ansible/roles/dotfiles/tasks/emacs.yml new file mode 100644 index 0000000..415cf08 --- /dev/null +++ b/Ansible/roles/dotfiles/tasks/emacs.yml @@ -0,0 +1,7 @@ +--- +- name: (emacs) Link emacs config + ansible.builtin.file: + path: ~/.emacs + src: "{{ role_path }}/files/emacs/emacs" + state: link + force: true diff --git a/Ansible/roles/dotfiles/tasks/git.yml b/Ansible/roles/dotfiles/tasks/git.yml new file mode 100644 index 0000000..b326569 --- /dev/null +++ b/Ansible/roles/dotfiles/tasks/git.yml @@ -0,0 +1,10 @@ +--- +- name: (git) Link global git configs + ansible.builtin.file: + path: ~/.{{ item }} + src: "{{ role_path }}/files/git/{{ item }}" + state: link + force: true + loop: + - gitconfig + - gitignore diff --git a/Ansible/roles/dotfiles/tasks/main.yml b/Ansible/roles/dotfiles/tasks/main.yml index 3c2ba07..91fc42c 100644 --- a/Ansible/roles/dotfiles/tasks/main.yml +++ b/Ansible/roles/dotfiles/tasks/main.yml @@ -1,3 +1,17 @@ --- -- name: ZSH - ansible.builtin.include_tasks: zsh.yml +- name: Bootstrap system + ansible.builtin.include_tasks: "{{ ansible_facts.os_family | lower }}/bootstrap.yml" + +#- name: Install packages +# ansible.builtin.include_tasks: packages.yml + +- name: Link dotfiles + ansible.builtin.include_tasks: dotfiles.yml + tags: + - dotfiles_git + - dotfiles_mutt + - dotfiles_neovim + - dotfiles_nethack + - dotfiles_shell + - dotfiles_vim + - dotfiles_zsh diff --git a/Ansible/roles/dotfiles/tasks/mutt.yml b/Ansible/roles/dotfiles/tasks/mutt.yml new file mode 100644 index 0000000..6cf777d --- /dev/null +++ b/Ansible/roles/dotfiles/tasks/mutt.yml @@ -0,0 +1,25 @@ +--- +- name: (mutt) Link muttrc + ansible.builtin.file: + path: ~/.muttrc + src: "{{ role_path }}/files/mutt/muttrc" + state: link + force: true + +- name: (mutt) Make mutt config directory + ansible.builtin.file: + path: ~/.config/mutt + state: directory + force: true + +- name: (mutt) Link mailcap + ansible.builtin.file: + path: ~/.config/mutt/mailcap + src: "{{ role_path }}/files/mutt/mailcap" + state: link + force: true + +- name: (mutt) Create local state directory + ansible.builtin.file: + path: ~/.local/state/mutt + state: directory diff --git a/Ansible/roles/dotfiles/tasks/nethack.yml b/Ansible/roles/dotfiles/tasks/nethack.yml new file mode 100644 index 0000000..d6e8951 --- /dev/null +++ b/Ansible/roles/dotfiles/tasks/nethack.yml @@ -0,0 +1,15 @@ +--- +- name: (nethack) Install nethack package + ansible.builtin.package: + name: nethack + state: present + when: + - dotfiles_install_packages is defined + - "'nethack' in dotfiles_install_packages" + +- name: (nethack) Link nethackrc + ansible.builtin.file: + path: ~/.nethackrc + src: "{{ role_path }}/files/nethack/nethackrc" + state: link + force: true diff --git a/Ansible/roles/dotfiles/tasks/packages.yml b/Ansible/roles/dotfiles/tasks/packages.yml new file mode 100644 index 0000000..0642dc4 --- /dev/null +++ b/Ansible/roles/dotfiles/tasks/packages.yml @@ -0,0 +1,13 @@ +--- +- name: Install packages + become: "{{ _dotfiles_requires_become[ansible_facts.pkg_mgr] | default(true) }}" + vars: + package_names: _dotfiles_package_names[ansible_facts.pkg_mgr] + ansible.builtin.package: + name: > + {{ + package_names[package] | default(package) + for package + in (_dotfiles_core_packages + dotfiles_install_packages) + }} + state: present diff --git a/Ansible/roles/dotfiles/tasks/shell_utilities.yml b/Ansible/roles/dotfiles/tasks/shell_utilities.yml new file mode 100644 index 0000000..197a1ee --- /dev/null +++ b/Ansible/roles/dotfiles/tasks/shell_utilities.yml @@ -0,0 +1,16 @@ +--- +- name: (tmux) Link tmux.conf + ansible.builtin.file: + path: ~/.tmux.conf + src: "{{ role_path }}/files/tmux/tmux.conf" + state: link + force: true + tags: dotfiles_tmux + +- name: (screen) Link screenrc + ansible.builtin.file: + path: ~/.screenrc + src: "{{ role_path }}/files/screen/screenrc" + state: link + force: true + tags: dotfiles_screen diff --git a/Ansible/roles/dotfiles/tasks/vim.yml b/Ansible/roles/dotfiles/tasks/vim.yml new file mode 100644 index 0000000..e3ff49b --- /dev/null +++ b/Ansible/roles/dotfiles/tasks/vim.yml @@ -0,0 +1,33 @@ +--- +- name: (vim) Link plain vim config + ansible.builtin.file: + path: ~/.vimrc + src: "{{ role_path }}/files/vim/vimrc" + state: link + force: true + +- name: (neovim) Create standard config directory + tags: dotfiles_neovim + ansible.builtin.file: + path: ~/.config + state: directory + +- name: (neovim) Link config + tags: dotfiles_neovim + ansible.builtin.file: + path: ~/.config/nvim + src: "{{ role_path }}/files/neovim" + state: link + force: true + +- name: (neovim) Create .local directories + tags: dotfiles_neovim + ansible.builtin.file: + path: "{{ item }}" + state: directory + loop: + - ~/.local/share/nvim + - ~/.local/state/nvim + - ~/.local/state/nvim/backup + - ~/.local/state/nvim/swap + - ~/.local/state/nvim/undo diff --git a/Ansible/roles/dotfiles/tasks/zsh.yml b/Ansible/roles/dotfiles/tasks/zsh.yml index 9301154..c0b8570 100644 --- a/Ansible/roles/dotfiles/tasks/zsh.yml +++ b/Ansible/roles/dotfiles/tasks/zsh.yml @@ -1,25 +1,45 @@ --- -- name: (ZSH) Link startup files - ansible.builtin.file: - path: ~/.{{ item }} - src: "{{ role_path }}/files/zsh/{{ item }}" - state: link - force: true - loop: - - zshenv - - zshrc - - zprofile +- name: (zsh) Find zsh binary + ansible.builtin.command: + cmd: sh -c 'which zsh' + register: _dotfiles_which_zsh -- name: (ZSH) Link env functions - ansible.builtin.file: - path: ~/.zsh/init-env-functions - src: "{{ role_path }}/files/zsh/init-env-functions" - state: link - force: true +- name: (zsh) Configure zsh + when: (_dotfiles_which_zsh | length) > 0 + block: + - name: (zsh) Make zsh my shell + ansible.builtin.user: + name: "{{ ansible_user }}" + shell: "{{ _dotfiles_which_zsh.stdout }}" + state: present -- name: (ZSH) Link rc functions - ansible.builtin.file: - path: ~/.zsh/init-rc-functions - src: "{{ role_path }}/files/zsh/init-rc-functions" - state: link - force: true + - name: (zsh) Link startup files + ansible.builtin.file: + path: ~/.{{ item }} + src: "{{ role_path }}/files/zsh/{{ item }}" + state: link + force: true + loop: + - zshenv + - zshrc + - zprofile + + - name: (zsh) Create zsh directories + ansible.builtin.file: + path: "{{ item }}" + state: directory + force: true + loop: + - ~/.zsh + - ~/.zsh/cache + + - name: (zsh) Link function library directories + ansible.builtin.file: + path: ~/.zsh/{{ item }} + src: "{{ role_path }}/files/zsh/{{ item }}" + state: link + force: true + loop: + - init-env-functions + - init-rc-functions + - functions diff --git a/Ansible/roles/dotfiles/vars/main.yml b/Ansible/roles/dotfiles/vars/main.yml new file mode 100644 index 0000000..de5b952 --- /dev/null +++ b/Ansible/roles/dotfiles/vars/main.yml @@ -0,0 +1,11 @@ +_dotfiles_core_packages: + - zsh + - git + - tmux + - neovim + +_dotfiles_package_names: + homebrew: + +_dotfiles_requires_become: + homebrew: false