diff --git a/discord_install.yml b/discord_install.yml new file mode 100644 index 0000000..0041b8d --- /dev/null +++ b/discord_install.yml @@ -0,0 +1,29 @@ +- hosts: localhost + connection: local + become: yes + + vars: + discord_url: https://discordapp.com/api/download?format=deb&platform=linux + discord_tmp: /tmp/discord + + tasks: + + - name: DISCORD - Creates temporary directory + file: + path: "{{ discord_tmp }}" + state: directory + + - name: DISCORD - Download discord + get_url: + url: "{{ discord_url }}" + dest: "{{ discord_tmp }}/discord.deb" + force: yes + + - name: DISCORD - Install my_package + apt: + deb: "{{ discord_tmp }}/discord.deb" + + - name: DISCORD - Remove temporary directory + file: + path: "{{ discord_tmp }}" + state: absent \ No newline at end of file diff --git a/files/zshrc b/files/zshrc index c8e0aee..49ceb48 100644 --- a/files/zshrc +++ b/files/zshrc @@ -101,6 +101,3 @@ source $ZSH/oh-my-zsh.sh # alias ohmyzsh="mate ~/.oh-my-zsh" source ~/.profile -#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!! -export SDKMAN_DIR="$HOME/.sdkman" -[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh" diff --git a/local.yml b/local.yml index 285cadf..18c8942 100644 --- a/local.yml +++ b/local.yml @@ -1,6 +1,12 @@ --- - 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 @@ -8,25 +14,60 @@ - username: gianm tasks: - - name: add to repository nodejs - become: true - shell: curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - + - name: Creates temporary directory + file: + path: "{{ tmp_dir }}" + state: directory - - name: Set zsh main as shell + - name: get script to add repository nodejs become: true when: ansible_facts['os_family'] == "Debian" - shell: apt update + 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: Basic dev install + - 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: - - zsh - - nodejs + name: "{{ item }}" + state: present + with_items: "{{ packages }}" - - name: Set zsh main as shell + - name: Set zsh main as command become: true - shell: chsh -s $(which zsh) gianm + command: chsh -s $(which zsh) gianm + register: shell_change + changed_when: shell_change.rc != 0 - name: check if on my zsh is installed stat: @@ -42,6 +83,7 @@ become_user: gianm git: repo: https://github.com/ohmyzsh/ohmyzsh.git + version: 'latest' dest: ~/.oh-my-zsh depth: 1 @@ -59,6 +101,27 @@ dest: ~/.profile mode: 0644 - - name: Setup .profile + - 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 + + - name: Setup done rebooting become: true - shell: reboot \ No newline at end of file + command: reboot + register: rebooting + changed_when: rebooting.rc != 0 \ No newline at end of file diff --git a/setup.sh b/setup.sh index 6fec2d8..27cadcd 100644 --- a/setup.sh +++ b/setup.sh @@ -1,4 +1,4 @@ #! bin/bash wget https://git.jatus.tech/Jatus/workstation-setup/raw/branch/main/requirments.yml ansible-galaxy install -r requirments.yml -ansible-pull -U https://git.jatus.tech/Jatus/workstation-setup.git -K \ No newline at end of file +ansible-pull -U https://git.jatus.tech/Jatus/workstation-setup.git -K --ask-vault-pass \ No newline at end of file diff --git a/vars/packages.yml b/vars/packages.yml new file mode 100644 index 0000000..6b776ac --- /dev/null +++ b/vars/packages.yml @@ -0,0 +1,2 @@ +--- +packages: ["zsh", "yadm", "nodejs","firefox","chromium"]