Compare commits

...

10 commits

97 changed files with 324 additions and 30 deletions

16
Ansible/ansible.cfg Normal file
View file

@ -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

7
Ansible/local.yml Normal file
View file

@ -0,0 +1,7 @@
---
- name: Local
hosts: localhost
tasks:
- name: Set up dotfiles
ansible.builtin.include_role:
name: dotfiles

View file

@ -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

View file

@ -0,0 +1,9 @@
#!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me>
function init_site_environments
{
export ERYNWELLS_ME_SITE="$HOME/Developer/erynwells.me"
}
init_site_environments "$@"

View file

@ -0,0 +1,9 @@
#!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me>
function init_website_environments
{
export ERYNWELLS_ME_SITE="$HOME/Developer/erynwells.me"
}
init_website_environments "$@"

View file

@ -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 "$@"

View file

@ -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",

View file

@ -0,0 +1,4 @@
---
- name: Rediscover package manager
ansible.builtin.setup:
gather_subset: pkg_mgr

View file

@ -0,0 +1,3 @@
---
- name: (macOS) Configure homebrew
ansible.builtin.include_tasks: homebrew.yml

View file

@ -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

View file

@ -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

View file

@ -0,0 +1,7 @@
---
- name: (emacs) Link emacs config
ansible.builtin.file:
path: ~/.emacs
src: "{{ role_path }}/files/emacs/emacs"
state: link
force: true

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -0,0 +1,11 @@
_dotfiles_core_packages:
- zsh
- git
- tmux
- neovim
_dotfiles_package_names:
homebrew:
_dotfiles_requires_become:
homebrew: false