osops-tools-contrib/ansible/lampstack/roles/wordpress/tasks/main.yml

80 lines
2.2 KiB
YAML
Executable File

---
- name: Install wordpress
shell: >
wp core install --path=/var/www/html
--url="http://{{ hostvars.cloud.balancer.openstack.public_v4 }}"
--title='OpenStack Interop Challenge'
--admin_user=wpuser
--admin_password="{{ db_pass }}"
--admin_email='interop@openstack.org'
when: hostvars.cloud.balancer.openstack.public_v4 != ""
- name: Install wordpress
shell: >
wp core install --path=/var/www/html
--url="http://{{ hostvars.cloud.balancer.openstack.private_v4 }}"
--title='OpenStack Interop Challenge'
--admin_user=wpuser
--admin_password="{{ db_pass }}"
--admin_email='interop@openstack.org'
when: hostvars.cloud.balancer.openstack.public_v4 == ""
- name: Activate wordpress theme
shell: >
wp --path=/var/www/html theme activate
"{{ app_env.wp_theme.split('/').pop().split('.')[0] }}"
- name: Download wordpress importer plugin
get_url:
url: "http://downloads.wordpress.org/plugin/wordpress-importer.0.6.3.zip"
dest: /tmp/wordpress-importer.zip
force: yes
- name: Install wordpress importer plugin
shell: >
sudo -u www-data wp --path=/var/www/html
plugin install /tmp/wordpress-importer.zip --activate
args:
warn: no
when: ansible_distribution == 'Ubuntu'
- name: Install wordpress importer plugin
shell: >
sudo -u apache /usr/local/bin/wp --path=/var/www/html
plugin install /tmp/wordpress-importer.zip
args:
warn: no
when: ansible_distribution == 'Fedora'
- name: Enable wordpress importer plugin
shell: >
sudo -u apache /usr/local/bin/wp --path=/var/www/html
plugin activate wordpress-importer
args:
warn: no
when: ansible_distribution == 'Fedora'
- name: Download wordpress sample posts
get_url:
url: "{{ app_env.wp_posts }}"
dest: /tmp/wpposts.zip
force: yes
- name: Unpack the post
shell: unzip -o -q /tmp/wpposts.zip -d /tmp/posts
args:
warn: no
- name: Import wordpress posts
shell: >
sudo -u www-data wp --path=/var/www/html
import /tmp/posts/*.xml --authors=create --quiet
when: ansible_distribution == 'Ubuntu'
- name: Import wordpress posts
shell: >
sudo -u apache /usr/local/bin/wp --path=/var/www/html
import /tmp/posts/*.xml --authors=create --quiet
when: ansible_distribution == 'Fedora'