[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

@ -17,8 +17,8 @@ Role Variables
-------------- --------------
This role uses the apt package manager on Debian based hosts. This role uses the apt package manager on Debian based hosts.
But for some operating systems the `ansible_os_family` variable is not set to "Debian" by the fact gathering even if it is Debian based (like Mendel GNU/Linux on the Google Coral Dev Board). But for some operating systems the `ansible_facts['os_family']` variable is not set to "Debian" by the fact gathering even if it is Debian based (like Mendel GNU/Linux on the Google Coral Dev Board).
- `override_os_family`: Set to "Debian" in the host inventory, if `ansible_os_family` is not set correctly - `override_os_family`: Set to "Debian" in the host inventory, if `ansible_facts['os_family']` is not set correctly
On macOS, it might be needed to specify the full path to the pip3 executable: On macOS, it might be needed to specify the full path to the pip3 executable:
- `override_pip_exe`: Set a custom pip executable (default: n.a.) - `override_pip_exe`: Set a custom pip executable (default: n.a.)
@ -38,7 +38,7 @@ For a GUI/ Desktop machine, you can enable to install and configure VS Code:
- `user_lang_cpp`: Boolean to install C/C++ dev tools and configure VS Code (default: false) - `user_lang_cpp`: Boolean to install C/C++ dev tools and configure VS Code (default: false)
- `user_lang_python`: Boolean to install Python dev tools and configure VS Code (default: false) - `user_lang_python`: Boolean to install Python dev tools and configure VS Code (default: false)
- `user_lang_golang`: Boolean to install Golang dev tools and configure VS Code (default: false) - `user_lang_golang`: Boolean to install Golang dev tools and configure VS Code (default: false)
* `user_lang_golang_gopath`: Install path for golang (default: "{{ ansible_user_dir }}/Development/go") * `user_lang_golang_gopath`: Install path for golang (default: "{{ ansible_facts['user_dir'] }}/Development/go")
- `user_lang_latex`: Boolean to install a LaTeX distribution and configure VS Code (default: false) - `user_lang_latex`: Boolean to install a LaTeX distribution and configure VS Code (default: false)
By default, this role will run updates, install some essential tools, set up the user's shell and copy the dotfiles. By default, this role will run updates, install some essential tools, set up the user's shell and copy the dotfiles.

View file

@ -23,5 +23,5 @@ user_vscode: false
user_lang_cpp: false user_lang_cpp: false
user_lang_python: false user_lang_python: false
user_lang_golang: false user_lang_golang: false
user_lang_golang_gopath: "{{ ansible_user_dir }}/Development/go" user_lang_golang_gopath: "{{ ansible_facts['user_dir'] }}/Development/go"
user_lang_latex: false user_lang_latex: false

View file

@ -35,13 +35,13 @@
diff: false diff: false
- name: VSCode - Basics - Create settings directory - name: VSCode - Basics - Create settings directory
ansible.builtin.file: ansible.builtin.file:
path: "{{ ansible_user_dir }}/.config/Code/User" path: "{{ ansible_facts['user_dir'] }}/.config/Code/User"
state: directory state: directory
mode: "0755" mode: "0755"
- name: VSCode - Basics - Copy global settings - name: VSCode - Basics - Copy global settings
ansible.builtin.copy: ansible.builtin.copy:
src: "{{ role_path }}/files/vscode-settings.json" src: "{{ role_path }}/files/vscode-settings.json"
dest: "{{ ansible_user_dir }}/.config/Code/User/settings.json" dest: "{{ ansible_facts['user_dir'] }}/.config/Code/User/settings.json"
mode: "0644" mode: "0644"
# Dev Env - C/C++ Development Tools # Dev Env - C/C++ Development Tools

View file

@ -33,13 +33,13 @@
# - graphviz # - graphviz
- name: VSCode - Basics - Create settings directory - name: VSCode - Basics - Create settings directory
ansible.builtin.file: ansible.builtin.file:
path: "{{ ansible_user_dir }}/Library/Application Support/Code/User" path: "{{ ansible_facts['user_dir'] }}/Library/Application Support/Code/User"
state: directory state: directory
mode: "0755" mode: "0755"
- name: VSCode - Basics - Copy global settings - name: VSCode - Basics - Copy global settings
ansible.builtin.copy: ansible.builtin.copy:
src: "{{ role_path }}/files/vscode-settings.json" src: "{{ role_path }}/files/vscode-settings.json"
dest: "{{ ansible_user_dir }}/Library/Application Support/Code/User/settings.json" dest: "{{ ansible_facts['user_dir'] }}/Library/Application Support/Code/User/settings.json"
mode: "0644" mode: "0644"
# Dev Env - C/C++ Development Tools # Dev Env - C/C++ Development Tools

View file

@ -44,13 +44,13 @@
diff: false diff: false
- name: VSCode - Basics - Create settings directory - name: VSCode - Basics - Create settings directory
ansible.builtin.file: ansible.builtin.file:
path: "{{ ansible_user_dir }}/.config/Code/User" path: "{{ ansible_facts['user_dir'] }}/.config/Code/User"
state: directory state: directory
mode: "0755" mode: "0755"
- name: VSCode - Basics - Copy global settings - name: VSCode - Basics - Copy global settings
ansible.builtin.copy: ansible.builtin.copy:
src: "{{ role_path }}/files/vscode-settings.json" src: "{{ role_path }}/files/vscode-settings.json"
dest: "{{ ansible_user_dir }}/.config/Code/User/settings.json" dest: "{{ ansible_facts['user_dir'] }}/.config/Code/User/settings.json"
mode: "0644" mode: "0644"
# Dev Env - C/C++ Development Tools # Dev Env - C/C++ Development Tools

View file

@ -16,8 +16,8 @@
- name: VSCode - Install and configure VS Code - name: VSCode - Install and configure VS Code
ansible.builtin.include_tasks: "{{ item }}" ansible.builtin.include_tasks: "{{ item }}"
with_first_found: with_first_found:
- "devel-{{ ansible_distribution }}.yml" - "devel-{{ ansible_facts['distribution'] }}.yml"
- "devel-{{ (override_os_family is defined) | ternary(override_os_family, ansible_os_family) }}.yml" - "devel-{{ (override_os_family is defined) | ternary(override_os_family, ansible_facts['os_family']) }}.yml"
# Install Visual Studio Code and Set Basic Configuration # Install Visual Studio Code and Set Basic Configuration
- name: VSCode - Basics - name: VSCode - Basics
@ -73,18 +73,18 @@
mode: "0755" mode: "0755"
- name: Devel - Golang - Create zshrc-host - name: Devel - Golang - Create zshrc-host
ansible.builtin.file: ansible.builtin.file:
path: "{{ ansible_user_dir }}/.zshrc-host" path: "{{ ansible_facts['user_dir'] }}/.zshrc-host"
state: touch state: touch
mode: "0644" mode: "0644"
- name: Devel - Golang - Add GOPATH - name: Devel - Golang - Add GOPATH
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: "{{ ansible_user_dir }}/.zshrc-host" path: "{{ ansible_facts['user_dir'] }}/.zshrc-host"
line: "export GOPATH={{ user_lang_golang_gopath }}" line: "export GOPATH={{ user_lang_golang_gopath }}"
state: present state: present
backup: true backup: true
- name: Devel - Golang - Add go bin to PATH - name: Devel - Golang - Add go bin to PATH
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: "{{ ansible_user_dir }}/.zshrc-host" path: "{{ ansible_facts['user_dir'] }}/.zshrc-host"
line: "export PATH=$PATH:{{ user_lang_golang_gopath }}/bin" line: "export PATH=$PATH:{{ user_lang_golang_gopath }}/bin"
state: present state: present
backup: true backup: true

View file

@ -4,5 +4,5 @@
- name: Essentials - Install essential utilities - name: Essentials - Install essential utilities
ansible.builtin.include_tasks: "{{ item }}" ansible.builtin.include_tasks: "{{ item }}"
with_first_found: with_first_found:
- "essentials-{{ ansible_distribution }}.yml" - "essentials-{{ ansible_facts['distribution'] }}.yml"
- "essentials-{{ (override_os_family is defined) | ternary(override_os_family, ansible_os_family) }}.yml" - "essentials-{{ (override_os_family is defined) | ternary(override_os_family, ansible_facts['os_family']) }}.yml"

View file

@ -4,5 +4,5 @@
- name: Tools - Install basic utilities - name: Tools - Install basic utilities
ansible.builtin.include_tasks: "{{ item }}" ansible.builtin.include_tasks: "{{ item }}"
with_first_found: with_first_found:
- "tools-{{ ansible_distribution }}.yml" - "tools-{{ ansible_facts['distribution'] }}.yml"
- "tools-{{ (override_os_family is defined) | ternary(override_os_family, ansible_os_family) }}.yml" - "tools-{{ (override_os_family is defined) | ternary(override_os_family, ansible_facts['os_family']) }}.yml"

View file

@ -4,6 +4,6 @@
- name: Update - Update and upgrade all packages - name: Update - Update and upgrade all packages
ansible.builtin.include_tasks: "{{ item }}" ansible.builtin.include_tasks: "{{ item }}"
with_first_found: with_first_found:
- "update-{{ ansible_distribution }}.yml" - "update-{{ ansible_facts['distribution'] }}.yml"
- "update-{{ (override_os_family is defined) | ternary(override_os_family, ansible_os_family) }}.yml" - "update-{{ (override_os_family is defined) | ternary(override_os_family, ansible_facts['os_family']) }}.yml"
ignore_errors: true ignore_errors: true

View file

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

View file

@ -4,7 +4,7 @@
- name: Usersetup - Check, if usersetup already ran - name: Usersetup - Check, if usersetup already ran
ansible.builtin.stat: ansible.builtin.stat:
path: "{{ ansible_user_dir }}/.ansbl-common-usersetup" path: "{{ ansible_facts['user_dir'] }}/.ansbl-common-usersetup"
register: common_usersetup register: common_usersetup
- name: Usersetup - Change login shell to zsh for current user - name: Usersetup - Change login shell to zsh for current user
@ -12,7 +12,7 @@
- not common_usersetup.stat.exists and usersetup_chsh - not common_usersetup.stat.exists and usersetup_chsh
become: true become: true
ansible.builtin.user: ansible.builtin.user:
name: "{{ ansible_user_id }}" name: "{{ ansible_facts['user_id'] }}"
shell: /bin/zsh shell: /bin/zsh
# TODO: adapt to ArchLinux systems, if needed # TODO: adapt to ArchLinux systems, if needed
@ -42,6 +42,6 @@
when: when:
- not common_usersetup.stat.exists - not common_usersetup.stat.exists
ansible.builtin.file: ansible.builtin.file:
path: "{{ ansible_user_dir }}/.ansbl-common-usersetup" path: "{{ ansible_facts['user_dir'] }}/.ansbl-common-usersetup"
state: touch state: touch
mode: "0644" mode: "0644"

View file

@ -4,7 +4,7 @@
- name: Usersetup - Check, if usersetup already ran - name: Usersetup - Check, if usersetup already ran
ansible.builtin.stat: ansible.builtin.stat:
path: "{{ ansible_user_dir }}/.ansbl-common-usersetup" path: "{{ ansible_facts['user_dir'] }}/.ansbl-common-usersetup"
register: common_usersetup register: common_usersetup
- name: Usersetup - Change login shell to zsh for current user - name: Usersetup - Change login shell to zsh for current user
@ -12,7 +12,7 @@
- not common_usersetup.stat.exists and usersetup_chsh - not common_usersetup.stat.exists and usersetup_chsh
become: true become: true
ansible.builtin.user: ansible.builtin.user:
name: "{{ ansible_user_id }}" name: "{{ ansible_facts['user_id'] }}"
shell: /bin/zsh shell: /bin/zsh
# TODO: adapt to CentOS/ RHEL systems, if needed # TODO: adapt to CentOS/ RHEL systems, if needed
@ -42,6 +42,6 @@
when: when:
- not common_usersetup.stat.exists - not common_usersetup.stat.exists
ansible.builtin.file: ansible.builtin.file:
path: "{{ ansible_user_dir }}/.ansbl-common-usersetup" path: "{{ ansible_facts['user_dir'] }}/.ansbl-common-usersetup"
state: touch state: touch
mode: "0644" mode: "0644"

View file

@ -4,7 +4,7 @@
- name: Usersetup - Check, if usersetup already ran - name: Usersetup - Check, if usersetup already ran
ansible.builtin.stat: ansible.builtin.stat:
path: "{{ ansible_user_dir }}/.ansbl-common-usersetup" path: "{{ ansible_facts['user_dir'] }}/.ansbl-common-usersetup"
register: common_usersetup register: common_usersetup
- name: Usersetup - Change login shell to zsh for current user - name: Usersetup - Change login shell to zsh for current user
@ -12,13 +12,13 @@
- not common_usersetup.stat.exists and usersetup_chsh - not common_usersetup.stat.exists and usersetup_chsh
become: true become: true
ansible.builtin.user: ansible.builtin.user:
name: "{{ ansible_user_id }}" name: "{{ ansible_facts['user_id'] }}"
shell: /bin/zsh shell: /bin/zsh
- name: Usersetup - Create lockfile - name: Usersetup - Create lockfile
when: when:
- not common_usersetup.stat.exists - not common_usersetup.stat.exists
ansible.builtin.file: ansible.builtin.file:
path: "{{ ansible_user_dir }}/.ansbl-common-usersetup" path: "{{ ansible_facts['user_dir'] }}/.ansbl-common-usersetup"
state: touch state: touch
mode: "0644" mode: "0644"

View file

@ -4,7 +4,7 @@
- name: Usersetup - Check, if usersetup already ran - name: Usersetup - Check, if usersetup already ran
ansible.builtin.stat: ansible.builtin.stat:
path: "{{ ansible_user_dir }}/.ansbl-common-usersetup" path: "{{ ansible_facts['user_dir'] }}/.ansbl-common-usersetup"
register: common_usersetup register: common_usersetup
- name: Usersetup - Change login shell to zsh for current user - name: Usersetup - Change login shell to zsh for current user
@ -12,7 +12,7 @@
- not common_usersetup.stat.exists and usersetup_chsh - not common_usersetup.stat.exists and usersetup_chsh
become: true become: true
ansible.builtin.user: ansible.builtin.user:
name: "{{ ansible_user_id }}" name: "{{ ansible_facts['user_id'] }}"
shell: /bin/zsh shell: /bin/zsh
- name: Usersetup - Install locales package - name: Usersetup - Install locales package
@ -41,6 +41,6 @@
when: when:
- not common_usersetup.stat.exists - not common_usersetup.stat.exists
ansible.builtin.file: ansible.builtin.file:
path: "{{ ansible_user_dir }}/.ansbl-common-usersetup" path: "{{ ansible_facts['user_dir'] }}/.ansbl-common-usersetup"
state: touch state: touch
mode: "0644" mode: "0644"

View file

@ -4,7 +4,7 @@
- name: Usersetup - Check, if usersetup already ran - name: Usersetup - Check, if usersetup already ran
ansible.builtin.stat: ansible.builtin.stat:
path: "{{ ansible_user_dir }}/.ansbl-common-usersetup" path: "{{ ansible_facts['user_dir'] }}/.ansbl-common-usersetup"
register: common_usersetup register: common_usersetup
- name: Usersetup - Change login shell to zsh for current user - name: Usersetup - Change login shell to zsh for current user
@ -12,7 +12,7 @@
- not common_usersetup.stat.exists and usersetup_chsh - not common_usersetup.stat.exists and usersetup_chsh
become: true become: true
ansible.builtin.user: ansible.builtin.user:
name: "{{ ansible_user_id }}" name: "{{ ansible_facts['user_id'] }}"
shell: /usr/local/bin/zsh shell: /usr/local/bin/zsh
# - name: Usersetup - Install locales package # - name: Usersetup - Install locales package
@ -41,6 +41,6 @@
when: when:
- not common_usersetup.stat.exists - not common_usersetup.stat.exists
ansible.builtin.file: ansible.builtin.file:
path: "{{ ansible_user_dir }}/.ansbl-common-usersetup" path: "{{ ansible_facts['user_dir'] }}/.ansbl-common-usersetup"
state: touch state: touch
mode: "0644" mode: "0644"

View file

@ -5,5 +5,5 @@
- name: Usersetup - Run setup tasks - name: Usersetup - Run setup tasks
ansible.builtin.include_tasks: "{{ item }}" ansible.builtin.include_tasks: "{{ item }}"
with_first_found: with_first_found:
- "usersetup-{{ ansible_distribution }}.yml" - "usersetup-{{ ansible_facts['distribution'] }}.yml"
- "usersetup-{{ (override_os_family is defined) | ternary(override_os_family, ansible_os_family) }}.yml" - "usersetup-{{ (override_os_family is defined) | ternary(override_os_family, ansible_facts['os_family']) }}.yml"

View file

@ -4,5 +4,5 @@
- name: Usertools - Install user's working utilities - name: Usertools - Install user's working utilities
ansible.builtin.include_tasks: "{{ item }}" ansible.builtin.include_tasks: "{{ item }}"
with_first_found: with_first_found:
- "usertools-{{ ansible_distribution }}.yml" - "usertools-{{ ansible_facts['distribution'] }}.yml"
- "usertools-{{ (override_os_family is defined) | ternary(override_os_family, ansible_os_family) }}.yml" - "usertools-{{ (override_os_family is defined) | ternary(override_os_family, ansible_facts['os_family']) }}.yml"

View file

@ -10,7 +10,7 @@ bind r source-file ~/.tmux.conf
# shorter timing # shorter timing
set -g repeat-time 200 set -g repeat-time 200
{% if not (ansible_distribution == "CentOS" and ansible_distribution_major_version|int <= 7) %} {% if not (ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version']|int <= 7) %}
# configure mouse # configure mouse
setw -g mouse on setw -g mouse on
{% endif %} {% endif %}
@ -29,7 +29,7 @@ setw -g pane-base-index 1
# status bar # status bar
#set -g status-right '#[fg=white]#(hostname)@#(host `hostname` | cut -d " " -f 4)' #set -g status-right '#[fg=white]#(hostname)@#(host `hostname` | cut -d " " -f 4)'
set-window-option -g status-left " #S " set-window-option -g status-left " #S "
{% if ansible_distribution == "CentOS" and ansible_distribution_major_version|int <= 7 %} {% if ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version']|int <= 7 %}
set-window-option -g status-left-fg black set-window-option -g status-left-fg black
set-window-option -g status-left-bg white set-window-option -g status-left-bg white
{% else %} {% else %}
@ -37,7 +37,7 @@ set-window-option -g status-left-style fg=black,bg=white
{% endif %} {% endif %}
set-window-option -g status-right " %H:%M %Y-%m-%d | #(hostname) " set-window-option -g status-right " %H:%M %Y-%m-%d | #(hostname) "
{% if ansible_distribution == "CentOS" and ansible_distribution_major_version|int <= 7 %} {% if ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version']|int <= 7 %}
set-window-option -g status-right-fg black set-window-option -g status-right-fg black
set-window-option -g status-right-bg white set-window-option -g status-right-bg white
{% else %} {% else %}
@ -47,7 +47,7 @@ set-window-option -g status-right-style fg=black,bg=white
set-window-option -g window-status-format " #I: #W " set-window-option -g window-status-format " #I: #W "
set-window-option -g window-status-current-format " #I: #W " set-window-option -g window-status-current-format " #I: #W "
{% if ansible_distribution == "CentOS" and ansible_distribution_major_version|int <= 7 %} {% if ansible_facts['distribution'] == "CentOS" and ansible_facts['distribution_major_version']|int <= 7 %}
set-window-option -g window-status-current-fg green set-window-option -g window-status-current-fg green
set-window-option -g window-status-current-bg black set-window-option -g window-status-current-bg black
{% else %} {% else %}