Skip to content

Commit 3c2b2a7

Browse files
fee1-deadjdno
andauthored
check if node is already installed and use apt module
Co-authored-by: Jan David <jdno@jdno.dev>
1 parent a109d68 commit 3c2b2a7

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

ansible/roles/dev-desktop/tasks/main.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,22 @@
186186
- gcc-multilib # for 32 bit cross compiles of libstd and tests
187187
state: present
188188

189-
- name: Install Nodejs
189+
- name: Check if Node is installed
190+
command: node --version
191+
register: node_version
192+
changed_when: false
193+
failed_when: node_version.rc != 0 and node_version.rc != 2
194+
195+
- name: Set up NodeSource repository
190196
shell: |
191197
curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
192-
apt-get install -y nodejs
198+
when: node_version.rc == 2
199+
200+
- name: Install Node
201+
apt:
202+
name: nodejs
203+
state: present
204+
update_cache: yes
193205

194206
- name: Set up the git credential helper user
195207
user:

0 commit comments

Comments
 (0)