workstation-setup/local.yml
2021-12-25 19:16:35 +01:00

82 lines
1.8 KiB
YAML

---
- hosts: localhost
connection: local
roles:
- role: gantsign.visual-studio-code
become: true
users:
- username: gianm
tasks:
- name: Set zsh main as shell
become: true
when: ansible_facts['os_family'] == "Debian"
shell: apt update
- name: Basic dev install
become: true
package:
name:
- zsh
- name: Set zsh main as shell
become: true
shell: chsh -s $(which zsh) gianm
- name: check if on my zsh is installed
stat:
path: "/home/gianm/.oh-my-zsh"
register: zsh_dir
- name: Install oh my zsh
debug:
msg: "skipping install oh my zsh"
when: zsh_dir.stat.exists
- name: install oh my zsh
become: true
become_user: gianm
when: not zsh_dir.stat.exists
shell: sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
- name: Setup .zshrc
copy:
src: files/zshrc
dest: /home/gianm/.zshrc
owner: gianm
group: gianm
- name: Setups .profile
copy:
src: files/profile
dest: /home/gianm/.profile
owner: gianm
group: gianm
- name: install nvm
become_user: gianm
shell: >
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
args:
creates: "{{ ansible_env.HOME }}/.nvm/nvm.sh"
- name: install nvm env
lineinfile:
path: /home/gianm/.zshrc
line: 'export NVM_DIR="$HOME/.nvm"'
- name: install nvm env
lineinfile:
path: /home/gianm/.zshrc
line: '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"'
- name: install nvm env
lineinfile:
path: /home/gianm/.zshrc
line: '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"'
- name: install node
become: true
become_user: gianm
shell: zsh && source /home/gianm/.zshrc && nvm install --lts