Feat: dotusers for dotfiles

This commit is contained in:
Bertrand Benjamin 2020-07-17 08:42:50 +02:00
parent bcee9f6cbb
commit 6e8fe24562
3 changed files with 76 additions and 72 deletions

View File

@ -2,10 +2,10 @@
- name: dotfiles -- Copy tmux.conf - name: dotfiles -- Copy tmux.conf
template: template:
src: files/dotfiles/tmux.conf src: files/dotfiles/tmux.conf
dest: /home/{{ me.username }}/.tmux.conf dest: /home/{{ item.username }}/.tmux.conf
owner: "{{ me.username }}" owner: "{{ item.username }}"
group: "{{ me.group }}" group: "{{ item.group }}"
when: me in users with_items: "{{ dotusers }}"
# Zsh config # Zsh config
- name: dotfiles -- Download antibody - name: dotfiles -- Download antibody
@ -28,50 +28,56 @@
- name: dotfiles -- Copy local zshrc - name: dotfiles -- Copy local zshrc
template: template:
src: files/dotfiles/zshrc src: files/dotfiles/zshrc
dest: /home/{{ me.username }}/.zshrc dest: /home/{{ item.username }}/.zshrc
owner: "{{ me.username }}" owner: "{{ item.username }}"
group: "{{ me.group }}" group: "{{ item.group }}"
when: prompt == 'zsh' and me in users with_items: "{{ dotusers }}"
when: prompt == 'zsh'
- name: dotfiles -- Copy local zshrc.local - name: dotfiles -- Copy local zshrc.local
template: template:
src: files/dotfiles/zshrc.local src: files/dotfiles/zshrc.local
dest: /home/{{ me.username }}/.zshrc.local dest: /home/{{ item.username }}/.zshrc.local
owner: "{{ me.username }}" owner: "{{ item.username }}"
group: "{{ me.group }}" group: "{{ item.group }}"
when: prompt == 'zsh' and me in users with_items: "{{ dotusers }}"
when: prompt == 'zsh'
- name: dotfiles -- Copy local zsh_plugins.txt - name: dotfiles -- Copy local zsh_plugins.txt
template: template:
src: files/dotfiles/zsh_plugins.txt src: files/dotfiles/zsh_plugins.txt
dest: /home/{{ me.username }}/.zsh_plugins.txt dest: /home/{{ item.username }}/.zsh_plugins.txt
owner: "{{ me.username }}" owner: "{{ item.username }}"
group: "{{ me.group }}" group: "{{ item.group }}"
when: prompt == 'zsh' and me in users with_items: "{{ dotusers }}"
when: prompt == 'zsh'
# Fish config # Fish config
- name: dotfiles -- Create fish config directory - name: dotfiles -- Create fish config directory
file: file:
dest: /home/{{ me.username }}/.config/fish/ dest: /home/{{ item.username }}/.config/fish/
state: directory state: directory
when: prompt == 'fish' and me in users with_items: "{{ dotusers }}"
when: prompt == 'fish'
- name: dotfiles -- Copy config.fish - name: dotfiles -- Copy config.fish
template: template:
src: files/dotfiles/config.fish src: files/dotfiles/config.fish
dest: /home/{{ me.username }}/.config/fish/ dest: /home/{{ item.username }}/.config/fish/
owner: "{{ me.username }}" owner: "{{ item.username }}"
group: "{{ me.group }}" group: "{{ item.group }}"
when: prompt == 'fish' and me in users with_items: "{{ dotusers }}"
when: prompt == 'fish'
register: fishconfig register: fishconfig
- name: dotfiles -- Copy fisher plugin list - name: dotfiles -- Copy fisher plugin list
template: template:
src: files/dotfiles/fishfile src: files/dotfiles/fishfile
dest: /home/{{ me.username }}/.config/fish/ dest: /home/{{ item.username }}/.config/fish/
owner: "{{ me.username }}" owner: "{{ item.username }}"
group: "{{ me.group }}" group: "{{ item.group }}"
when: prompt == 'fish' and me in users with_items: "{{ dotusers }}"
when: prompt == 'fish'
register: fishplugin register: fishplugin
# Vim config # Vim config
@ -79,89 +85,86 @@
- name: dotfiles -- Copy .vim/ - name: dotfiles -- Copy .vim/
copy: copy:
src: files/dotfiles/vim/ src: files/dotfiles/vim/
dest: /home/{{ me.username }}/.vim/ dest: /home/{{ item.username }}/.vim/
owner: "{{ me.username }}" owner: "{{ item.username }}"
group: "{{ me.group }}" group: "{{ item.group }}"
when: me in users with_items: "{{ dotusers }}"
- name: dotfiles -- Creates .vim/autoload/ - name: dotfiles -- Creates .vim/autoload/
file: file:
path: /home/{{ me.username }}/.vim/autoload/ path: /home/{{ item.username }}/.vim/autoload/
state: directory state: directory
when: me in users with_items: "{{ dotusers }}"
- name: dotfiles -- Download plug.vim - name: dotfiles -- Download plug.vim
get_url: get_url:
url: https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim url: https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
dest: /home/{{ me.username }}/.vim/autoload/plug.vim dest: /home/{{ item.username }}/.vim/autoload/plug.vim
owner: "{{ me.username }}" owner: "{{ item.username }}"
group: "{{ me.group }}" group: "{{ item.group }}"
when: me in users with_items: "{{ dotusers }}"
- name: dotfiles -- Copy vimrc - name: dotfiles -- Copy vimrc
template: template:
src: files/dotfiles/vimrc src: files/dotfiles/vimrc
dest: /home/{{ me.username }}/.vimrc dest: /home/{{ item.username }}/.vimrc
owner: "{{ me.username }}" owner: "{{ item.username }}"
group: "{{ me.group }}" group: "{{ item.group }}"
when: me in users with_items: "{{ dotusers }}"
# Neovim config # Neovim config
- name: dotfiles -- Copy nvim config - name: dotfiles -- Copy nvim config
copy: copy:
src: files/dotfiles/nvim src: files/dotfiles/nvim
dest: /home/{{ me.username }}/.config dest: /home/{{ item.username }}/.config
owner: "{{ me.username }}" owner: "{{ item.username }}"
group: "{{ me.group }}" group: "{{ item.group }}"
when: editor == 'nvim' and me in users with_items: "{{ dotusers }}"
when: editor == 'nvim'
- name: dotfiles -- Download plug.vim for nvim - name: dotfiles -- Download plug.vim for nvim
get_url: get_url:
url: https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim url: https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
dest: /home/{{ me.username }}/.config/nvim/autoload/plug.vim dest: /home/{{ item.username }}/.config/nvim/autoload/plug.vim
owner: "{{ me.username }}" owner: "{{ item.username }}"
group: "{{ me.group }}" group: "{{ item.group }}"
when: editor == 'nvim' and me in users with_items: "{{ dotusers }}"
when: editor == 'nvim'
# Alacritty terminal # Alacritty terminal
- name: dotfiles -- Copy alacritty config - name: dotfiles -- Copy alacritty config
copy: copy:
src: files/dotfiles/alacritty src: files/dotfiles/alacritty
dest: /home/{{ me.username }}/.config dest: /home/{{ item.username }}/.config
owner: "{{ me.username }}" owner: "{{ item.username }}"
group: "{{ me.group }}" group: "{{ item.group }}"
when: me in users with_items: "{{ dotusers }}"
# Ssh config # Ssh config
- name: dotfiles -- Creates .ssh - name: dotfiles -- Creates .ssh
file: file:
path: /home/{{ me.username }}/.ssh/ path: /home/{{ item.username }}/.ssh/
state: directory state: directory
owner: "{{ me.username }}" owner: "{{ item.username }}"
group: "{{ me.group }}" group: "{{ item.group }}"
when: me in users with_items: "{{ dotusers }}"
- name: dotfiles -- Copy ssh user config
template:
src: files/dotfiles/ssh/config_deploy
dest: /home/{{ admin.username }}/.ssh/config
owner: "{{ admin.username }}"
group: "{{ admin.group }}"
when: not server when: not server
- name: dotfiles -- Copy ssh user config - name: dotfiles -- Copy ssh user config
template: template:
src: files/dotfiles/ssh/config_me src: files/dotfiles/ssh/{{ item.ssh_config }}
dest: /home/{{ me.username }}/.ssh/config dest: /home/{{ item.username }}/.ssh/config
owner: "{{ me.username }}" owner: "{{ item.username }}"
group: "{{ me.group }}" group: "{{ item.group }}"
when: me in users with_items: "{{ dotusers }}"
when: not server
# Git config # Git config
- name: dotfiles -- Copy gitconfig - name: dotfiles -- Copy gitconfig
template: template:
src: files/dotfiles/gitconfig src: files/dotfiles/gitconfig
dest: /home/{{ me.username }}/.gitconfig dest: /home/{{ item.username }}/.gitconfig
owner: "{{ me.username }}" owner: "{{ item.username }}"
group: "{{ me.group }}" group: "{{ item.group }}"
when: me in users with_items: "{{ dotusers }}"
when: not server

View File

@ -1,5 +1,6 @@
--- ---
users: ["{{ admin }}", "{{ content }}"] users: ["{{ admin }}", "{{ content }}"]
dotusers: ["{{ admin }}"]
minimal: true minimal: true
server: true server: true