In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article to share with you is about how to deploy Nginx in batches in Ansible, Xiaobian feels quite practical, so share it with you to learn, I hope you can gain something after reading this article, not much to say, follow Xiaobian to see it.
1.1 Copy the nginx installation package and installation script to the client, and install the script
vim /ansible/roles/nginx/tasks/nginx.yml- name: copy nginx_tar_gz to client copy: src=nginx-1.8.0.tar.gz dest=/tmp/nginx-1.8.0.tar.gz- name: copy install_shell to client copy: src=install_nginx.sh dest=/tmp/install_nginx.sh- name: install nginx shell: /bin/bash /tmp/install_nginx.sh
1.2 Nginx Installation Script
vim /ansible/roles/nginx/files/install_nginx.sh#!/ bin/bashyum -y install zlib zlib-devel openssl openssl-devel pcre-develgroupadd -r nginxuseradd -s /sbin/nologin -g nginx -r nginxcd /tmptar xf nginx-1.8.0.tar.gz;cd nginx-1.8.0mkdir /application/nginx/;chown nginx.nginx /application/nginx/./ configure \--prefix=/usr \--sbin-path=/usr/sbin/nginx \--conf-path=/etc/nginx/nginx.conf \--error-log-path=/var/log/nginx/error.log \--pid-path=/application/nginx/nginx.pid \--user=nginx \--group=nginx \--with-http_ssl_modulemake && make installegrep -v "#|^$" /etc/nginx/nginx.conf >/etc/nginx/nginx.conf.bakrm -rf /etc/nginx/nginx.confmv /etc/nginx/nginx.conf.bak /etc/nginx/nginx.confsed -i "/^\s*index / i proxy_pass http://localhost:8080;" /etc/nginx/nginx.conf/usr/sbin/nginx
1.3 Execute the ansible command
cd /ansibleansible-playbook nginx.yml --syntax-check #check syntax ansible-playbook nginx.yml #execute the above is how to deploy Nginx in bulk in Ansible, Xiaobian believes that some knowledge points may be seen or used in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.