websoft9/apps/roles/wordpress/tasks/main.yml

52 lines
1.7 KiB
YAML
Raw Normal View History

2022-11-03 11:08:44 +08:00
- name: Install {{appname}}
include_tasks: tasks/install.yml
vars:
app: "wordpress"
2022-11-03 13:40:47 +08:00
- block:
2022-11-03 11:08:44 +08:00
- name: Copy wp-cli
copy:
src: wp-cli.phar
dest: wp-cli.phar
2022-11-03 16:56:30 +08:00
- name: Add Install wp-cli for init
2022-11-03 11:08:44 +08:00
shell: |
2022-11-03 16:56:30 +08:00
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
2022-11-03 11:08:44 +08:00
- block:
2022-11-03 16:56:30 +08:00
- name: Download {{wordpress_solution}} theme to host machine
2022-11-03 11:08:44 +08:00
unarchive:
2022-11-03 16:56:30 +08:00
src: "{{wordpress_theme_download_url}}/{{wordpress_solution}}/{{wordpress_theme_meta[wordpress_solution].theme}}.zip"
dest: /data/apps/wordpress/data/backup/theme/{{wordpress_solution}}
2022-11-03 11:08:44 +08:00
owner: www-data
group: www-data
remote_src: yes
2022-11-03 16:56:30 +08:00
- name: Download plugin to host machine
2022-11-03 11:08:44 +08:00
unarchive:
2022-11-03 16:56:30 +08:00
src: "{{wordpress_theme_download_url}}/{{wordpress_solution}}/{{item}}.zip"
dest: /data/apps/wordpress/data/backup/plugin/{{wordpress_solution}}
2022-11-03 11:08:44 +08:00
owner: www-data
group: www-data
remote_src: yes
with_items:
2022-11-03 16:56:30 +08:00
- "{{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"
2022-11-03 11:08:44 +08:00
2022-11-03 13:40:47 +08:00