mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-12-22 12:51:39 +01:00
ansible: improve setup.yml playbook, formatting
This commit is contained in:
parent
4bf6198638
commit
66ca1af8b7
|
@ -4,26 +4,26 @@
|
|||
vars_files:
|
||||
- ../ansible-packages.yml
|
||||
vars:
|
||||
DOTFILES: "$HOME/.dotfiles"
|
||||
DOTFILES: '$HOME/.dotfiles'
|
||||
|
||||
tasks:
|
||||
- name: Install required system packages (debian)
|
||||
apt:
|
||||
install_recommends: no
|
||||
update_cache: yes
|
||||
pkg: "{{ packages + packages_debian }}"
|
||||
pkg: '{{ packages + packages_debian }}'
|
||||
when: ansible_facts['os_family'] == "Debian"
|
||||
|
||||
- name: Install required system packages (debian)
|
||||
pacman:
|
||||
update_cache: yes
|
||||
name: "{{ packages + packages_archlinux }}"
|
||||
name: '{{ packages + packages_archlinux }}'
|
||||
when: ansible_facts['os_family'] == "Archlinux"
|
||||
|
||||
- name: dotfiles repo
|
||||
git:
|
||||
repo: https://git.decapod.one/brethil/dotfiles
|
||||
dest: "{{ DOTFILES }}"
|
||||
dest: '{{ DOTFILES }}'
|
||||
version: master
|
||||
when: local_development is not defined
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
|||
|
||||
- name: zsh as default shell
|
||||
user:
|
||||
name: "{{ ansible_user }}"
|
||||
name: '{{ ansible_user }}'
|
||||
shell: /usr/bin/zsh
|
||||
|
||||
- name: zsh config
|
||||
|
@ -46,21 +46,21 @@
|
|||
echo "export DOTFILES={{ DOTFILES }}" >> "$HOME/.zshrc"
|
||||
echo 'source $DOTFILES/brethil_dotfile.sh' >> "$HOME/.zshrc"
|
||||
args:
|
||||
creates: "~{{ ansible_user }}/.zshrc"
|
||||
creates: '~{{ ansible_user }}/.zshrc'
|
||||
|
||||
- name: dotfiles symlink
|
||||
file:
|
||||
src: "{{ DOTFILES }}/{{ item.key }}"
|
||||
dest: "{{ item.value }}"
|
||||
src: '{{ DOTFILES }}/{{ item.key }}'
|
||||
dest: '{{ item.value }}'
|
||||
state: link
|
||||
force: yes
|
||||
loop: "{{ files | dict2items }}"
|
||||
loop: '{{ files | dict2items }}'
|
||||
vars:
|
||||
files:
|
||||
"vim/vimrc": "~/.vimrc"
|
||||
"pdbrc.py": "~/.pdbrc.py"
|
||||
'vim/vimrc': '~/.vimrc'
|
||||
'pdbrc.py': '~/.pdbrc.py'
|
||||
# "ipython": "~/.ipython" # FIXME: ipython config is more complex
|
||||
"ansible/ansible.cfg": "~/.ansible.cfg"
|
||||
'ansible/ansible.cfg': '~/.ansible.cfg'
|
||||
|
||||
- name: check undodir_migration
|
||||
stat: path=${HOME}/.vim_runtime/temp_dirs/undodir
|
||||
|
@ -71,20 +71,21 @@
|
|||
when: undodir.stat.exists
|
||||
|
||||
- name: vim plugins install
|
||||
command: DOTFILES={{ DOTFILES }} vim -c 'PlugInstall|qa!'
|
||||
# Open vim once so that the plugins are installed
|
||||
command: echo | env DOTFILES={{ DOTFILES }} vim
|
||||
|
||||
- name: git config facts
|
||||
community.general.git_config:
|
||||
name: "include.path"
|
||||
name: 'include.path'
|
||||
scope: global
|
||||
register: config_value
|
||||
- debug:
|
||||
msg: "Git config include.path={{ config_value }}"
|
||||
msg: 'Git config include.path={{ config_value }}'
|
||||
|
||||
- name: git config
|
||||
community.general.git_config:
|
||||
name: "include.path"
|
||||
value: "{{ DOTFILES }}/gitconfig"
|
||||
name: 'include.path'
|
||||
value: '{{ DOTFILES }}/gitconfig'
|
||||
scope: global
|
||||
when: config_value is not defined
|
||||
|
||||
|
@ -94,7 +95,7 @@
|
|||
dest: ~/.gitignore
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0600"
|
||||
mode: '0600'
|
||||
backup: yes
|
||||
|
||||
- name: annoyances
|
||||
|
@ -112,12 +113,12 @@
|
|||
|
||||
- name: directories
|
||||
file:
|
||||
dest: "{{ item }}"
|
||||
dest: '{{ item }}'
|
||||
state: directory
|
||||
mode: 0700
|
||||
loop: "{{ directories }}"
|
||||
loop: '{{ directories }}'
|
||||
vars:
|
||||
directories:
|
||||
- "$HOME/bin"
|
||||
- "$HOME/projects"
|
||||
- "$HOME/git"
|
||||
- '$HOME/bin'
|
||||
- '$HOME/projects'
|
||||
- '$HOME/git'
|
||||
|
|
|
@ -79,3 +79,8 @@ if isdirectory(vim_razer)
|
|||
Plug vim_razer
|
||||
endif
|
||||
call plug#end()
|
||||
|
||||
" Install plugins if missing
|
||||
if ! isdirectory(expand('~/.vim/vim-plug'))
|
||||
PlugInstall
|
||||
endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user