Ansible_workstation/tasks/dotfiles.yml

200 lines
5.4 KiB
YAML

---
- name: dotfiles -- Copying Xdefaults
template:
src: files/dotfiles/Xdefaults
dest: /home/{{ item.username }}/.Xdefaults
owner: "{{ item.username }}"
group: "{{ item.group }}"
with_items: "{{ dotusers }}"
# Tmux
- name: dotfiles -- Copy tmux.conf
template:
src: files/dotfiles/tmux.conf
dest: /home/{{ item.username }}/.tmux.conf
owner: "{{ item.username }}"
group: "{{ item.group }}"
with_items: "{{ dotusers }}"
# ZSH
- name: dotiles -- create and copy .config/zsh directory
copy:
src: files/dotfiles/zshrc
dest: /home/{{ item.username }}/.config/zsh/
owner: "{{ item.username }}"
mode: '0755'
with_items: "{{ dotusers }}"
when: prompt == 'zsh'
- name: dotfiles -- Copy local zshenv
template:
src: files/dotfiles/zshenv
dest: /home/{{ item.username }}/.zshenv
owner: "{{ item.username }}"
group: "{{ item.group }}"
with_items: "{{ dotusers }}"
when: prompt == 'zsh'
- name: dotiles -- clone zsh syntax-hightlighting
git:
repo: https://github.com/zsh-users/zsh-syntax-highlighting.git
dest: /home/{{ item.username }}/.config/zsh/zsh-syntax-highlighting
with_items: "{{ dotusers }}"
when: prompt == 'zsh'
- name: dotiles -- clone zsh autosuggestions
git:
repo: https://github.com/zsh-users/zsh-autosuggestions.git
dest: /home/{{ item.username }}/.config/zsh/zsh-autosuggestions
with_items: "{{ dotusers }}"
when: prompt == 'zsh'
- name: dotiles -- clone zsh zsh-history-substring-search
git:
repo: https://github.com/zsh-users/zsh-history-substring-search
dest: /home/{{ item.username }}/.config/zsh/zsh-history-substring-search
with_items: "{{ dotusers }}"
when: prompt == 'zsh'
- name: dotiles -- clone zsh auto-ls
git:
repo: https://github.com/desyncr/auto-ls
dest: /home/{{ item.username }}/.config/zsh/auto-ls
with_items: "{{ dotusers }}"
when: prompt == 'zsh'
- name: dotiles -- clone zsh pure prompt
git:
repo: https://github.com/sindresorhus/pure.git
dest: /home/{{ item.username }}/.config/zsh/pure
with_items: "{{ dotusers }}"
when: prompt == 'zsh'
# Fish config
- name: dotfiles -- Create fish config directory
file:
dest: /home/{{ item.username }}/.config/fish/
state: directory
with_items: "{{ dotusers }}"
when: prompt == 'fish'
- name: dotfiles -- Copy config.fish
template:
src: files/dotfiles/config.fish
dest: /home/{{ item.username }}/.config/fish/
owner: "{{ item.username }}"
group: "{{ item.group }}"
with_items: "{{ dotusers }}"
when: prompt == 'fish'
register: fishconfig
- name: dotfiles -- Copy fisher plugin list
template:
src: files/dotfiles/fishfile
dest: /home/{{ item.username }}/.config/fish/
owner: "{{ item.username }}"
group: "{{ item.group }}"
with_items: "{{ dotusers }}"
when: prompt == 'fish'
register: fishplugin
# Vim config
#
- name: dotfiles -- Copy .vim/
copy:
src: files/dotfiles/vim/
dest: /home/{{ item.username }}/.vim/
owner: "{{ item.username }}"
group: "{{ item.group }}"
with_items: "{{ dotusers }}"
- name: dotfiles -- Creates .vim/autoload/
file:
path: /home/{{ item.username }}/.vim/autoload/
state: directory
with_items: "{{ dotusers }}"
- name: dotfiles -- Download plug.vim
get_url:
url: https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
dest: /home/{{ item.username }}/.vim/autoload/plug.vim
owner: "{{ item.username }}"
group: "{{ item.group }}"
with_items: "{{ dotusers }}"
- name: dotfiles -- Copy vimrc
template:
src: files/dotfiles/vimrc
dest: /home/{{ item.username }}/.vimrc
owner: "{{ item.username }}"
group: "{{ item.group }}"
with_items: "{{ dotusers }}"
# Neovim config
- name: dotfiles -- Copy nvim config
copy:
src: files/dotfiles/nvim
dest: /home/{{ item.username }}/.config
owner: "{{ item.username }}"
group: "{{ item.group }}"
with_items: "{{ dotusers }}"
when: editor == 'nvim'
- name: dotfiles -- Download plug.vim for nvim
get_url:
url: https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
dest: /home/{{ item.username }}/.config/nvim/autoload/plug.vim
owner: "{{ item.username }}"
group: "{{ item.group }}"
with_items: "{{ dotusers }}"
when: editor == 'nvim'
# coc snippets
- name: dotfiles -- Copying snippets
copy:
src: files/dotfiles/ultisnips/
dest: /home/{{ item.username }}/.config/coc/ultisnips
owner: "{{ item.username }}"
group: "{{ item.group }}"
with_items: "{{ dotusers }}"
# Alacritty terminal
- name: dotfiles -- Copy alacritty config
copy:
src: files/dotfiles/alacritty
dest: /home/{{ item.username }}/.config
owner: "{{ item.username }}"
group: "{{ item.group }}"
with_items: "{{ dotusers }}"
# Ssh config
- name: dotfiles -- Creates .ssh
file:
path: /home/{{ item.username }}/.ssh/
state: directory
owner: "{{ item.username }}"
group: "{{ item.group }}"
with_items: "{{ dotusers }}"
when: not server
- name: dotfiles -- Copy ssh user config
template:
src: files/dotfiles/ssh/{{ item.ssh_config }}
dest: /home/{{ item.username }}/.ssh/config
owner: "{{ item.username }}"
group: "{{ item.group }}"
with_items: "{{ dotusers }}"
when: not server
# Git config
- name: dotfiles -- Copy gitconfig
template:
src: files/dotfiles/gitconfig
dest: /home/{{ item.username }}/.gitconfig
owner: "{{ item.username }}"
group: "{{ item.group }}"
with_items: "{{ dotusers }}"
when: not server