ansible源码安装php,部署论坛

  • hosts: web
    remote_user: root
    tasks:
    • name: yum
      yum: name=gcc,gcc-c++,gd,libjpeg-devel,libpng-devel,zlib-devel,openssl-devel,pcre-devel,libxml2-devel
    • name: unarchive
      unarchive: src=/root/php-7.2.0.tar.gz dest=/root/
    • name: shell configure
      shell: ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --enable-mbstring --with-gd --with-zlib --with-jpeg-dir=/usr/lib --enable-fpm && make && make install
      args:
      chdir: /root/php-7.2.0
    • name: copy php.ini
      copy: src=/root/php-7.2.0/php.ini-development dest=/usr/local/php/php.ini remote_src=yes
    • name: replace
      replace: path=/usr/local/php/php.ini regexp=‘short_open_tag = Off’ replace=‘short_open_tag = On’
    • name: copy php-fpm
      copy: src=/root/php-7.2.0/sapi/fpm/init.d.php-fpm dest=/etc/init.d/php-fpm remote_src=yes
    • name: file modify the properties
      file: path=/etc/init.d/php-fpm mode=0755 state=file
    • name: copy php-fpm.conf
      copy: src=/usr/local/php/etc/php-fpm.conf.default dest=/usr/local/php/etc/php-fpm.conf remote_src=yes
    • name: replace
      replace: path=/usr/local/php/etc/php-fpm.conf regexp=’;pid = run/php-fpm.pid’ replace=‘pid = run/php-fpm.pid’
    • name: replace
      replace: path=/usr/local/php/etc/php-fpm.conf regexp=’;emergency_restart_interval = 10’ replace=‘emergency_restart_interval = 20s’
    • name: replace
      replace: path=/usr/local/php/etc/php-fpm.conf regexp=’;error_log = log/php-fpm.log’ replace=‘error_log = log/php-fpm.log’
    • name: replace
      replace: path=/usr/local/php/etc/php-fpm.conf regexp=’;emergency_restart_threshold = 0’ replace=‘emergency_restart_threshold = 10’
    • name: replace
      replace: path=/usr/local/php/etc/php-fpm.conf regexp=’;process.max = 128’ replace=‘process.max = 128’
    • name: replace
      replace: path=/usr/local/php/etc/php-fpm.conf regexp=’;rlimit_files = 1024’ replace=‘rlimit_files = 1024’
    • name: replace
      replace: path=/usr/local/php/etc/php-fpm.conf regexp=’;events.mechanism = epoll’ replace=‘events.mechanism = epoll’
    • name: copy www.conf
      copy: src=/usr/local/php/etc/php-fpm.d/www.conf.default dest=/usr/local/php/etc/php-fpm.d/www.conf remote_src=yes
    • name: replace
      replace: path=/usr/local/nginx/conf/nginx.conf regexp=’ index index.html index.htm;’ replace=’ index index.php index.html index.htm;’
    • name: shell sed
      shell: sed -i ‘65,71 s/#/ /’ /usr/local/nginx/conf/nginx.conf
    • name: replace
      replace: path=/usr/local/nginx/conf/nginx.conf regexp=’ include fastcgi_params;’ replace=’ include fastcgi.conf;’
    • name: shell
      shell: /etc/init.d/php-fpm restart
    • name: service
      service: name=nginx state=restarted
    • name: unarchive
      unarchive: src=/root/ComsenzDiscuz-DiscuzX-master.zip dest=/root
    • name: delete
      shell: rm -rf /usr/local/nginx/html/*
    • name: shell upload
      shell: cp -r /root/DiscuzX/upload /usr/local/nginx/html
    • name: file
      file: path=/usr/local/nginx/html/upload mode=0777 recurse=yes

你可能感兴趣的:(ansible源码安装php,部署论坛)