[TIDY] move when statements, fix whitespace

Having the when condition of a task at the top instead of bottom is
easiert to read. Also some spaces were another whitespace character on
accident.
master
Jannik Beyerstedt 8 months ago
parent a9e89283a2
commit a8285962a9
  1. 8
      README.md
  2. 12
      tasks/devel-Archlinux.yml
  3. 12
      tasks/devel-Darwin.yml
  4. 12
      tasks/devel-Debian.yml
  5. 16
      tasks/devel.yml
  6. 6
      tasks/main.yml
  7. 16
      tasks/usersettings.yml
  8. 14
      tasks/usersetup-Archlinux.yml
  9. 14
      tasks/usersetup-Centos.yml
  10. 8
      tasks/usersetup-Darwin.yml
  11. 14
      tasks/usersetup-Debian.yml
  12. 14
      tasks/usersetup-FreeBSD.yml
  13. 2
      templates/_gitconfig.j2

@ -69,27 +69,27 @@ Or call the different tasks individually:
hosts: all
tasks:
- name: Basics - Update first
when: common_settingsonly | default(false) == false
ansible.builtin.import_role:
name: common
tasks_from: update
when: common_settingsonly | default(false) == false
## Run rasks from the role's main.yml
- name: Basics - Install essential tools
when: common_settingsonly | default(false) == false
ansible.builtin.import_role:
name: common
tasks_from: essentials
when: common_settingsonly | default(false) == false
- name: Basics - Install basic tools
when: common_settingsonly | default(false) == false
ansible.builtin.import_role:
name: common
tasks_from: tools
when: common_settingsonly | default(false) == false
- name: Basics - Setup user shell
when: common_settingsonly | default(false) == false
ansible.builtin.import_role:
name: common
tasks_from: usersetup
when: common_settingsonly | default(false) == false
- name: Basics - Install dotfiles
ansible.builtin.import_role:
name: common

@ -11,6 +11,7 @@
# Install Visual Studio Code and Set Basic Configuration
- name: vscode - Basics
when: user_vscode == true
block:
- name: vscode - Basics - Install
ansible.builtin.package:
@ -28,16 +29,16 @@
- plantuml
- name: vscode - Basics - Create settings directory
ansible.builtin.file:
path: "{{ ansible_user_dir }}/.config/Code/User"
path: "{{ ansible_user_dir }}/.config/Code/User"
state: directory
- name: vscode - Basics - Copy global settings
ansible.builtin.copy:
src: "{{ role_path }}/files/vscode-settings.json"
dest: "{{ ansible_user_dir }}/.config/Code/User/settings.json"
when: user_vscode == true
dest: "{{ ansible_user_dir }}/.config/Code/User/settings.json"
# Dev Env - C/C++ Development Tools
- name: devel - C/C++
when: user_lang_cpp == true
block:
- name: devel - C/C++ - Install developer tools
ansible.builtin.package:
@ -46,13 +47,13 @@
vars:
packages:
- clang-format
when: user_lang_cpp == true
# Dev Env - Python Development Tools
# all done in vscode.yml
# Dev Env - Golang Development Tools
- name: devel - Golang
when: user_lang_golang == true
block:
- name: devel - Golang - Install developer tools
ansible.builtin.package:
@ -61,10 +62,10 @@
vars:
packages:
- go
when: user_lang_golang == true
# Dev Env - LaTeX Distribution
- name: devel - LaTeX
when: user_lang_latex == true
block:
- name: devel - LaTeX - Install basic TeX distribution
ansible.builtin.package:
@ -77,4 +78,3 @@
# - texlive-science
# - texlive-fontsextra
- biber
when: user_lang_latex == true

@ -8,6 +8,7 @@
# Install Visual Studio Code and Set Basic Configuration
- name: vscode - Basics
when: user_vscode == true
block:
- name: vscode - Basics - Install
ansible.builtin.homebrew_cask:
@ -32,16 +33,16 @@
# - graphviz
- name: vscode - Basics - Create settings directory
ansible.builtin.file:
path: "{{ ansible_user_dir }}/Library/Application Support/Code/User"
path: "{{ ansible_user_dir }}/Library/Application Support/Code/User"
state: directory
- name: vscode - Basics - Copy global settings
ansible.builtin.copy:
src: "{{ role_path }}/files/vscode-settings.json"
dest: "{{ ansible_user_dir }}/Library/Application Support/Code/User/settings.json"
when: user_vscode == true
dest: "{{ ansible_user_dir }}/Library/Application Support/Code/User/settings.json"
# Dev Env - C/C++ Development Tools
- name: devel - C/C++
when: user_lang_cpp == true
block:
- name: devel - C/C++ - Install developer tools
ansible.builtin.homebrew:
@ -50,13 +51,13 @@
vars:
packages:
- clang-format
when: user_lang_cpp == true
# Dev Env - Python Development Tools
# all done in vscode.yml
# Dev Env - Golang Development Tools
- name: devel - Golang
when: user_lang_golang == true
block:
- name: devel - Golang - Install developer tools
ansible.builtin.homebrew:
@ -65,10 +66,10 @@
vars:
packages:
- go
when: user_lang_golang == true
# Dev Env - LaTeX Distribution
- name: devel - LaTeX
when: user_vscode == true and user_lang_latex == true
block:
- name: devel - LaTeX - Install basic TeX distribution
ansible.builtin.homebrew_cask:
@ -78,4 +79,3 @@
packages:
- basictex
- tex-live-utility
when: user_vscode == true and user_lang_latex == true

@ -9,6 +9,7 @@
# Install Visual Studio Code and Set Basic Configuration
- name: vscode - Basics
when: user_vscode == true
block:
- name: vscode - Basics - Add Repo Key
become: yes
@ -40,16 +41,16 @@
- graphviz
- name: vscode - Basics - Create settings directory
ansible.builtin.file:
path: "{{ ansible_user_dir }}/.config/Code/User"
path: "{{ ansible_user_dir }}/.config/Code/User"
state: directory
- name: vscode - Basics - Copy global settings
ansible.builtin.copy:
src: "{{ role_path }}/files/vscode-settings.json"
dest: "{{ ansible_user_dir }}/.config/Code/User/settings.json"
when: user_vscode == true
dest: "{{ ansible_user_dir }}/.config/Code/User/settings.json"
# Dev Env - C/C++ Development Tools
- name: devel - C/C++
when: user_lang_cpp == true
block:
- name: devel - C/C++ - Install developer tools
become: yes
@ -59,13 +60,13 @@
vars:
packages:
- clang-format
when: user_lang_cpp == true
# Dev Env - Python Development Tools
# all done in vscode.yml
# Dev Env - Golang Development Tools
- name: devel - Golang
when: user_lang_golang == true
block:
- name: devel - Golang - Install developer tools
become: yes
@ -75,10 +76,10 @@
vars:
packages:
- golang
when: user_lang_golang == true
# Dev Env - LaTeX Distribution
- name: devel - LaTeX
when: user_lang_latex == true
block:
- name: devel - LaTeX - Install basic TeX distribution
ansible.builtin.package:
@ -91,4 +92,3 @@
# - texlive-science
# - texlive-fonts-extra
- biber
when: user_lang_latex == true

@ -21,6 +21,7 @@
# Install Visual Studio Code and Set Basic Configuration
- name: vscode - Basics
when: user_vscode == true
block:
- name: vscode - Basics - Configure
ansible.builtin.shell: |
@ -33,10 +34,10 @@
code --install-extension jebbs.plantuml
code --install-extension mechatroner.rainbow-csv
code --install-extension grapecity.gc-excelviewer
when: user_vscode == true
# VS Code - C/C++ Development Tools
- name: vscode - C/C++
when: user_vscode == true and user_lang_cpp == true
block:
- name: vscode - C/C++ - Configure VS Code
ansible.builtin.shell: |
@ -44,27 +45,27 @@
code --install-extension ms-vscode.cpptools
code --install-extension ms-vscode.cmake-tools
code --install-extension twxs.cmake
when: user_vscode == true and user_lang_cpp == true
# VS Code - Python Development Tools
- name: devel - Python - Install python dev packages
when: user_lang_python == true
ansible.builtin.pip:
name:
- autopep8
# - pylint # must be installed in each venv individually!
executable: "{{ override_pip_exe | default(default_pip3_exe) }}"
when: user_lang_python == true
- name: vscode - Python
when: user_vscode == true and user_lang_python == true
block:
- name: vscode - Python - Configure VS Code
ansible.builtin.shell: |
PATH=/usr/local/bin:$PATH
code --install-extension ms-python.python
when: user_vscode == true and user_lang_python == true
# VC Code - Golang Development Tools
# https://golang.org/doc/install
- name: devel - Golang - Setup Environment
when: user_lang_golang == true
block:
- name: devel - Golang - Create workspace directory
ansible.builtin.file:
@ -88,30 +89,29 @@
backup: yes
# TODO: make this resilient against changes
# and group all golang stuff in one section inside zshrc-host
when: user_lang_golang == true
- name: vscode - Golang
when: user_vscode == true and user_lang_golang == true
block:
- name: vscode - Golang - Configure VS Code
ansible.builtin.shell: |
PATH=/usr/local/bin:$PATH
code --install-extension golang.go
when: user_vscode == true and user_lang_golang == true
# VS Code - LaTeX Distribution
- name: devel - LaTeX - Install TeX packages
when: user_lang_latex == true
become: yes
ansible.builtin.shell: |
PATH=/Library/TeX/texbin:$PATH
tlmgr install latexmk latexindent biblatex logreq xstring biber
tlmgr install collection-fontsextra collection-fontsrecommended collection-fontutils collection-langgerman collection-langenglish collection-mathscience
tlmgr install todonotes textpos lipsum pgfopts xpatch enumitem nomencl glossaries glossaries-german glossaries-english datatool mfirstuc xfor substr tracklang placeins placeins-plain csquotes appendixnumberbeamer fontaxes
when: user_lang_latex == true
- name: vscode - LaTeX
when: user_vscode == true and user_lang_latex == true
block:
- name: vscode - Basics - Configure
ansible.builtin.shell: |
PATH=/usr/local/bin:$PATH
code --install-extension james-yu.latex-workshop
code --install-extension ban.spellright
when: user_vscode == true and user_lang_latex == true

@ -10,18 +10,18 @@
# if role has not changed, this will not be needed when just installing updates
- name: Install essential tools
ansible.builtin.include_tasks: essentials.yml
when: common_settingsonly | default(false) == false
ansible.builtin.include_tasks: essentials.yml
# if role has not changed, this will not be needed when just installing updates
- name: Install more tools
ansible.builtin.include_tasks: tools.yml
when: common_settingsonly | default(false) == false
ansible.builtin.include_tasks: tools.yml
# this will just run once, because of a lock-file
- name: Basics - Setup user shell
ansible.builtin.include_tasks: usersetup.yml
when: common_settingsonly | default(false) == false
ansible.builtin.include_tasks: usersetup.yml
# run this for every maintenance/ update cycle
- name: Apply user settings

@ -21,18 +21,18 @@
dest: .fzf
register: fzf_git
- name: (Re-)Install fzf
ansible.builtin.shell: ".fzf/install --key-bindings --no-completion --no-update-rc"
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
become: yes
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: yes
ansible.builtin.package:
name: "{{ packages }}"
state: present
@ -40,24 +40,24 @@
packages:
- python3-pip
- name: usersettings - Install pip virtualenvwrapper (Debian)
when: (override_os_family is defined) | ternary(override_os_family,ansible_os_family) == "Debian"
become: yes
ansible.builtin.pip:
name: virtualenvwrapper
extra_args: --system
when: (override_os_family is defined) | ternary(override_os_family,ansible_os_family) == "Debian"
- 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
when: (override_os_family is defined) | ternary(override_os_family,ansible_os_family) == "Darwin"
- name: usersettings - Install pip virtualenvwrapper (CentOS, ArchLinux)
become: yes
ansible.builtin.pip:
name: virtualenvwrapper
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"
become: yes
ansible.builtin.pip:
name: virtualenvwrapper
- name: usersettings - Copy dotfiles
ansible.builtin.copy:
src: "{{ item.src }}"
@ -77,10 +77,10 @@
src: "{{ role_path }}/templates/_zshrc.j2"
dest: "{{ ansible_user_dir }}/.zshrc"
- name: usersettings - Set global gitconfig
when: usersetup_gitconfig == true
ansible.builtin.template:
src: "{{ role_path }}/templates/_gitconfig.j2"
dest: "{{ ansible_user_dir }}/.gitconfig"
when: usersetup_gitconfig == true
- name: usersettings - Set tmux.conf
ansible.builtin.template:
src: "{{ role_path }}/templates/_tmux.conf.j2"

@ -8,12 +8,12 @@
register: common_usersetup
- name: usersetup - Change login shell to zsh for current user
when:
- common_usersetup.stat.exists == false and usersetup_chsh == true
become: yes
ansible.builtin.user:
name: "{{ ansible_user_id }}"
shell: /bin/zsh
when:
- common_usersetup.stat.exists == false and usersetup_chsh == true
# TODO: adapt to ArchLinux systems, if needed
# - name: usersetup - Install locales package
@ -23,23 +23,23 @@
# state: present
# - name: usersetup - Setup locale en_US
# when:
# - common_usersetup.stat.exists == false
# become: yes
# ansible.builtin.locale_gen:
# name: en_US.UTF-8
# state: present
# - name: usersetup - Setup locale de_DE
# when:
# - common_usersetup.stat.exists == false
# - name: usersetup - Setup locale de_DE
# become: yes
# ansible.builtin.locale_gen:
# name: de_DE.UTF-8
# state: present
# when:
# - common_usersetup.stat.exists == false
- name: usersetup - Create lockfile
when:
- common_usersetup.stat.exists == false
ansible.builtin.file:
path: .ansbl-common-usersetup
state: touch
when:
- common_usersetup.stat.exists == false

@ -8,12 +8,12 @@
register: common_usersetup
- name: usersetup - Change login shell to zsh for current user
when:
- common_usersetup.stat.exists == false and usersetup_chsh == true
become: yes
ansible.builtin.user:
name: "{{ ansible_user_id }}"
shell: /bin/zsh
when:
- common_usersetup.stat.exists == false and usersetup_chsh == true
# TODO: adapt to CentOS/ RHEL systems, if needed
# - name: usersetup - Install locales package
@ -23,23 +23,23 @@
# state: present
# - name: usersetup - Setup locale en_US
# when:
# - common_usersetup.stat.exists == false
# become: yes
# ansible.builtin.locale_gen:
# name: en_US.UTF-8
# state: present
# - name: usersetup - Setup locale de_DE
# when:
# - common_usersetup.stat.exists == false
# - name: usersetup - Setup locale de_DE
# become: yes
# ansible.builtin.locale_gen:
# name: de_DE.UTF-8
# state: present
# when:
# - common_usersetup.stat.exists == false
- name: usersetup - Create lockfile
when:
- common_usersetup.stat.exists == false
ansible.builtin.file:
path: .ansbl-common-usersetup
state: touch
when:
- common_usersetup.stat.exists == false

@ -8,16 +8,16 @@
register: common_usersetup
- name: usersetup - Change login shell to zsh for current user
when:
- common_usersetup.stat.exists == false and usersetup_chsh == true
become: yes
ansible.builtin.user:
name: "{{ ansible_user_id }}"
shell: /bin/zsh
when:
- common_usersetup.stat.exists == false and usersetup_chsh == true
- name: usersetup - Create lockfile
when:
- common_usersetup.stat.exists == false
ansible.builtin.file:
path: .ansbl-common-usersetup
state: touch
when:
- common_usersetup.stat.exists == false

@ -8,12 +8,12 @@
register: common_usersetup
- name: usersetup - Change login shell to zsh for current user
when:
- common_usersetup.stat.exists == false and usersetup_chsh == true
become: yes
ansible.builtin.user:
name: "{{ ansible_user_id }}"
shell: /bin/zsh
when:
- common_usersetup.stat.exists == false and usersetup_chsh == true
- name: usersetup - Install locales package
become: yes
@ -22,23 +22,23 @@
state: present
- name: usersetup - Setup locale en_US
when:
- common_usersetup.stat.exists == false
become: yes
ansible.builtin.locale_gen:
name: en_US.UTF-8
state: present
- name: usersetup - Setup locale de_DE
when:
- common_usersetup.stat.exists == false
- name: usersetup - Setup locale de_DE
become: yes
ansible.builtin.locale_gen:
name: de_DE.UTF-8
state: present
when:
- common_usersetup.stat.exists == false
- name: usersetup - Create lockfile
when:
- common_usersetup.stat.exists == false
ansible.builtin.file:
path: .ansbl-common-usersetup
state: touch
when:
- common_usersetup.stat.exists == false

@ -8,12 +8,12 @@
register: common_usersetup
- name: usersetup - Change login shell to zsh for current user
when:
- common_usersetup.stat.exists == false and usersetup_chsh == true
become: yes
ansible.builtin.user:
name: "{{ ansible_user_id }}"
shell: /usr/local/bin/zsh
when:
- common_usersetup.stat.exists == false and usersetup_chsh == true
# - name: usersetup - Install locales package
# become: yes
@ -22,23 +22,23 @@
# state: present
# - name: usersetup - Setup locale en_US
# when:
# - common_usersetup.stat.exists == false
# become: yes
# ansible.builtin.locale_gen:
# name: en_US.UTF-8
# state: present
# - name: usersetup - Setup locale de_DE
# when:
# - common_usersetup.stat.exists == false
# - name: usersetup - Setup locale de_DE
# become: yes
# ansible.builtin.locale_gen:
# name: de_DE.UTF-8
# state: present
# when:
# - common_usersetup.stat.exists == false
- name: usersetup - Create lockfile
when:
- common_usersetup.stat.exists == false
ansible.builtin.file:
path: .ansbl-common-usersetup
state: touch
when:
- common_usersetup.stat.exists == false

@ -1,7 +1,7 @@
{% if gitconfig_name is defined and gitconfig_email is defined %}
[user]
name = {{ gitconfig_name }}
email = {{ gitconfig_email }}
email = {{ gitconfig_email }}
{% endif %}
[core]
excludesfile = ~/.gitignore_global

Loading…
Cancel
Save