簡體   English   中英

使用 ansible playbook 在 ubuntu 20.04 上安裝 ngnix?

[英]Install ngnix on ubuntu 20.04 using ansible playbook?

嗨,我是 ansible 的新手,我必須將最新的 nodejs12.8.4、SSL 和 ngnix 部署到 Ubuntu 20.04 服務器,有人可以指導我如何做,謝謝。

這是我的 yml 文件:

  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

它現在安裝 nodejs 12 我想在同一個文件中安裝 nginx 我如何添加新任務。

嘗試Ansible NGINX 角色 請參閱Github 上的詳細信息。


問:“我想在同一個文件中安裝 Nginx,我如何添加新任務?”

A: 包含角色

    - include_role:
        name: nginx

下載角色。 請特別參閱角色使用角色

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM