Ansible: another take a using Ansible to set up dotfiles

This commit is contained in:
Eryn Wells 2025-01-31 16:27:22 -08:00
parent be6b93cdde
commit 72896c3feb
6 changed files with 62 additions and 0 deletions

View file

@ -0,0 +1,3 @@
---
- name: Configure ZSH
import_tasks: zsh.yml

View file

@ -0,0 +1,8 @@
---
- name: "Symlink {{ dotfile_src }}"
ansible.builtin.file:
src: "{{ ansible_local.dotfiles.path }}/{{ dotfile_src }}"
dest: "~/.{{ dotfile_dest | default(dotfile_src) }}"
owner: "{{ ansible_user_id }}"
mode: 0644
state: link

View file

@ -0,0 +1,34 @@
---
- name: "zsh : Set user shell"
ansible.builtin.user:
name: "{{ ansible_user_id }}"
shell: /bin/zsh
state: present
- name: "zsh : Symlink startup files"
ansible.builtin.include_tasks: symlink_dotfile.yml
vars:
dotfile_src: "{{ item.src | default(item) }}"
dotfile_dest: "{{ item.dest | default(item) }}"
loop:
- zshenv
- zshrc
- zprofile
- name: "zsh : Install user functions"
block:
- name: "zsh : Create zsh directory"
ansible.builtin.file:
path: "{{ _zsh_dir }}"
owner: "{{ ansible_user_id }}"
mode: 0755
state: directory
- name: "zsh : Symlink functions directory"
ansible.builtin.include_tasks: symlink_dotfile.yml
vars:
dotfile_src: "{{ item }}"
loop:
- zsh/func
vars:
_zsh_dir: "~/.zsh"