wordpress

This commit is contained in:
Darren 2022-11-03 16:56:30 +08:00 committed by GitHub
parent 540fc85056
commit 41725d3822
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 32 deletions

View File

@ -1,4 +1,4 @@
# WordPress
* add theme for selection
* use wp-cli to install theme and plugins
* add solution for selection
* add wp-cli

View File

@ -4,7 +4,7 @@
# Accelerate download from OSS
wordpress_theme_download_url: "https://libs-websoft9-com.oss-accelerate.aliyuncs.com/apps/wordpress"
wordpress_theme: "avada"
wordpress_solution: ""
wordpress_theme_meta:

View File

@ -9,34 +9,43 @@
src: wp-cli.phar
dest: wp-cli.phar
- name: Install wp-cli
- name: Add Install wp-cli for init
shell: |
docker cp wp-cli.phar wordpress:/tmp
docker exec -it wordpress chmod +x /tmp/wp-cli.phar
docker exec -it wordpress mv /tmp/wp-cli.phar /usr/local/bin/wp
echo "docker cp wp-cli.phar wordpress:/tmp" >> /data/apps/{{appname}}/src/after_up.sh
echo "docker exec -it wordpress chmod +x /tmp/wp-cli.phar" >> /data/apps/{{appname}}/src/after_up.sh
echo "docker exec -it wordpress mv /tmp/wp-cli.phar /usr/local/bin/wp" >> /data/apps/{{appname}}/src/after_up.sh
- block:
- name: Download {{wordpress_theme}} theme
- name: Download {{wordpress_solution}} theme to host machine
unarchive:
src: "{{wordpress_theme_download_url}}/{{wordpress_theme}}/{{wordpress_theme}}.zip"
dest: /data/apps/wordpress/data/wordpress/wp-content/themes
src: "{{wordpress_theme_download_url}}/{{wordpress_solution}}/{{wordpress_theme_meta[wordpress_solution].theme}}.zip"
dest: /data/apps/wordpress/data/backup/theme/{{wordpress_solution}}
owner: www-data
group: www-data
remote_src: yes
- name: Download plugin
- name: Download plugin to host machine
unarchive:
src: "{{wordpress_theme_download_url}}/{{wordpress_theme}}/{{item}}.zip"
dest: /data/apps/wordpress/data/wordpress/wp-content/plugins
src: "{{wordpress_theme_download_url}}/{{wordpress_solution}}/{{item}}.zip"
dest: /data/apps/wordpress/data/backup/plugin/{{wordpress_solution}}
owner: www-data
group: www-data
remote_src: yes
with_items:
- "{{wordpress_theme_meta[wordpress_theme].plugin}}"
when: wordpress_theme_meta[wordpress_theme].plugin !=""
- "{{wordpress_theme_meta[wordpress_solution].plugin}}"
when: wordpress_theme_meta[wordpress_solution].plugin !=""
- name: Add tasks to init
shell:
echo "docker cp " >> /data/apps/{{appname}}/src/after_up.sh
echo "docker cp " >> /data/apps/{{appname}}/src/after_up.sh
when: wordpress_solution != "" and wordpress_solution != "multisite"
- name: Modify wordpress for multisite
shell:
echo "add line [define( 'WP_ALLOW_MULTISITE', true );] to wp-config.php" >> /data/apps/{{appname}}/src/after_up.sh
when: wordpress_solution == "multisite"
- name: Override the WordPress default theme
shell: |
pwd
when: wordpress_theme != ""

View File

@ -1,25 +1,27 @@
- pause:
prompt: |
Choice WordPress Theme:
Choice WordPress Solution:
0: default
1: avada
2: porto
3: the7
4: divi
1: multisite
2: Avada Theme
3: Porto Theme
4: The7 Theme
5: Divi Theme
private: no
Default:0
register: wordpress_theme_selected
register: wordpress_solution_selected
- set_fact:
wordpress_theme_option:
wordpress_solution_option:
"0": ""
"1": "avada"
"2": "porto"
"3": "the7"
"4": "divi"
"1": "multisite"
"2": "avada"
"3": "porto"
"4": "the7"
"5": "divi"
- set_fact:
wordpress_theme: "{{wordpress_theme_option[wordpress_theme_selected.user_input]}}"
wordpress_solution: "{{wordpress_solution_option[wordpress_solution_selected.user_input]}}"
- debug:
msg: "WordPress Theme is {{wordpress_theme}}"
msg: "WordPress Solution is {{wordpress_solution}}"