view tasks/setting-wordpress.yml @ 5:774156afc195

update wordpress and add httpd restart
author k178572
date Sat, 21 Oct 2017 20:18:33 +0900
parents 10185cc821e4
children 4545b6456623
line wrap: on
line source

    - name: WordPress Download
      get_url: url="https://ja.wordpress.org/wordpress-4.8.2-ja.tar.gz" dest=/tmp

    - name: unarchive source
      become: yes
      command: tar zxvf /tmp/wordpress-4.8.2-ja.tar.gz chdir=/var/www/html

    - name: change dir / files permission
      become: yes
      file: path=/var/www/html/wordpress owner=apache group=apache mode=0755 recurse=yes state=directory

    - name: replace /etc/httpd/conf/httpd.conf
      become: yes
      replace: dest=/etc/httpd/conf/httpd.conf regexp='^DocumentRoot "/var/www/html"$' replace='DocumentRoot "/var/www/html/wordpress"' backup=yes

    - name: replace /etc/httpd/conf/httpd.conf
      become: yes
      replace: dest=/etc/httpd/conf/httpd.conf regexp='^<Directory "/var/www">$' replace='<Directory "/var/www/wordpress">' backup=yes

    - name: replace /etc/httpd/conf/httpd.conf
      become: yes
      replace: dest=/etc/httpd/conf/httpd.conf regexp='^AllowOverride None$' replace='AllowOverride All' backup=yes

    - name: cp wp-config.php
      become: yes
      command: cp '/var/www/html/wordpress/wp-config-sample.php' '/var/www/html/wordpress/wp-config.php' creates=/var/www/html/wordpress/wp-config.php

    - name: replace /var/www/html/wordpress/wp-config.php
      become: yes
      replace: dest=/var/www/html/wordpress/wp-config.php regexp='database_name_here' replace='wordpress'

    - name: replace /var/www/html/wordpress/wp-config.php
      become: yes
      replace: dest=/var/www/html/wordpress/wp-config.php regexp='username_here' replace='wordpress'

    - name: replace /var/www/html/wordpress/wp-config.php
      become: yes
      replace: dest=/var/www/html/wordpress/wp-config.php regexp='password_here' replace='hZzTwWuTeN'

    - name: httpd restart
      service: name=httpd state=restarted
      become: yes