# HG changeset patch # User k178572 # Date 1505898735 -32400 # Node ID 10185cc821e42d0ab4e50bd62939f1d4c556862b add diff -r 000000000000 -r 10185cc821e4 hosts --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hosts Wed Sep 20 18:12:15 2017 +0900 @@ -0,0 +1,1 @@ +test-fedora diff -r 000000000000 -r 10185cc821e4 main.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.yml Wed Sep 20 18:12:15 2017 +0900 @@ -0,0 +1,11 @@ +- hosts: all + user: mitsuki + tasks: + - include: tasks/install-firewalld.yml + - include: tasks/setting-firewalld.yml + - include: tasks/install-httpd.yml + - include: tasks/install-php.yml + - include: tasks/install-mariadb.yml + - include: tasks/install-php-mbstring.yml + - include: tasks/setting-mariadb.yml + - include: tasks/setting-wordpress.yml diff -r 000000000000 -r 10185cc821e4 tasks/install-firewalld.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tasks/install-firewalld.yml Wed Sep 20 18:12:15 2017 +0900 @@ -0,0 +1,5 @@ + - name: install dnf python-firewall + become: yes + dnf: name={{ item }} state=latest + with_items: + - python-firewall diff -r 000000000000 -r 10185cc821e4 tasks/install-httpd.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tasks/install-httpd.yml Wed Sep 20 18:12:15 2017 +0900 @@ -0,0 +1,13 @@ + - name: install dnf packages + become: yes + dnf: name={{ item }} state=latest + with_items: + - httpd + + # start httpd + - service: name=httpd state=restarted + become: yes + + # chkconfig enabled httpd + - service: name=httpd enabled=yes + become: yes diff -r 000000000000 -r 10185cc821e4 tasks/install-mariadb.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tasks/install-mariadb.yml Wed Sep 20 18:12:15 2017 +0900 @@ -0,0 +1,16 @@ + - name: install dnf packages + dnf: name={{ item }} state=latest + become: yes + with_items: + - mariadb + - mariadb-server + - MySQL-python + +# start mariadb + - service: name=mariadb state=restarted + become: yes + +# chkconfig enabled mariadb + - service: name=mariadb enabled=yes + become: yes + diff -r 000000000000 -r 10185cc821e4 tasks/install-php-mbstring.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tasks/install-php-mbstring.yml Wed Sep 20 18:12:15 2017 +0900 @@ -0,0 +1,5 @@ + - name: install dnf packages + become: yes + dnf: name={{ item }} state=latest + with_items: + - php-mbstring diff -r 000000000000 -r 10185cc821e4 tasks/install-php.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tasks/install-php.yml Wed Sep 20 18:12:15 2017 +0900 @@ -0,0 +1,6 @@ + - name: install dnf packages + become: yes + dnf: name={{ item }} state=latest + with_items: + - php + - php-mysqlnd diff -r 000000000000 -r 10185cc821e4 tasks/setting-firewalld.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tasks/setting-firewalld.yml Wed Sep 20 18:12:15 2017 +0900 @@ -0,0 +1,10 @@ +- name: Setting Firewalld + firewalld: permanent=true service={{ item.service }} state={{ item.state }} + with_items: + - { service: http, state: enabled } + - { service: https, state: enabled } + become: yes + +- name: Restart service + service: name=firewalld state=restarted enabled=yes + become: yes diff -r 000000000000 -r 10185cc821e4 tasks/setting-mariadb.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tasks/setting-mariadb.yml Wed Sep 20 18:12:15 2017 +0900 @@ -0,0 +1,15 @@ +- name: データベース wordpress を作成 + become: yes + mysql_db: + name: wordpress + state: present + encoding: utf8 + +- name: MySQLユーザー wordpress を作成し,wordpress.* にすべての権限を与える + become: yes + mysql_user: + name: wordpress + password: "hZzTwWuTeN" + priv: "wordpress.*:ALL" + host: localhost + state: present diff -r 000000000000 -r 10185cc821e4 tasks/setting-wordpress.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tasks/setting-wordpress.yml Wed Sep 20 18:12:15 2017 +0900 @@ -0,0 +1,38 @@ + - name: WordPress Download + get_url: url="https://ja.wordpress.org/wordpress-4.3.1-ja.tar.gz" dest=/tmp + + - name: unarchive source + become: yes + command: tar zxvf /tmp/wordpress-4.3.1-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='^$' replace='' 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'