122 lines
2.8 KiB
YAML
122 lines
2.8 KiB
YAML
---
|
|
- hosts: localhost
|
|
become: true
|
|
connection: local
|
|
vars_files:
|
|
- vars/packages.yml
|
|
vars:
|
|
tmp_dir: /tmp-ansibe
|
|
discord_url: https://discordapp.com/api/download?format=deb&platform=linux
|
|
roles:
|
|
- role: gantsign.visual-studio-code
|
|
become: true
|
|
users:
|
|
- username: gianm
|
|
|
|
tasks:
|
|
- name: Creates temporary directory
|
|
file:
|
|
path: "{{ tmp_dir }}"
|
|
state: directory
|
|
|
|
- name: get script to add repository nodejs
|
|
become: true
|
|
when: ansible_facts['os_family'] == "Debian"
|
|
get_url:
|
|
url: "https://deb.nodesource.com/setup_lts.x"
|
|
dest: "{{ tmp_dir }}/node-add.sh"
|
|
mode: '774'
|
|
|
|
- name: execute scritp to add repository nodejs
|
|
become: true
|
|
when: ansible_facts['os_family'] == "Debian"
|
|
command: "{{ tmp_dir }}/node-add.sh"
|
|
register: source_added
|
|
changed_when: source_added.rc != 0
|
|
|
|
- name: execute scritp to add repository nodejs
|
|
become: true
|
|
when: ansible_facts['os_family'] == "Debian"
|
|
command: "{{ tmp_dir }}/node-add.sh"
|
|
register: source_added
|
|
changed_when: source_added.rc != 0
|
|
|
|
- name: DISCORD - Download discord
|
|
get_url:
|
|
url: "{{ discord_url }}"
|
|
dest: "{{ tmp_dir }}/discord.deb"
|
|
force: yes
|
|
|
|
- name: DISCORD - Install my_package
|
|
apt:
|
|
deb: "{{ tmp_dir }}/discord.deb"
|
|
|
|
- name: Update apt repository
|
|
become: true
|
|
when: ansible_facts['os_family'] == "Debian"
|
|
command: apt update
|
|
|
|
- name: Installing {{ packages }}
|
|
become: true
|
|
package:
|
|
name: "{{ item }}"
|
|
state: present
|
|
with_items: "{{ packages }}"
|
|
|
|
- name: Set zsh main as command
|
|
become: true
|
|
command: chsh -s $(which zsh) gianm
|
|
register: shell_change
|
|
changed_when: shell_change.rc != 0
|
|
when: ansible_user_shell == "/bin/bash"
|
|
|
|
- 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_user: gianm
|
|
git:
|
|
repo: https://github.com/ohmyzsh/ohmyzsh.git
|
|
version: 'latest'
|
|
dest: ~/.oh-my-zsh
|
|
depth: 1
|
|
|
|
- name: Setup .zshrc
|
|
become_user: gianm
|
|
copy:
|
|
src: files/zshrc
|
|
dest: ~/.zshrc
|
|
mode: 0644
|
|
|
|
- name: Setup .profile
|
|
become_user: gianm
|
|
copy:
|
|
src: files/profile
|
|
dest: ~/.profile
|
|
mode: 0644
|
|
|
|
- name: create local dir for node packages
|
|
become_user: gianm
|
|
file:
|
|
path: ~/.npm-global
|
|
state: directory
|
|
owner: gianm
|
|
mode: 0644
|
|
|
|
- name: EACCESS fix
|
|
become_user: gianm
|
|
command: npm config set prefix '~/.npm-global'
|
|
register: updated_npm
|
|
changed_when: updated_npm.rc != 0
|
|
|
|
- name: Remove temporary directory
|
|
file:
|
|
path: "{{ tmp_dir }}"
|
|
state: absent |