通用-3_install_nodepm2.yaml
- 脚本内容
- hosts: prod vars: user_path: /home/ubuntu tasks: - name: Download Nodejs deb become: yes get_url: url: https://deb.nodesource.com/setup_18.x dest: "{{ user_path }}" mode: 0755 - name: Load Nodejs deb become: yes command: "bash {{ user_path }}/setup_18.x" - name: Install Nodejs become: yes apt: name: nodejs - name: Install pm2 become: yes command: "npm install -g pm2"