4.2-ansible Instance-Installing Nginx

Source: Internet
Author: User

* Define MAIN.YML and call copy and install. Any directory must have a total entry profile main.yml

Vim/etc/ansible/nginx_install/roles/install/tasks/main.yml #内容如下

-Include:copy.yml

-Include:install.yml

To this two roles:common and install the definition is complete, next to define a program total Portal configuration file


* Define INSTALL/INSTALL.YML Master Entry profile to invoke the secondary total configuration file

Vim/etc/ansible/nginx_install/install.yml #内容如下

---

-Hosts:testhost

Remote_user:root

Gather_facts:true

Roles

-Common

-Install

Description: Define the client hosts remote user identity to open the client information collection via the Roles module to invoke the general profile main.yml under the common and install folders to execute the command.


Finally, the server executes the command: ANSIBLE-PLAYBOOK/ETC/ANSIBLE/NGINX_INSTALL/INSTALL.YML


After execution completes, the client checks whether the success

1.rpm-qa |egrep ' Pcre|openssl|zlib ' #是否安装了指定依赖包

2.ls/usr/local/nginx/#是否复制了文件

3.ps aux |grep nginx #是否启动nginx

4.chkconfig--list Nginx #是否开机启动



Summary:/ETC/ANSIBLE/NGINX_INSTALL/INSTALL.YML defines the total installation profile, calls the Main.yml installation dependency package under Roles/common/tasks, and calls roles/install/ Tasks under the MAIN.YML to create users, copy files and other operations. The variables referenced during the execution of the file are defined from the ROLES/INSTALL/VARS/MAIN.YML.

/etc/ansible/nginx_install/is the main directory, the roles is a first-level directory, under the two-level directory, such as common and install the difference in order and functional purposes. Under the three level directory, the core task is tasks, files are required for file, define variable VARs, etc.


4.2-ansible Instance-install under Nginx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.