简体   繁体   中英

Install ngnix on ubuntu 20.04 using ansible playbook?

Hi i am new to ansible i have to deploy nodejs12.8.4, SSL and ngnix latest to Ubuntu 20.04 server can someone guide me how to do it thank you.

this is my yml file:

  hosts: all
  become: true
  tasks:
    - name: install nodejs prerequisites
      apt:
        name:
          - apt-transport-https
          - gcc
          - g++
          - make
        state: present
    - name: add nodejs apt key
      apt_key:
        url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
        state: present
    - name: add nodejs repository
      apt_repository:
        repo: deb https://deb.nodesource.com/node_12.x {{ ansible_lsb.codename }} main
        state: present
        update_cache: yes
    - name: install nodejs
      apt:
        name: nodejs
        state: present

it install nodejs 12 now i want to install nginx in same file how i add new task.

Try Ansible NGINX Role . See details at Github .


Q: " I want to install Nginx in the same file how I add a new task?"

A: Include the role

    - include_role:
        name: nginx

Download the role. See Roles and Using Roles in particular.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM