[TIDY] Move to ansible_facts dict instead of injected variables

This commit is contained in:
Jannik Beyerstedt 2025-11-28 11:10:58 +01:00
parent 9f0226856e
commit 36455b7f76
18 changed files with 69 additions and 69 deletions

View file

@ -15,13 +15,13 @@
- 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"
dest: "{{ ansible_facts['user_dir'] }}/.oh-my-zsh"
diff: false
- name: Usersettings - Install/ Update fzf sources
ansible.builtin.git:
repo: https://github.com/junegunn/fzf.git
dest: "{{ ansible_user_dir }}/.fzf"
dest: "{{ ansible_facts['user_dir'] }}/.fzf"
register: fzf_git
diff: false
- name: (Re-)Install fzf
@ -35,8 +35,8 @@
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"
(override_os_family is defined) | ternary(override_os_family,ansible_facts['os_family']) != "Darwin" and
(override_os_family is defined) | ternary(override_os_family,ansible_facts['os_family']) != "FreeBSD"
become: true
ignore_errors: true # just fail on systems without sudo access
ansible.builtin.package:
@ -47,21 +47,21 @@
- python3-pip
diff: false
- name: Usersettings - Install pip virtualenvwrapper (Debian)
when: (override_os_family is defined) | ternary(override_os_family,ansible_os_family) == "Debian"
when: (override_os_family is defined) | ternary(override_os_family,ansible_facts['os_family']) == "Debian"
become: true
ansible.builtin.pip:
name: virtualenvwrapper
extra_args: --system
- name: Usersettings - Install pip virtualenvwrapper (macOS)
when: (override_os_family is defined) | ternary(override_os_family,ansible_os_family) == "Darwin"
when: (override_os_family is defined) | ternary(override_os_family,ansible_facts['os_family']) == "Darwin"
environment:
PATH: "/usr/local/bin:{{ ansible_env.PATH }}"
PATH: "/usr/local/bin:{{ ansible_facts['env']['PATH'] }}"
ansible.builtin.pip:
name: virtualenvwrapper
- name: Usersettings - Install pip virtualenvwrapper (CentOS, ArchLinux)
when:
(override_os_family is defined) | ternary(override_os_family,ansible_os_family) == "Centos" or
(override_os_family is defined) | ternary(override_os_family,ansible_os_family) == "Archlinux"
(override_os_family is defined) | ternary(override_os_family,ansible_facts['os_family']) == "Centos" or
(override_os_family is defined) | ternary(override_os_family,ansible_facts['os_family']) == "Archlinux"
become: true
ansible.builtin.pip:
name: virtualenvwrapper
@ -73,15 +73,15 @@
with_items:
- {
src: "{{ role_path }}/files/_gitignore_global",
dest: "{{ ansible_user_dir }}/.gitignore_global",
dest: "{{ ansible_facts['user_dir'] }}/.gitignore_global",
}
- {
src: "{{ role_path }}/files/_config/mpv.conf",
dest: "{{ ansible_user_dir }}/.config/mpv/",
dest: "{{ ansible_facts['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",
dest: "{{ ansible_facts['user_dir'] }}/.oh-my-zsh/custom/themes/jtbx.zsh-theme",
}
- name: Usersettings - Create some directories
ansible.builtin.file:
@ -89,7 +89,7 @@
state: directory
mode: "0755"
with_items:
- "{{ ansible_user_dir }}/.config/htop/"
- "{{ ansible_facts['user_dir'] }}/.config/htop/"
- name: Usersettings - Set templated dotfiles
ansible.builtin.template:
src: "{{ item.src }}"
@ -100,29 +100,29 @@
with_items:
- {
src: "{{ role_path }}/templates/_zshrc.j2",
dest: "{{ ansible_user_dir }}/.zshrc",
dest: "{{ ansible_facts['user_dir'] }}/.zshrc",
force: true,
}
- {
src: "{{ role_path }}/templates/_tmux.conf.j2",
dest: "{{ ansible_user_dir }}/.tmux.conf",
dest: "{{ ansible_facts['user_dir'] }}/.tmux.conf",
force: true,
}
- {
src: "{{ role_path }}/templates/_vimrc.j2",
dest: "{{ ansible_user_dir }}/.vimrc",
dest: "{{ ansible_facts['user_dir'] }}/.vimrc",
force: true,
}
- {
src: "{{ role_path }}/templates/htoprc.j2",
dest: "{{ ansible_user_dir }}/.config/htop/htoprc",
dest: "{{ ansible_facts['user_dir'] }}/.config/htop/htoprc",
force: false,
}
- name: Usersettings - Set global gitconfig
when: usersetup_gitconfig
ansible.builtin.template:
src: "{{ role_path }}/templates/_gitconfig.j2"
dest: "{{ ansible_user_dir }}/.gitconfig"
dest: "{{ ansible_facts['user_dir'] }}/.gitconfig"
mode: "0644"
- name: Usersettings - Vim Plugings
@ -130,13 +130,13 @@
block:
- name: Usersettings - Create .vim directory
ansible.builtin.file:
path: "{{ ansible_user_dir }}/.vim/autoload"
path: "{{ ansible_facts['user_dir'] }}/.vim/autoload"
state: directory
mode: "0755"
- name: Usersettings - Install vim plugin manager
ansible.builtin.get_url:
url: https://tpo.pe/pathogen.vim
dest: "{{ ansible_user_dir }}/.vim/autoload/pathogen.vim"
dest: "{{ ansible_facts['user_dir'] }}/.vim/autoload/pathogen.vim"
mode: "0644"
- name: Usersettings - Install vim plugins
ansible.builtin.git:
@ -146,22 +146,22 @@
with_items:
- {
repo: "https://github.com/itchyny/lightline.vim",
dest: "{{ ansible_user_dir }}/.vim/bundle/lightline",
dest: "{{ ansible_facts['user_dir'] }}/.vim/bundle/lightline",
}
- {
repo: "https://github.com/w0rp/ale",
dest: "{{ ansible_user_dir }}/.vim/bundle/ale",
dest: "{{ ansible_facts['user_dir'] }}/.vim/bundle/ale",
}
- {
repo: "https://github.com/airblade/vim-gitgutter",
dest: "{{ ansible_user_dir }}/.vim/bundle/vim-gitgutter",
dest: "{{ ansible_facts['user_dir'] }}/.vim/bundle/vim-gitgutter",
}
- {
repo: "https://github.com/sheerun/vim-polyglot",
dest: "{{ ansible_user_dir }}/.vim/bundle/vim-polyglot",
dest: "{{ ansible_facts['user_dir'] }}/.vim/bundle/vim-polyglot",
}
- {
repo: "https://github.com/tpope/vim-commentary",
dest: "{{ ansible_user_dir }}/.vim/bundle/vim-commentary",
dest: "{{ ansible_facts['user_dir'] }}/.vim/bundle/vim-commentary",
}
# TODO: https://github.com/jan-warchol/selenized