blob: 0e6f5a93e16658558af26e5a4fd7287b9db43854 [file] [log] [blame]
Adrià Vilanova Martínez166f67f2024-09-29 12:32:38 +02001- name: Ensure we know what version of node to install
2 assert:
3 that: node_version is defined
4
Adrià Vilanova Martínez8fe52132024-09-29 12:43:09 +02005- name: Check installed Node version
Adrià Vilanova Martínez16b9f462024-05-04 01:08:33 +02006 command: node --version
Adrià Vilanova Martínez8fe52132024-09-29 12:43:09 +02007 register: node_installed_version
8 failed_when: false
Adrià Vilanova Martínez16b9f462024-05-04 01:08:33 +02009
Adrià Vilanova Martínez8fe52132024-09-29 12:43:09 +020010- name: Install NodeJS when it is not installed with the required version
11 include_tasks: install-nodejs.yaml
12 when:
13 - node_installed_version.rc != 0 or
14 (node_version | string | trim) !=
15 (node_installed_version.stdout
16 | regex_replace('^v(?P<majorVersion>[^.]+).*$', '\\g<majorVersion>')
17 | trim)