ansible-role-common/tasks/usersettings.yml

155 lines
5.3 KiB
YAML
Raw Permalink Normal View History

---
# Common/Usersettings: Universial Dotfiles. Update regularly.
- name: usersettings - Install required tools
become: true
ignore_errors: true # just fail on systems without sudo access
ansible.builtin.package:
name: "{{ packages }}"
state: present
vars:
packages:
- git
2019-10-10 14:49:55 +00:00
- name: usersettings - Install/ Update oh-my-zsh for current user
ansible.builtin.git:
repo: https://github.com/robbyrussell/oh-my-zsh.git
dest: "{{ ansible_user_dir }}/.oh-my-zsh"
- name: usersettings - Install/ Update fzf sources
ansible.builtin.git:
repo: https://github.com/junegunn/fzf.git
dest: "{{ ansible_user_dir }}/.fzf"
2019-11-12 20:42:58 +00:00
register: fzf_git
- name: (Re-)Install fzf
when:
- fzf_git.after != fzf_git.before
ansible.builtin.shell: ".fzf/install --key-bindings --no-completion --no-update-rc"
- name: usersettings - Install pip virtualenvwrapper
when: usersetup_virtualenvwrapper
block:
- name: usersettings - Install pip3
when:
(override_os_family is defined) | ternary(override_os_family,ansible_os_family) != "Darwin" and
(override_os_family is defined) | ternary(override_os_family,ansible_os_family) != "FreeBSD"
become: true
ignore_errors: true # just fail on systems without sudo access
ansible.builtin.package:
name: "{{ packages }}"
state: present
vars:
packages:
- python3-pip
2023-08-04 16:47:11 +00:00
- name: usersettings - Install pip virtualenvwrapper (Debian, Archlinux)
when:
(override_os_family is defined) | ternary(override_os_family,ansible_os_family) == "Debian" or
(override_os_family is defined) | ternary(override_os_family,ansible_os_family) == "Archlinux"
become: true
2023-08-04 16:47:11 +00:00
ansible.builtin.package:
name: python-virtualenvwrapper
- name: usersettings - Install pip virtualenvwrapper (macOS)
when: (override_os_family is defined) | ternary(override_os_family,ansible_os_family) == "Darwin"
environment:
PATH: "/usr/local/bin:{{ ansible_env.PATH }}"
ansible.builtin.pip:
name: virtualenvwrapper
- name: usersettings - Install pip virtualenvwrapper (CentOS, ArchLinux)
when:
2023-08-04 16:47:11 +00:00
(override_os_family is defined) | ternary(override_os_family,ansible_os_family) == "Centos"
become: true
ansible.builtin.pip:
name: virtualenvwrapper
- name: usersettings - Copy dotfiles
ansible.builtin.copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
with_items:
- {
src: "{{ role_path }}/files/_gitignore_global",
dest: "{{ ansible_user_dir }}/.gitignore_global",
}
2022-08-06 11:22:37 +00:00
- {
src: "{{ role_path }}/files/_config/mpv.conf",
dest: "{{ ansible_user_dir }}/.config/mpv/",
}
- {
src: "{{ role_path }}/files/_oh-my-zsh/jtbx.zsh-theme",
dest: "{{ ansible_user_dir }}/.oh-my-zsh/custom/themes/jtbx.zsh-theme",
}
- name: usersettings - Create some directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
with_items:
- "{{ ansible_user_dir }}/.config/htop/"
- name: usersettings - Set templated dotfiles
ansible.builtin.template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
force: "{{ item.force }}"
ignore_errors: true
with_items:
- {
src: "{{ role_path }}/templates/_zshrc.j2",
dest: "{{ ansible_user_dir }}/.zshrc",
force: yes,
}
- {
src: "{{ role_path }}/templates/_tmux.conf.j2",
dest: "{{ ansible_user_dir }}/.tmux.conf",
force: yes,
}
- {
src: "{{ role_path }}/templates/_vimrc.j2",
dest: "{{ ansible_user_dir }}/.vimrc",
force: yes,
}
- {
src: "{{ role_path }}/templates/htoprc.j2",
dest: "{{ ansible_user_dir }}/.config/htop/htoprc",
force: no,
}
- name: usersettings - Set global gitconfig
when: usersetup_gitconfig == true
ansible.builtin.template:
src: "{{ role_path }}/templates/_gitconfig.j2"
dest: "{{ ansible_user_dir }}/.gitconfig"
- name: usersettings - Vim Plugings
when: usersetup_vimplugins == true
block:
- name: usersettings - Create .vim directory
ansible.builtin.file:
path: "{{ ansible_user_dir }}/.vim/autoload"
state: directory
- name: usersettings - Install vim plugin manager
ansible.builtin.get_url:
url: https://tpo.pe/pathogen.vim
dest: "{{ ansible_user_dir }}/.vim/autoload/pathogen.vim"
- name: usersettings - Install vim plugins
ansible.builtin.git:
repo: "{{ item.repo }}"
dest: "{{ item.dest }}"
with_items:
- {
repo: "https://github.com/itchyny/lightline.vim",
dest: "{{ ansible_user_dir }}/.vim/bundle/lightline",
}
- {
repo: "https://github.com/w0rp/ale",
dest: "{{ ansible_user_dir }}/.vim/bundle/ale",
}
- {
repo: "https://github.com/airblade/vim-gitgutter",
dest: "{{ ansible_user_dir }}/.vim/bundle/vim-gitgutter",
}
- {
repo: "https://github.com/sheerun/vim-polyglot",
dest: "{{ ansible_user_dir }}/.vim/bundle/vim-polyglot",
}
- {
repo: "https://github.com/tpope/vim-commentary",
dest: "{{ ansible_user_dir }}/.vim/bundle/vim-commentary",
}