2019-10-06 20:41:31 +00:00
Common
=========
2019-10-12 11:09:27 +00:00
Common user settings and tools used by Jannik Beyerstedt.
2020-02-28 07:51:48 +00:00
This role is compatible with Debian based systems, macOS, CentOS (no development toolchains) and ArchLinux (no updates).
2019-10-06 20:41:31 +00:00
Requirements
------------
2020-01-16 09:46:42 +00:00
Have a user set up on the machine, to which you can connecto via a ssh key.
This user must also have sudo right without asking for a password!
(e.g. using `%sudo ALL=(ALL) NOPASSWD:ALL` when editing the sudoers file with `sudo visudo` )
2019-10-06 20:41:31 +00:00
Role Variables
--------------
2019-10-12 11:09:27 +00:00
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).
- `override_os_family` : Set to "Debian" in the host inventory, if `ansible_os_family` is not set correctly
2019-10-06 20:41:31 +00:00
2020-06-25 10:04:14 +00:00
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.)
2019-10-14 07:18:29 +00:00
The User Setup will change the user shell and global gitconfig. This can be disabled:
2020-01-16 09:46:42 +00:00
- `usersetup_chsh` : Boolean to enable changing the user shell to zsh (default: true)
- `usersetup_gitconfig` : Boolean to disable overriding the global gitconfig (default: true)
* `gitconfig_name` : User's name in .gitconfig file (default: n.a.)
* `gitconfig_email` : User's email in .gitconfig file (default: n.a.)
2020-03-19 17:17:57 +00:00
- `usersetup_virtualenvwrapper` : Boolean to enable the virtualenvwrapper plugin in oh-my-zsh (default: false)
2019-10-14 07:18:29 +00:00
2020-01-16 09:46:42 +00:00
The development environment for different programming languages can be setup automatically.
To enable, that Visual Studio Code will be installed and configured, set `user_vscode` to true, otherwise only the bare development toolchain will be installed.
2019-10-14 07:18:29 +00:00
For a GUI/ Desktop machine, you can enable to install and configure VS Code:
2020-01-16 09:46:42 +00:00
- `user_vscode` : Boolean to install and set the basic configuration of 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_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")
2020-05-23 20:30:37 +00:00
- `user_lang_latex` : Boolean to install a LaTeX distribution and configure VS Code (default: false)
2020-01-16 09:46:42 +00:00
By default, this role will run updates, install some essential tools, set up the user's shell and copy the dotfiles.
If you just want to have the dotfiles managed by ansible, set `common_settingsonly` to true!
This can be useful, if you have no sudo rights, because tool installation will need these.
2019-10-31 17:29:35 +00:00
2019-10-06 20:41:31 +00:00
Dependencies
------------
none
2019-10-12 11:09:27 +00:00
2019-10-06 20:41:31 +00:00
Example Playbook
----------------
2019-10-12 11:09:27 +00:00
You can simply run the whole role:
```yml
2021-08-25 13:31:46 +00:00
- name: Basic User Shell Setup
hosts: all
tasks:
2021-08-28 14:58:03 +00:00
- ansible.builtin.import_role:
2021-08-25 13:31:46 +00:00
name: common
```
Or call the different tasks individually:
```yml
2019-10-12 11:09:27 +00:00
- name: Basic User Shell Setup
hosts: all
tasks:
- name: Basics - Update first
2021-08-28 14:58:03 +00:00
ansible.builtin.import_role:
2019-10-12 11:09:27 +00:00
name: common
tasks_from: update
2019-10-31 17:29:35 +00:00
when: common_settingsonly | default(false) == false
2021-08-25 13:31:46 +00:00
## Run rasks from the role's main.yml
2019-10-12 11:09:27 +00:00
- name: Basics - Install essential tools
2021-08-28 14:58:03 +00:00
ansible.builtin.import_role:
2019-10-12 11:09:27 +00:00
name: common
tasks_from: essentials
2019-10-31 17:29:35 +00:00
when: common_settingsonly | default(false) == false
2021-08-25 13:31:46 +00:00
- name: Basics - Install basic tools
2021-08-28 14:58:03 +00:00
ansible.builtin.import_role:
2019-10-12 11:09:27 +00:00
name: common
tasks_from: tools
2019-10-31 17:29:35 +00:00
when: common_settingsonly | default(false) == false
2019-10-12 11:09:27 +00:00
- name: Basics - Setup user shell
2021-08-28 14:58:03 +00:00
ansible.builtin.import_role:
2019-10-12 11:09:27 +00:00
name: common
tasks_from: usersetup
2019-10-31 17:29:35 +00:00
when: common_settingsonly | default(false) == false
2019-10-12 11:09:27 +00:00
- name: Basics - Install dotfiles
2021-08-28 14:58:03 +00:00
ansible.builtin.import_role:
2019-10-12 11:09:27 +00:00
name: common
tasks_from: usersettings
2019-10-14 06:47:22 +00:00
2021-08-25 13:31:46 +00:00
## Additionall tasks for a work station machine
2019-10-14 07:18:29 +00:00
- name: Basics - Install user's working utilities
2021-08-28 14:58:03 +00:00
ansible.builtin.import_role:
2019-10-14 06:47:22 +00:00
name: common
tasks_from: usertools
2020-01-16 12:40:01 +00:00
- name: Basics - Install and configure development env (and VS Code)
2021-08-28 14:58:03 +00:00
ansible.builtin.import_role:
2019-10-14 07:18:29 +00:00
name: common
2020-01-16 12:40:01 +00:00
tasks_from: devel
2019-10-12 11:09:27 +00:00
```
2019-10-06 20:41:31 +00:00
License
-------
GPLv3