“Saltstack state安装nignx”的版本间的差异
跳到导航
跳到搜索
第1行: | 第1行: | ||
− | == | + | =ins= |
ip 192.168.88.60 ubuntu18.04 | ip 192.168.88.60 ubuntu18.04 | ||
第25行: | 第25行: | ||
</pre> | </pre> | ||
+ | == 编写pcre安装文件== | ||
+ | <pre> | ||
+ | vi /srv/salt/prod/pcre/install.sls | ||
+ | pcre-source-install: | ||
+ | file.managed: | ||
+ | - name: /usr/local/src/pcre-8.42.tar.bz2 | ||
+ | - source: salt://pcre/files/pcre-8.42.tar.bz2 | ||
+ | - user: root | ||
+ | - group: root | ||
+ | - mode: 755 | ||
+ | cmd.run: | ||
+ | - name: cd /usr/local/src && tar xvf pcre-8.42.tar.bz2 && cd pcre-8.42 && ./configure --prefix=/usr/local/pcre && make && make install | ||
+ | - unless: test -d /usr/local/pcre | ||
+ | - require: | ||
+ | - file: pcre-source-install | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | |||
+ | == 编写nginx安装文件== | ||
+ | |||
+ | <pre> | ||
+ | vi /srv/salt/prod/pcre/install.sls | ||
+ | pcre-source-install: | ||
+ | file.managed: | ||
+ | - name: /usr/local/src/pcre-8.42.tar.bz2 | ||
+ | - source: salt://pcre/files/pcre-8.42.tar.bz2 | ||
+ | - user: root | ||
+ | - group: root | ||
+ | - mode: 755 | ||
+ | cmd.run: | ||
+ | - name: cd /usr/local/src && tar xvf pcre-8.42.tar.bz2 && cd pcre-8.42 && ./configure --prefix=/usr/local/pcre && make && make install | ||
+ | - unless: test -d /usr/local/pcre | ||
+ | - require: | ||
+ | - file: pcre-source-install | ||
+ | root@myxps:/srv/salt/prod# cat /srv/salt/prod/nginx/install.sls | ||
+ | include: | ||
+ | - pcre.install | ||
+ | - user.www | ||
+ | |||
+ | nginx-source-install: | ||
+ | file.managed: | ||
+ | - name: /usr/local/src/nginx-1.20.1.tar.gz | ||
+ | - source: salt://nginx/files/nginx-1.20.1.tar.gz | ||
+ | - user: root | ||
+ | - group: root | ||
+ | - mode: 755 | ||
+ | cmd.run: | ||
+ | - name: cd /usr/local/src && tar xvf nginx-1.20.1.tar.gz && cd nginx-1.20.1 && ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-file-aio --with-http_dav_module --with-pcre=/usr/local/src/pcre-8.42 --without-http_gzip_module && make && make install && chown -R www:www /usr/local/nginx | ||
+ | - unless: test -d /usr/local/nginx | ||
+ | - require: | ||
+ | - user: www-user-group | ||
+ | - file: nginx-source-install | ||
+ | - cmd: pcre-source-install | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | |||
+ | == == | ||
+ | <pre> | ||
+ | |||
+ | </pre> | ||
=see also= | =see also= | ||
2021年8月12日 (四) 02:32的版本
ins
ip 192.168.88.60 ubuntu18.04
前提 已安装好 master minion
创建目录 mkdir -p /srv/salt/prod/pcre/files/ mkdir -p /srv/salt/prod/nginx/files/ 下载pcre和nginx源码包保存到各自的files目录下 root@myxps:/srv/salt/prod# ls nginx/files/ nginx-1.20.1.tar.gz openssl-1.1.1k.tar.gz wget https://ftp.pcre.org/pub/pcre/pcre-8.42.tar.bz2 root@myxps:/srv/salt/prod# ls pcre/files/ pcre-8.42.tar.bz2
编写pcre安装文件
vi /srv/salt/prod/pcre/install.sls pcre-source-install: file.managed: - name: /usr/local/src/pcre-8.42.tar.bz2 - source: salt://pcre/files/pcre-8.42.tar.bz2 - user: root - group: root - mode: 755 cmd.run: - name: cd /usr/local/src && tar xvf pcre-8.42.tar.bz2 && cd pcre-8.42 && ./configure --prefix=/usr/local/pcre && make && make install - unless: test -d /usr/local/pcre - require: - file: pcre-source-install
编写nginx安装文件
vi /srv/salt/prod/pcre/install.sls pcre-source-install: file.managed: - name: /usr/local/src/pcre-8.42.tar.bz2 - source: salt://pcre/files/pcre-8.42.tar.bz2 - user: root - group: root - mode: 755 cmd.run: - name: cd /usr/local/src && tar xvf pcre-8.42.tar.bz2 && cd pcre-8.42 && ./configure --prefix=/usr/local/pcre && make && make install - unless: test -d /usr/local/pcre - require: - file: pcre-source-install root@myxps:/srv/salt/prod# cat /srv/salt/prod/nginx/install.sls include: - pcre.install - user.www nginx-source-install: file.managed: - name: /usr/local/src/nginx-1.20.1.tar.gz - source: salt://nginx/files/nginx-1.20.1.tar.gz - user: root - group: root - mode: 755 cmd.run: - name: cd /usr/local/src && tar xvf nginx-1.20.1.tar.gz && cd nginx-1.20.1 && ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-file-aio --with-http_dav_module --with-pcre=/usr/local/src/pcre-8.42 --without-http_gzip_module && make && make install && chown -R www:www /usr/local/nginx - unless: test -d /usr/local/nginx - require: - user: www-user-group - file: nginx-source-install - cmd: pcre-source-install
see also
https://github.com/tjkt/saltstack-nginx/tree/master/salt