Mercurial > hg > Members > anatofuz > wordpress_ansible
changeset 25:05b388a02cfc
tweak
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 03 Sep 2020 08:56:14 +0900 |
parents | f987206d7e7a |
children | 404c414506d2 |
files | hosts main.yml roles/install-mariadb/tasks/main.yml roles/install-wordpress/tasks/main.yml |
diffstat | 4 files changed, 26 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/hosts Thu Sep 03 07:11:43 2020 +0900 +++ b/hosts Thu Sep 03 08:56:14 2020 +0900 @@ -1,5 +1,8 @@ -[test] +[all] test-fedora -[test:vars] +[all:vars] +user_name="anatofuz" ansible_python_interpreter=/usr/bin/python3 +wordpress_host="localhost" +wordpress_password="hZzTwWuTeN"
--- a/main.yml Thu Sep 03 07:11:43 2020 +0900 +++ b/main.yml Thu Sep 03 08:56:14 2020 +0900 @@ -1,5 +1,5 @@ - hosts: all - user: anatofuz + user: "{{ user_name }}" roles: - restart-handlers - update-dnf
--- a/roles/install-mariadb/tasks/main.yml Thu Sep 03 07:11:43 2020 +0900 +++ b/roles/install-mariadb/tasks/main.yml Thu Sep 03 08:56:14 2020 +0900 @@ -27,7 +27,7 @@ become: yes mysql_user: name: wordpress - password: "hZzTwWuTeN" + password: "{{ wordpress_password }}" priv: "wordpress.*:ALL" - host: localhost + host: "{{ wordpress_host }}" state: present
--- a/roles/install-wordpress/tasks/main.yml Thu Sep 03 07:11:43 2020 +0900 +++ b/roles/install-wordpress/tasks/main.yml Thu Sep 03 08:56:14 2020 +0900 @@ -5,25 +5,35 @@ src: https://ja.wordpress.org/latest-ja.tar.gz dest: /var/www/html remote_src: yes - -- name: change dir / files permission - become: yes - file: path=/var/www/html/wordpress owner=apache group=apache mode=0755 recurse=yes state=directory + owner: nginx + group: nginx + mode: 0755 - 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 + command: cp '/var/www/html/wordpress/wp-config-sample.php' '/var/www/html/wordpress/wp-config.php' + args: + 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' + replace: + path: /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' + replace: + path: /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' + replace: + path: /var/www/html/wordpress/wp-config.php + regexp: 'password_here' + replace: "{{ wordpress_password }}" notify: restart_nginx