mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
wordpress db setup and installed tracker
This commit is contained in:
parent
8c13940a99
commit
2180a6655f
4 changed files with 72 additions and 61 deletions
43
roles/wordpress/tasks/enable.yml
Normal file
43
roles/wordpress/tasks/enable.yml
Normal file
|
@ -0,0 +1,43 @@
|
|||
- name: Create symlink wordpress.conf from sites-enabled to sites-available, if wordpress_enabled (debuntu)
|
||||
file:
|
||||
src: /etc/apache2/sites-available/wordpress.conf
|
||||
path: /etc/apache2/sites-enabled/wordpress.conf
|
||||
state: link
|
||||
when: wordpress_enabled and is_debuntu
|
||||
|
||||
- name: Remove /etc/apache2/sites-enabled/wordpress.conf if not wordpress_enabled (debuntu)
|
||||
file:
|
||||
path: /etc/apache2/sites-enabled/wordpress.conf
|
||||
state: absent
|
||||
when: not wordpress_enabled and is_debuntu
|
||||
|
||||
- name: Restart Apache service ({{ apache_service }}) to enable/disable http://box{{ wp_url }}
|
||||
systemd:
|
||||
name: "{{ apache_service }}"
|
||||
state: restarted
|
||||
|
||||
- name: Add 'wordpress' variable values to {{ iiab_ini_file }}
|
||||
ini_file:
|
||||
path: "{{ iiab_ini_file }}"
|
||||
section: wordpress
|
||||
option: "{{ item.option }}"
|
||||
value: "{{ item.value }}"
|
||||
with_items:
|
||||
- option: name
|
||||
value: WordPress
|
||||
- option: description
|
||||
value: '"WordPress is a blog and web site management application."'
|
||||
- option: wordpress_src
|
||||
value: "{{ wordpress_src }}"
|
||||
- option: wp_abs_path
|
||||
value: "{{ wp_abs_path }}"
|
||||
- option: wp_db_name
|
||||
value: "{{ wp_db_name }}"
|
||||
- option: wp_db_user
|
||||
value: "{{ wp_db_user }}"
|
||||
- option: wp_url
|
||||
value: "{{ wp_url }}"
|
||||
- option: wp_full_url
|
||||
value: "{{ wp_full_url }}"
|
||||
- option: wordpress_enabled
|
||||
value: "{{ wordpress_enabled }}"
|
|
@ -87,23 +87,6 @@
|
|||
path: /tmp/get-iiab-wp-salts
|
||||
state: absent
|
||||
|
||||
- name: Start MySQL systemd service
|
||||
service:
|
||||
state: started
|
||||
name: "{{ mysql_service }}"
|
||||
|
||||
- name: 'Create MySQL wordpress database: {{ wp_db_name }}'
|
||||
mysql_db:
|
||||
name: "{{ wp_db_name }}"
|
||||
state: present
|
||||
|
||||
- name: Create MySQL wordpress database user
|
||||
mysql_user:
|
||||
name: "{{ wp_db_user }}"
|
||||
password: "{{ wp_db_user_password }}"
|
||||
priv: "{{ wp_db_name }}.*:ALL,GRANT"
|
||||
state: present
|
||||
|
||||
- name: Install {{ wp_abs_path }}/wp-config.php
|
||||
template:
|
||||
src: wp-config.php.j2
|
||||
|
@ -118,46 +101,7 @@
|
|||
dest: "/etc/{{ apache_config_dir }}/wordpress.conf"
|
||||
when: apache_enabled
|
||||
|
||||
- name: Create symlink wordpress.conf from sites-enabled to sites-available, if wordpress_enabled (debuntu)
|
||||
file:
|
||||
src: /etc/apache2/sites-available/wordpress.conf
|
||||
path: /etc/apache2/sites-enabled/wordpress.conf
|
||||
state: link
|
||||
when: wordpress_enabled and is_debuntu
|
||||
|
||||
- name: Remove /etc/apache2/sites-enabled/wordpress.conf if not wordpress_enabled (debuntu)
|
||||
file:
|
||||
path: /etc/apache2/sites-enabled/wordpress.conf
|
||||
state: absent
|
||||
when: not wordpress_enabled and is_debuntu
|
||||
|
||||
- name: Restart Apache service ({{ apache_service }}) to enable/disable http://box{{ wp_url }}
|
||||
systemd:
|
||||
name: "{{ apache_service }}"
|
||||
state: restarted
|
||||
|
||||
- name: Add 'wordpress' variable values to {{ iiab_ini_file }}
|
||||
- name: Add 'wordpress_installed' variable values to {{ iiab_installed }}
|
||||
ini_file:
|
||||
path: "{{ iiab_ini_file }}"
|
||||
section: wordpress
|
||||
option: "{{ item.option }}"
|
||||
value: "{{ item.value }}"
|
||||
with_items:
|
||||
- option: name
|
||||
value: WordPress
|
||||
- option: description
|
||||
value: '"WordPress is a blog and web site management application."'
|
||||
- option: wordpress_src
|
||||
value: "{{ wordpress_src }}"
|
||||
- option: wp_abs_path
|
||||
value: "{{ wp_abs_path }}"
|
||||
- option: wp_db_name
|
||||
value: "{{ wp_db_name }}"
|
||||
- option: wp_db_user
|
||||
value: "{{ wp_db_user }}"
|
||||
- option: wp_url
|
||||
value: "{{ wp_url }}"
|
||||
- option: wp_full_url
|
||||
value: "{{ wp_full_url }}"
|
||||
- option: wordpress_enabled
|
||||
value: "{{ wordpress_enabled }}"
|
||||
path: "{{ iiab_installed }}"
|
||||
value: wordpress_installed
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
# SEE "emergency" REINSTALL INSTRUCTIONS IN roles/wordpress/tasks/install.yml
|
||||
|
||||
- name: Install WordPress if wordpress_install
|
||||
- name: Provision MySql DB for WordPress
|
||||
include_tasks: prov-db.yml
|
||||
when: wordpress_install | bool and not installing | bool
|
||||
|
||||
- name: Install WordPress if wordpress_installed is absent
|
||||
include_tasks: install.yml
|
||||
when: wordpress_install | bool
|
||||
when: wordpress_install and not wordpress_installed is defined
|
||||
|
||||
- name: Enable WordPress
|
||||
include_tasks: enable.yml
|
||||
when: wordpress_install or wordpress_installed is defined
|
||||
|
|
16
roles/wordpress/tasks/prov-db.yml
Normal file
16
roles/wordpress/tasks/prov-db.yml
Normal file
|
@ -0,0 +1,16 @@
|
|||
- name: Start MySQL systemd service
|
||||
systemd:
|
||||
state: started
|
||||
name: "{{ mysql_service }}"
|
||||
|
||||
- name: 'Create MySQL wordpress database: {{ wp_db_name }}'
|
||||
mysql_db:
|
||||
name: "{{ wp_db_name }}"
|
||||
state: present
|
||||
|
||||
- name: Create MySQL wordpress database user
|
||||
mysql_user:
|
||||
name: "{{ wp_db_user }}"
|
||||
password: "{{ wp_db_user_password }}"
|
||||
priv: "{{ wp_db_name }}.*:ALL,GRANT"
|
||||
state: present
|
Loading…
Add table
Add a link
Reference in a new issue