ansible安装nginx

下载nginx对应版本的tar包到ansible管理机器,通过传输到远程节点进行远程安装;

playbook如下:

---
- hosts: 10.10.84.5
  tasks:
      - name: copy ngnx
        copy: src=/root/nginx-1.14.2.tar.gz dest=/usr/local mode=0755

      - name: unarchive-tomcat.tar.gz
        unarchive: src=/usr/local/nginx-1.14.2.tar.gz dest=/usr/local copy=no mode=0755

      - name: install and start nginx
        shell: cd /usr/local/nginx-1.14.2 && ./configure && make && make install && cd /usr/local/nginx/sbin/ && ./nginx

 

posted @ 2020-06-10 17:23  王能武  阅读(417)  评论(0编辑  收藏  举报