--- - hosts: "{{ hosts }}" vars: old_nginx_dir: /usr/local/nginx src: /usr/local/src version: nginx-1.12.2 remote_user: root tasks: - name: yum install devel yum: name={{ item }} state=present with_items: - gcc - gcc-c++ - wget - name: down {{ version }} and unzip shell: cd {{ src }}&&wget http://nginx.org/download/{{ version }}.tar.gz&&tar -xf {{ version }}.tar.gz - name: get old vars shell: "{{ old_nginx_dir }}/sbin/nginx -V 2>&1|grep configure|cut -d : -f2" register: old_argv - name: install nginx shell: cd {{ src }}/{{ version }}&&./configure {{ old_argv.stdout }}&&make - name: mv old nginx shell: mv -f {{ old_nginx_dir }}/sbin/nginx{,.bak} - name: copy nginx bin to new nginx bin shell: cp -a {{src}}/{{version}}/objs/nginx {{ old_nginx_dir }}/sbin/nginx - name: update process shell: cd {{src}}/{{version}}&&make upgrade
版权归属:
Administrator
许可协议:
本文使用《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》协议授权
评论区