Compare commits

...

3 commits

Author SHA1 Message Date
Jannik Beyerstedt 4715b1dacd [FIX] Usersettings: Re-allow running this task without sudo capabilities
Previously this task intentionally had no tasks installing any packages.
But git and pip3 are needed by some tasks, so let's try to install, but
don't fail because of missing sudo priviledges.
2022-02-13 20:54:15 +01:00
Jannik Beyerstedt a8285962a9 [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.
2022-02-13 20:52:22 +01:00
Jannik Beyerstedt a9e89283a2 [FIX] Usersettings: FreeBSD has another pip package 2022-02-13 20:28:25 +01:00
13 changed files with 87 additions and 76 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -3,14 +3,13 @@
- name: usersettings - Install required tools
become: yes
when: (override_os_family is defined) | ternary(override_os_family,ansible_os_family) != "Darwin"
ignore_errors: yes # just fail on systems without sudo access
ansible.builtin.package:
name: "{{ packages }}"
state: present
vars:
packages:
- git
- python3-pip
- name: usersettings - Install/ Update oh-my-zsh for current user
ansible.builtin.git:
@ -23,32 +22,44 @@
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
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
ignore_errors: yes # just fail on systems without sudo access
ansible.builtin.package:
name: "{{ packages }}"
state: present
vars:
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"
when: usersetup_virtualenvwrapper
become: yes
ansible.builtin.pip:
name: virtualenvwrapper
- name: usersettings - Copy dotfiles
ansible.builtin.copy:
src: "{{ item.src }}"
@ -68,10 +79,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"

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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