2019-10-14 07:18:29 +00:00
|
|
|
---
|
|
|
|
# Common/VSCode: Install and Configure VS Code
|
2019-10-17 07:44:52 +00:00
|
|
|
# - Installs VS Code, if user_vscode is set
|
|
|
|
# - Installs development tools, if the corresponding variable is set
|
|
|
|
# but will not try to configure VS Code, if user_vscode is not set.
|
|
|
|
# - Also configures VS Code, of user_vscode is set
|
|
|
|
|
|
|
|
# Variables:
|
|
|
|
# - user_vscode: Boolean, if vscode should be installed and configured
|
|
|
|
# - user_lang_cpp: Boolean for C and C++
|
|
|
|
# - user_lang_python: Boolean for Python
|
2019-10-17 08:25:49 +00:00
|
|
|
# - user_lang_golang: Boolean for Golang
|
|
|
|
# - user_lang_golang_gopath: Go workspace directory
|
2019-10-17 07:44:52 +00:00
|
|
|
|
2019-10-14 07:18:29 +00:00
|
|
|
|
|
|
|
- name: vscode - Install and configure VS Code
|
|
|
|
include_tasks: "{{ item }}"
|
|
|
|
with_first_found:
|
|
|
|
- "vscode-{{ ansible_distribution }}.yml"
|
|
|
|
- "vscode-{{ (override_os_family is defined) | ternary(override_os_family,ansible_os_family) }}.yml"
|
|
|
|
|
|
|
|
# Install Visual Studio Code and Set Basic Configuration
|
|
|
|
- name: vscode - Basics
|
|
|
|
block:
|
|
|
|
- name: vscode - Basics - Configure
|
|
|
|
shell: |
|
|
|
|
PATH=/usr/local/bin:$PATH
|
|
|
|
code --install-extension chiehyu.vscode-astyle
|
|
|
|
code --install-extension editorconfig
|
|
|
|
|
|
|
|
code --install-extension yzane.markdown-pdf
|
|
|
|
|
|
|
|
# code --install-extension james-yu.latex-workshop
|
|
|
|
# code --install-extension ban.spellright
|
|
|
|
when: user_vscode == true
|
|
|
|
|
|
|
|
|
|
|
|
# VS Code - C/C++ Development Tools
|
|
|
|
- name: vscode - C/C++
|
|
|
|
block:
|
|
|
|
- name: vscode - C/C++ - Configure VS Code
|
|
|
|
shell: |
|
|
|
|
PATH=/usr/local/bin:$PATH
|
|
|
|
code --install-extension ms-vscode.cpptools
|
2019-10-17 07:44:52 +00:00
|
|
|
when: user_vscode == true and user_lang_cpp == true
|
2019-10-14 07:18:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
# VS Code - Python Development Tools
|
2019-10-17 08:25:49 +00:00
|
|
|
- name: vscode - Python - Install python dev packages
|
|
|
|
pip:
|
|
|
|
name:
|
|
|
|
- autopep8
|
|
|
|
- pylint
|
|
|
|
executable: /usr/local/bin/pip3
|
2019-10-17 07:44:52 +00:00
|
|
|
when: user_lang_python == true
|
|
|
|
- name: vscode - Python
|
|
|
|
block:
|
2019-10-14 07:18:29 +00:00
|
|
|
- name: vscode - Python - Configure VS Code
|
|
|
|
shell: |
|
|
|
|
PATH=/usr/local/bin:$PATH
|
|
|
|
code --install-extension ms-python.python
|
2019-10-17 07:44:52 +00:00
|
|
|
when: user_vscode == true and user_lang_python == true
|
2019-10-17 08:25:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
# VC Code - Golang Development Tools
|
|
|
|
# https://golang.org/doc/install
|
|
|
|
- name: vscode - Golang - Setup Environment
|
|
|
|
block:
|
|
|
|
- name: vscode - Golang - Create workspace directory
|
|
|
|
file:
|
|
|
|
path: "{{ user_lang_golang_gopath }}"
|
|
|
|
state: directory
|
|
|
|
- name: vscode - Golang - Create zshrc-host
|
|
|
|
file:
|
|
|
|
path: "{{ ansible_user_dir}}/.zshrc-host"
|
|
|
|
state: touch
|
|
|
|
- name: vscode - Golang - Add GOPATH
|
|
|
|
lineinfile:
|
|
|
|
path: "{{ ansible_user_dir}}/.zshrc-host"
|
|
|
|
line: "export GOPATH={{ user_lang_golang_gopath }}"
|
|
|
|
state: present
|
|
|
|
backup: yes
|
|
|
|
- name: vscode - Golang - Add go bin to PATH
|
|
|
|
lineinfile:
|
|
|
|
path: "{{ ansible_user_dir}}/.zshrc-host"
|
|
|
|
line: "export PATH=$PATH:{{ user_lang_golang_gopath }}/bin"
|
|
|
|
state: present
|
|
|
|
backup: yes
|
|
|
|
# TODO: make this resilient agains changes
|
|
|
|
# and group all golang stuff in one section inside zshrc-host
|
|
|
|
when: user_lang_golang == true
|
|
|
|
|
|
|
|
- name: vscode - Golang
|
|
|
|
block:
|
|
|
|
- name: vscode - Golang - Configure VS Code
|
|
|
|
shell: |
|
|
|
|
PATH=/usr/local/bin:$PATH
|
|
|
|
code --install-extension ms-vscode.go
|
|
|
|
when: user_vscode == true and user_lang_golang == true
|