반응형
## nodejs 14.15.4, npm 6.14.10
---
- name: "NPM, NODEJS INSTALL"
become: true
hosts : all
gather_facts: no
tasks:
- name: "install wget"
yum:
name: wget
state: installed
- name: "repo download"
get_url:
url: https://rpm.nodesource.com/setup_lts.x
dest: /tmp/node_setup.sh
- name: "repo install"
shell: /bin/bash /tmp/node_setup.sh
- name: "install nodejs"
yum:
name: "{{ item }}"
state: installed
loop:
- nodejs-14.15.4
- name: "result"
command: "{{ item }}"
register: abc
with_items:
- npm --version
- node --version
- debug:
msg:
- "npm version : {{ abc.results[0].stdout }}"
- "nodejs version : {{ abc.results[1].stdout }}"
# var: abc | json_query('results[0].stdout')
반응형
'Automation Tools > Ansible' 카테고리의 다른 글
9. ansible | windows winrm을 이용한 ansible 사용 (0) | 2022.04.27 |
---|---|
8.5 ansible | [playbook] docker 설치 (0) | 2021.03.16 |
8.3 ansible | [playbook] centos6 yum repository 변경 (0) | 2021.03.16 |
8.2 ansible | [playbook] Linux service 상태 변경 (0) | 2021.03.16 |
8.1 ansible | [playbook] Linux user 추가 (0) | 2021.03.16 |