Compare commits

..

3 Commits

Author SHA1 Message Date
8359688c44 Add the nvm role to the systems
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Signed-off-by: Noah Knegt <git@noahknegt.com>
2023-04-06 10:25:14 +02:00
f7a7e6f967 Workout the nvm install role
Signed-off-by: Noah Knegt <git@noahknegt.com>
2023-04-06 10:24:33 +02:00
d821693e33 Add default folder structure for the role
Signed-off-by: Noah Knegt <git@noahknegt.com>
2023-04-06 10:14:09 +02:00
14 changed files with 102 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
---
# defaults file for nvm

0
roles/nvm/files/temp Normal file
View File

View File

@@ -0,0 +1,2 @@
---
# handlers file for nvm

View File

@@ -0,0 +1,13 @@
# ===================================================================================================
# ? ABOUT
# @author : Noah Knegt
# @email : personal@noahknegt.com
# @repo : https://git.noahknegt.com/noah.knegt/ansible-automations
# @createdOn : 06-04-2023
# @description : This will check if nvm is installed as the latest version.
# ===================================================================================================
---
- name: Check nvm version
shell: nvm --version
register: nvm_version

View File

@@ -0,0 +1,22 @@
# ===================================================================================================
# ? ABOUT
# @author : Noah Knegt
# @email : personal@noahknegt.com
# @repo : https://git.noahknegt.com/noah.knegt/ansible-automations
# @createdOn : 06-04-2023
# @description : This will cleanup the system.
# ===================================================================================================
---
- name: Cleanup
file:
path: "{{ item }}"
state: absent
with_items:
- /tmp/nvm-install.sh
- /tmp/nvm-install.log
- /tmp/nvm-install.out
- /tmp/nvm-install.err
- /tmp/nvm-install.debug
- /tmp/nvm-install.info
- /tmp/nvm-install.warn

View File

@@ -0,0 +1,16 @@
# ===================================================================================================
# ? ABOUT
# @author : Noah Knegt
# @email : personal@noahknegt.com
# @repo : https://git.noahknegt.com/noah.knegt/ansible-automations
# @createdOn : 06-04-2023
# @description : This will download the nvm install script.
# ===================================================================================================
---
- name: Download nvm
get_url:
url: https://raw.githubusercontent.com/nvm-sh/nvm/{{ nvm_latest_version.stdout }}/install.sh
dest: /tmp/nvm-install.sh
mode: 0755
when: nvm_version.stdout != nvm_latest_version.stdout

View File

@@ -0,0 +1,13 @@
# ===================================================================================================
# ? ABOUT
# @author : Noah Knegt
# @email : personal@noahknegt.com
# @repo : https://git.noahknegt.com/noah.knegt/ansible-automations
# @createdOn : 06-04-2023
# @description : This will get the latest version of nvm.
# ===================================================================================================
---
- name: Get the latest nvm version
shell: curl -s https://api.github.com/repos/nvm-sh/nvm/releases/latest | grep tag_name | cut -d '"' -f 4
register: nvm_latest_version

View File

@@ -0,0 +1,15 @@
# ===================================================================================================
# ? ABOUT
# @author : Noah Knegt
# @email : personal@noahknegt.com
# @repo : https://git.noahknegt.com/noah.knegt/ansible-automations
# @createdOn : 06-04-2023
# @description : This will install nvm as the latest version.
# ===================================================================================================
---
- name: Install nvm
shell: /tmp/nvm-install.sh
args:
creates: /home/noahk/.nvm
when: nvm_version.stdout != nvm_latest_version.stdout

9
roles/nvm/tasks/main.yml Normal file
View File

@@ -0,0 +1,9 @@
---
- import_tasks: check_installed.yml
- import_tasks: get_version.yml
- import_tasks: download.yml
- import_tasks: install.yml
- import_tasks: cleanup.yml

View File

View File

@@ -0,0 +1,2 @@
localhost

5
roles/nvm/tests/test.yml Normal file
View File

@@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- nvm

2
roles/nvm/vars/main.yml Normal file
View File

@@ -0,0 +1,2 @@
---
# vars file for nvm

View File

@@ -18,6 +18,7 @@
remote_user: ansible remote_user: ansible
roles: roles:
- role: docker - role: docker
- role: nvm
# Clean up the system # Clean up the system
- hosts: datacenter - hosts: datacenter