Compare commits
10 commits
b454868ca8
...
d6bb7ae726
Author | SHA1 | Date | |
---|---|---|---|
d6bb7ae726 | |||
3b509c45d1 | |||
2c23fad3e8 | |||
6c6c7937c6 | |||
398c6f2d18 | |||
01312752fc | |||
bc4b9f8089 | |||
f7a29e3c1d | |||
65182a7c52 | |||
29e0b21a99 |
97 changed files with 324 additions and 30 deletions
16
Ansible/ansible.cfg
Normal file
16
Ansible/ansible.cfg
Normal 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
7
Ansible/local.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
- name: Local
|
||||
hosts: localhost
|
||||
tasks:
|
||||
- name: Set up dotfiles
|
||||
ansible.builtin.include_role:
|
||||
name: dotfiles
|
|
@ -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
|
||||
|
|
@ -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 "$@"
|
|
@ -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 "$@"
|
15
Ansible/roles/dotfiles/files/zsh/functions/weeknotes
Normal file
15
Ansible/roles/dotfiles/files/zsh/functions/weeknotes
Normal 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 "$@"
|
|
@ -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",
|
||||
|
|
4
Ansible/roles/dotfiles/handlers/main.yml
Normal file
4
Ansible/roles/dotfiles/handlers/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
- name: Rediscover package manager
|
||||
ansible.builtin.setup:
|
||||
gather_subset: pkg_mgr
|
3
Ansible/roles/dotfiles/tasks/darwin/bootstrap.yml
Normal file
3
Ansible/roles/dotfiles/tasks/darwin/bootstrap.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- name: (macOS) Configure homebrew
|
||||
ansible.builtin.include_tasks: homebrew.yml
|
37
Ansible/roles/dotfiles/tasks/darwin/homebrew.yml
Normal file
37
Ansible/roles/dotfiles/tasks/darwin/homebrew.yml
Normal 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
|
28
Ansible/roles/dotfiles/tasks/dotfiles.yml
Normal file
28
Ansible/roles/dotfiles/tasks/dotfiles.yml
Normal 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
|
7
Ansible/roles/dotfiles/tasks/emacs.yml
Normal file
7
Ansible/roles/dotfiles/tasks/emacs.yml
Normal 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
|
10
Ansible/roles/dotfiles/tasks/git.yml
Normal file
10
Ansible/roles/dotfiles/tasks/git.yml
Normal 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
|
|
@ -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
|
||||
|
|
25
Ansible/roles/dotfiles/tasks/mutt.yml
Normal file
25
Ansible/roles/dotfiles/tasks/mutt.yml
Normal 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
|
15
Ansible/roles/dotfiles/tasks/nethack.yml
Normal file
15
Ansible/roles/dotfiles/tasks/nethack.yml
Normal 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
|
13
Ansible/roles/dotfiles/tasks/packages.yml
Normal file
13
Ansible/roles/dotfiles/tasks/packages.yml
Normal 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
|
16
Ansible/roles/dotfiles/tasks/shell_utilities.yml
Normal file
16
Ansible/roles/dotfiles/tasks/shell_utilities.yml
Normal 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
|
33
Ansible/roles/dotfiles/tasks/vim.yml
Normal file
33
Ansible/roles/dotfiles/tasks/vim.yml
Normal 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
|
|
@ -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
|
||||
|
|
11
Ansible/roles/dotfiles/vars/main.yml
Normal file
11
Ansible/roles/dotfiles/vars/main.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
_dotfiles_core_packages:
|
||||
- zsh
|
||||
- git
|
||||
- tmux
|
||||
- neovim
|
||||
|
||||
_dotfiles_package_names:
|
||||
homebrew:
|
||||
|
||||
_dotfiles_requires_become:
|
||||
homebrew: false
|
Loading…
Add table
Add a link
Reference in a new issue