Zulfiqar Mukhtar
Zulfiqar Mukhtar

Reputation: 1

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.

Upvotes: 0

Views: 938

Answers (1)

Vladimir Botka
Vladimir Botka

Reputation: 68104

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.

Upvotes: 1

Related Questions