使用saltstack编译安装nginx
# pwd/srv/salt
# cat nginx.sls
include: //加载其他状态文件
- install
- pcre
nginx_init:
file.managed:
- name: /etc/init.d/nginx //nginx启动叫脚本文件
- source: salt://nginx
- user: root
- group: root
- mode: 755
nginx.tar.gz_file:
file.managed:
- name: /usr/local/src/nginx-1.8.1.tar.gz //nginx安装包
- source: salt://nginx-1.8.1.tar.gz
- user: root
- group: root
- mode: 755
nginx_install:
cmd.run:
- name: cd /usr/local/src && useradd -s /sbin/nologin nginx && tar xf nginx-1.8.1.tar.gz && cd nginx-1.8.1 && ./configure --prefix=/usr/local/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --with-http_ssl_module --with-http_flv_module --with-http_stub_status_module --with-http_gzip_static_module --http-client-body-temp-path=/var/tmp/nginx/client/ --http-proxy-temp-path=/var/tmp/nginx/proxy/ --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --with-pcre && make && make install && ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1
- unless: test -d /usr/local/src/nginx-1.8.1.tar.gz//判断文件是否存在,存在方可执行
service.running:
- name: nginx
- enable: True //启动nginx服务
页:
[1]