diff options
-rw-r--r-- | local.yml | 12 | ||||
-rw-r--r-- | tasks/dependencies.yml | 6 | ||||
-rw-r--r-- | tasks/dotfiles.yml | 4 | ||||
-rw-r--r-- | tasks/node.yml | 17 | ||||
-rw-r--r-- | tasks/sdkman.yml | 19 | ||||
-rw-r--r-- | tasks/ssh.yml | 4 | ||||
-rw-r--r-- | tasks/zsh.yml | 21 |
7 files changed, 51 insertions, 32 deletions
@@ -1,8 +1,8 @@ - hosts: localhost tasks: - - include: tasks/dependencies.yml - - include: tasks/zsh.yml - - include: tasks/ssh.yml - - include: tasks/node.yml - - include: tasks/sdkman.yml - - include: tasks/dotfiles.yml + - ansible.builtin.import_tasks: tasks/dependencies.yml + - ansible.builtin.import_tasks: tasks/zsh.yml + - ansible.builtin.import_tasks: tasks/ssh.yml + - ansible.builtin.import_tasks: tasks/node.yml + - ansible.builtin.import_tasks: tasks/sdkman.yml + - ansible.builtin.import_tasks: tasks/dotfiles.yml diff --git a/tasks/dependencies.yml b/tasks/dependencies.yml index 9332322..983fc48 100644 --- a/tasks/dependencies.yml +++ b/tasks/dependencies.yml @@ -1,13 +1,13 @@ - name: Update Aptitude become: true - apt: + ansible.builtin.apt:: update_cache: true - tags: + tags: - always - name: Install dependencies become: true - apt: + ansible.builtin.apt:: name: [curl, git, zsh, docker, fzf, tmux, stow, unzip, zip] tags: - always diff --git a/tasks/dotfiles.yml b/tasks/dotfiles.yml index cf64d9e..33a414c 100644 --- a/tasks/dotfiles.yml +++ b/tasks/dotfiles.yml @@ -1,5 +1,5 @@ - - name: Stow dotfiles - shell: cd dotfiles && for dir in *; do (stow $dir -t ~); done + ansible.builtin.shell: cd dotfiles && for dir in *; do (stow $dir -t ~); done + changed_when: true tags: - dotfiles diff --git a/tasks/node.yml b/tasks/node.yml index 39b5b07..9699e22 100644 --- a/tasks/node.yml +++ b/tasks/node.yml @@ -1,12 +1,19 @@ -- name: Install nvm - shell: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash - args: - warn: false +- name: Fetch nvm installation script + ansible.builtin.get_url: + url: https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh + dest: /tmp/nvm_install.sh + mode: '0755' + tags: + - node + +- name: Run nvm installation script + ansible.builtin.command: /tmp/nvm_install.sh + changed_when: true tags: - node - name: Enable nvm - lineinfile: + ansible.builtin.lineinfile: path: "~/.config/zsh/.zshrc" line: | export NVM_DIR=~/.nvm diff --git a/tasks/sdkman.yml b/tasks/sdkman.yml index 638912f..e87a4c0 100644 --- a/tasks/sdkman.yml +++ b/tasks/sdkman.yml @@ -1,12 +1,19 @@ -- name: Install sdkman - shell: curl -s "https://get.sdkman.io?rcupdate=false" | bash - args: - warn: false +- name: Fetch sdkman installation script + ansible.builtin.get_url: + url: https://get.sdkman.io?rcupdate=false + dest: /tmp/sdkman_install.sh + mode: '0755' + tags: + - sdkman + +- name: Run sdkman installation script + ansible.builtin.command: /tmp/sdkman_install.sh + changed_when: true tags: - sdkman - name: Enable sdkman - lineinfile: + ansible.builtin.lineinfile: path: "~/.config/zsh/.zshrc" line: | #THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!! @@ -16,7 +23,7 @@ - sdkman - name: Configure sdkman_auto_env - lineinfile: + ansible.builtin.lineinfile: path: "~/.sdkman/etc/config" regexp: '^sdkman_auto_env=' line: sdkman_auto_env=true diff --git a/tasks/ssh.yml b/tasks/ssh.yml index 5cb8a02..af4f923 100644 --- a/tasks/ssh.yml +++ b/tasks/ssh.yml @@ -1,9 +1,9 @@ - name: Copy SSH keys - copy: + ansible.builtin.copy: src: ./ssh/ dest: ~/.ssh owner: "{{ ansible_user_id }}" group: "{{ ansible_user_id }}" mode: '0600' - tags: + tags: - ssh diff --git a/tasks/zsh.yml b/tasks/zsh.yml index e0a1251..5301496 100644 --- a/tasks/zsh.yml +++ b/tasks/zsh.yml @@ -1,35 +1,40 @@ - name: Change default shell become: true - shell: "chsh -s $(which zsh) {{ ansible_user_id }}" + ansible.builtin.shell: "usermod -s $(which zsh) {{ ansible_user_id }}" + changed_when: true tags: - zsh - + - name: Create .zshenv - shell: "echo \"ZDOTDIR=~/.config/zsh\" > ~/.zshenv" + ansible.builtin.shell: "echo \"ZDOTDIR=~/.config/zsh\" > ~/.zshenv" + changed_when: true tags: - zsh - name: Install Oh My Zsh - shell: zsh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" + ansible.builtin.shell: zsh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" + changed_when: true tags: - zsh - name: Install zsh-autosuggestions plugin - git: + ansible.builtin.git: repo: 'https://github.com/zsh-users/zsh-autosuggestions.git' dest: "~/.config/zsh/ohmyzsh/plugins/zsh-autosuggestions" + version: master tags: - zsh - name: Install zsh-syntax-highlighting plugin - git: + ansible.builtin.git: repo: 'https://github.com/zsh-users/zsh-syntax-highlighting.git' dest: "~/.config/zsh/ohmyzsh/plugins/zsh-syntax-highlighting" + version: master tags: - zsh - name: Enable ZSH plugins - lineinfile: + ansible.builtin.lineinfile: path: "~/.config/zsh/.zshrc" regexp: '^plugins=' line: plugins=(git tmux zsh-autosuggestions zsh-syntax-highlighting) @@ -37,7 +42,7 @@ - zsh - name: Enable tmux autostart - lineinfile: + ansible.builtin.lineinfile: path: "~/.config/zsh/.zshrc" line: | if [[ -z $TMUX ]]; then |