微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ansible-构建NGINX

playbook编写编译安装@R_404_5171@剧本

 

剧本如下:

[dwchensenwen@vms20 script]$ cat @R_404[email protected] 
---
- hosts: test
  become: yes
  become_method: sudo
  tasks:
  - name: 安装依赖包
    yum: name={{ item }} state=latest
    with_items:
      - pcre-devel
      - openssl-devel

  - name: 创建一个管理@R_404_5171@进程的虚拟用户
    user: name=www shell=/sbin/nologin/ state=present

  - name: 创建目录
    command: >
      mkdir -p /server/tools
      mkdir -p /application       

  - name: 下载@R_404_5171@软件包
    get_url: 
      url: http://@R_404[email protected]/download/@R_404[email protected]
      dest: /server/tools/@R_404[email protected]
      mode: 0755

  - name: 解压@R_404_5171@软件包
    command: >
      tar -C /server/tools -xvf /server/tools/@R_404[email protected]

  - name: 编译安装@R_404_5171@
    shell: cd /server/tools/@R_404[email protected];./configure --prefix=/application/@R_404[email protected] --user=www --group=www --with-http_ssl_module --with-http_stub_status_module;make && make install

  - name: @R_404_5171@程序软件创建链接目录
    file: src=/application/@R_404[email protected] dest=/application/@R_404_5171@ state=link

  - name: 启动@R_404_5171@程序服务
    shell: /application/@R_404_5171@/sbin/@R_404_5171@

运行结果:

查看远端@R_404_5171@服务

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐