Rework the lampstack workload to enable provision parallel

Change-Id: Ic5047a1fd0e9d158f33f86ab013a445aa334da2a
This commit is contained in:
Tong Li 2017-03-22 13:31:01 -04:00 committed by tian shi
parent 791fbe78d1
commit a58bab3adf
21 changed files with 360 additions and 378 deletions

View File

@ -1,5 +1,6 @@
*.out
vars/*
run/*
*/**/*.log
*/**/.DS_Store
*/**/._

View File

@ -1,193 +0,0 @@
---
- name: Get start timestamp
set_fact: starttime="{{ ansible_date_time }}"
- name: Retrieve specified flavor
os_flavor_facts:
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
name: "{{ app_env.flavor_name }}"
- name: Create a key-pair
os_keypair:
state: "present"
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
name: "lampstack"
public_key_file: "{{ app_env.public_key_file }}"
- name: Create volume
os_volume:
state: present
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
size: "{{ app_env.volume_size }}"
wait: yes
display_name: db_volume
- name: Create security group
os_security_group:
state: present
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
name: lampstack_sg
description: security group for lampstack
- name: Add security rules
os_security_group_rule:
state: present
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
security_group: lampstack_sg
protocol: "{{ item.protocol }}"
direction: "{{ item.dir }}"
port_range_min: "{{ item.p_min }}"
port_range_max: "{{ item.p_max }}"
remote_ip_prefix: 0.0.0.0/0
with_items:
- { p_min: 22, p_max: 22, dir: ingress, protocol: tcp }
- { p_min: 80, p_max: 80, dir: ingress, protocol: tcp }
- { p_min: 2049, p_max: 2049, dir: ingress, protocol: tcp }
- { p_min: 2049, p_max: 2049, dir: egress, protocol: tcp }
- { p_min: 3306, p_max: 3306, dir: ingress, protocol: tcp }
- { p_min: -1, p_max: -1, dir: ingress, protocol: icmp }
- { p_min: -1, p_max: -1, dir: egress, protocol: icmp }
- name: Create database node
os_server:
state: "present"
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
name: database
image: "{{ app_env.image_name }}"
key_name: "lampstack"
timeout: 200
flavor: "{{ app_env.flavor_name }}"
network: "{{ app_env.private_net_name }}"
userdata: "{{ lookup('template', 'templates/userdata.j2') }}"
config_drive: "{{ app_env.config_drive | default('no') }}"
security_groups: lampstack_sg
floating_ip_pools: "{{ app_env.public_net_name | default(omit) }}"
meta:
hostname: database
register: database
- name: Add database node to the dbservers host group
add_host:
name: "{{ database.openstack.public_v4 }}"
groups: dbservers
when: database.openstack.public_v4 != ""
- name: Add database node to the dbservers host group
add_host:
name: "{{ database.openstack.private_v4 }}"
groups: dbservers
when: database.openstack.public_v4 == ""
- name: Create balancer node
os_server:
state: "present"
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
name: balancer
image: "{{ app_env.image_name }}"
key_name: "lampstack"
timeout: 200
flavor: "{{ app_env.flavor_name }}"
network: "{{ app_env.private_net_name }}"
userdata: "{{ lookup('template', 'templates/userdata.j2') }}"
config_drive: "{{ app_env.config_drive | default('no') }}"
security_groups: lampstack_sg
floating_ip_pools: "{{ app_env.public_net_name | default(omit) }}"
meta:
hostname: balancer
register: balancer
- name: Add balancer node to the balancers host group
add_host:
name: "{{ balancer.openstack.public_v4 }}"
groups: balancers
when: balancer.openstack.public_v4 != ""
- name: Add balancer node to the balancers host group
add_host:
name: "{{ balancer.openstack.private_v4 }}"
groups: balancers
when: balancer.openstack.public_v4 == ""
- name: Create a volume for database to save data
os_server_volume:
state: present
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
server: database
volume: db_volume
device: "{{ app_env.block_device_name }}"
- name: Create web server nodes to host application
os_server:
state: "present"
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
name: apache-{{ item }}
image: "{{ app_env.image_name }}"
key_name: "lampstack"
timeout: 200
flavor: "{{ app_env.flavor_name }}"
network: "{{ app_env.private_net_name }}"
floating_ip_pools: "{{ app_env.public_net_name | default(omit) }}"
userdata: "{{ lookup('template', 'templates/userdata.j2') }}"
config_drive: "{{ app_env.config_drive | default('no') }}"
security_groups: lampstack_sg
meta:
hostname: apache-{{ item }}
with_sequence: count={{ app_env.stack_size - 2 }}
register: webserver
- name: Add web servers to webservers host group
add_host:
name: "{{ item.openstack.public_v4 }}"
groups: webservers
when: item.openstack.public_v4 != ""
with_items: "{{ webserver.results }}"
no_log: True
- name: Add web servers to webservers host group
add_host:
name: "{{ item.openstack.private_v4 }}"
groups: webservers
when: item.openstack.public_v4 == ""
with_items: "{{ webserver.results }}"
no_log: True
- name: Add one web servers to wps host group
add_host:
name: "{{ webserver.results[0].openstack.public_v4 }}"
groups: wps
when: webserver.results[0].openstack.public_v4 != ""
no_log: True
- name: Add one web servers to wps host group
add_host:
name: "{{ webserver.results[0].openstack.private_v4 }}"
groups: wps
when: webserver.results[0].openstack.public_v4 == ""
no_log: True

View File

@ -1,4 +1,8 @@
---
- name: update apt cache
apt: update_cache=yes
when: ansible_os_family == "Debian"
- name: Haproxy install
package:
name: haproxy
@ -28,11 +32,9 @@
- name: Add web servers to the haproxy
lineinfile:
dest: /etc/haproxy/haproxy.cfg
line: " server ws{{ item[0].openstack[item[1]] }} {{ item[0].openstack[item[1]] }}:80 check"
with_nested:
- "{{ hostvars.cloud.webserver.results }}"
- ["private_v4", "public_v4"]
when: item[0].openstack[item[1]] != ''
line: " server ws{{ hostvars[item].inter_ip }} {{ hostvars[item].inter_ip }}:80 check"
with_flattened:
- "{{ groups['webservers'] }}"
no_log: True
- service: name=haproxy state=restarted enabled=yes

View File

@ -5,19 +5,10 @@
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
state: absent
floating_ip_address: "{{ database.openstack.public_v4 }}"
server: "{{ database.openstack.name }}"
when: database.openstack.private_v4 != ""
floating_ip_address: "{{ item }}"
purge: True
server: "{{ hostvars[item].inter_name }}"
with_flattened:
- "{{ groups['webservers'] }}"
- "{{ groups['dbservers'] }}"
no_log: True
- os_floating_ip:
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
state: absent
floating_ip_address: "{{ item.openstack.public_v4 }}"
server: "{{ item.openstack.name }}"
with_items: "{{ webserver.results }}"
when: item.openstack.private_v4 != ""
no_log: True

View File

@ -1,8 +1,4 @@
---
- name: Wait until server is up and runnning
local_action: wait_for port=22 host="{{ ansible_ssh_host | default(inventory_hostname) }}" search_regex=OpenSSH delay=10
become: no
- name: Install python2 for Ansible
raw: dnf install -y python2 python2-dnf libselinux-python
register: result
@ -10,3 +6,10 @@
- name: Set SELinux to permisive
selinux: policy=targeted state=permissive
- name: Setup /etc/hosts on every node
lineinfile:
dest: /etc/hosts
line: "{{ item }}"
state: present
with_lines: cat "{{ playbook_dir }}/run/lampstackhosts"

View File

@ -1,4 +1,11 @@
---
- name: Wait until server is up and runnning
local_action: wait_for port=22 host="{{ ansible_ssh_host | default(inventory_hostname) }}" search_regex=OpenSSH delay=10
become: no
- name: Setup /etc/hosts on every node
lineinfile:
dest: /etc/hosts
line: "{{ item }}"
state: present
with_lines: cat "{{ playbook_dir }}/run/lampstackhosts"
- name: Make sure that cloud-init script has completed
wait_for:
path: "/run/cloud-init/result.json"

View File

@ -62,11 +62,9 @@
- name: Setup NFS webserver access
lineinfile:
dest: /etc/exports
line: "/storage/wpcontent {{ item[0].openstack[item[1]] }}/32(rw,sync,no_root_squash,no_subtree_check)"
with_nested:
- "{{ hostvars.cloud.webserver.results }}"
- ["private_v4", "public_v4"]
when: item[0].openstack[item[1]] != ''
line: "/storage/wpcontent {{ hostvars[item].inter_ip }}/32(rw,sync,no_root_squash,no_subtree_check)"
with_flattened:
- "{{ groups['webservers'] }}"
no_log: True
- name: nfs export

View File

@ -1,79 +0,0 @@
---
- name: Get start timestamp
set_fact: starttime="{{ ansible_date_time }}"
- name: Delete key pairs
os_keypair:
state: "absent"
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
name: "lampstack"
public_key_file: "{{ app_env.public_key_file }}"
- name: Delete database node
os_server:
state: "absent"
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
name: database
image: "{{ app_env.image_name }}"
key_name: "lampstack"
timeout: 200
network: "{{ app_env.private_net_name }}"
meta:
hostname: database
- name: Delete balancer node
os_server:
state: "absent"
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
name: balancer
image: "{{ app_env.image_name }}"
key_name: "lampstack"
timeout: 200
network: "{{ app_env.private_net_name }}"
meta:
hostname: balancer
- name: Delete web server nodes
os_server:
state: "absent"
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
name: apache-{{ item }}
image: "{{ app_env.image_name }}"
key_name: "lampstack"
timeout: 200
network: "{{ app_env.private_net_name }}"
meta:
hostname: apache-{{ item }}
with_sequence: count={{ app_env.stack_size - 2 }}
- name: Delete security group
os_security_group:
state: absent
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
name: lampstack_sg
description: secuirty group for lampstack
- name: Delete cinder volume
os_volume:
state: absent
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
wait: yes
display_name: db_volume

View File

@ -0,0 +1,44 @@
---
- name: Add the node to host group with private IP
add_host:
name: "{{ hostvars[item].public_ip }}"
inter_ip: "{{ hostvars[item].private_ip }}"
inter_name: "{{ item }}"
groups: "{{ hostvars[item].targetgroup }}"
with_items: "{{ groups['prohosts'] }}"
- name: Add one web server to wps host group
add_host:
name: "{{ groups['webservers'][0] }}"
groups: wps
no_log: True
- name: Remove the lampstackhosts file
file:
path: "{{ playbook_dir }}/run/lampstackhosts"
state: absent
- name: Build up hosts file
lineinfile:
dest: "{{ playbook_dir }}/run/lampstackhosts"
line: "{{ hostvars[item].inter_ip }} {{ hostvars[item].inter_name }}"
state: present
create: yes
with_flattened:
- '{{ groups["dbservers"] }}'
- '{{ groups["balancers"] }}'
- '{{ groups["webservers"] }}'
- name: Wait until servers are up and runnning
wait_for:
host: "{{ item }}"
port: 22
state: started
delay: 15
connect_timeout: 20
timeout: 300
with_items:
- '{{ groups["dbservers"] }}'
- '{{ groups["balancers"] }}'
- '{{ groups["webservers"] }}'

View File

@ -0,0 +1,30 @@
---
- name: Delete key pairs
os_keypair:
state: "absent"
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
name: "lampstack"
public_key_file: "{{ app_env.public_key_file }}"
- name: Delete security group
os_security_group:
state: absent
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
name: lampstack_sg
description: secuirty group for lampstack
- name: Delete cinder volume
os_volume:
state: absent
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
wait: yes
display_name: db_volume

View File

@ -0,0 +1,100 @@
---
- name: Ensure we have a working directory to save runtime files
file: "path={{ playbook_dir }}/run state=directory"
- name: Retrieve specified flavor
os_flavor_facts:
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
name: "{{ app_env.flavor_name }}"
- name: Create a key-pair
os_keypair:
state: "present"
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
name: "lampstack"
public_key_file: "{{ app_env.public_key_file }}"
- name: Create volume
os_volume:
state: present
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
size: "{{ app_env.volume_size }}"
wait: yes
display_name: db_volume
- name: Create security group
os_security_group:
state: present
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
name: lampstack_sg
description: security group for lampstack
- name: Add security rules
os_security_group_rule:
state: present
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
security_group: lampstack_sg
protocol: "{{ item.protocol }}"
direction: "{{ item.dir }}"
port_range_min: "{{ item.p_min }}"
port_range_max: "{{ item.p_max }}"
remote_ip_prefix: 0.0.0.0/0
with_items:
- { p_min: 22, p_max: 22, dir: ingress, protocol: tcp }
- { p_min: 80, p_max: 80, dir: ingress, protocol: tcp }
- { p_min: 2049, p_max: 2049, dir: ingress, protocol: tcp }
- { p_min: 2049, p_max: 2049, dir: egress, protocol: tcp }
- { p_min: 3306, p_max: 3306, dir: ingress, protocol: tcp }
- { p_min: -1, p_max: -1, dir: ingress, protocol: icmp }
- { p_min: -1, p_max: -1, dir: egress, protocol: icmp }
- name: Create volume
os_volume:
state: present
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
size: "{{ app_env.volume_size }}"
wait: yes
display_name: db_volume
- name: Add database node to provisioning host group
add_host:
name: "database"
targetgroup: "dbservers"
ansible_host: "127.0.0.1"
groups: "prohosts"
no_log: True
- name: Add balancer node to provisioning host group
add_host:
name: "balancer"
targetgroup: "balancers"
ansible_host: "127.0.0.1"
groups: "prohosts"
no_log: True
- name: Add apache nodes to provisioning host group
add_host:
name: "apache-{{ item }}"
targetgroup: "webservers"
ansible_host: "127.0.0.1"
groups: "prohosts"
with_sequence: count={{ app_env.stack_size - 2 }}
no_log: True

View File

@ -0,0 +1,25 @@
---
- name: Add database node to provisioning host group
add_host:
name: "database"
targetgroup: "dbservers"
ansible_host: "127.0.0.1"
groups: "prohosts"
no_log: True
- name: Add balancer node to provisioning host group
add_host:
name: "balancer"
targetgroup: "balancers"
ansible_host: "127.0.0.1"
groups: "prohosts"
no_log: True
- name: Add apache nodes to provisioning host group
add_host:
name: "apache-{{ item }}"
targetgroup: "webservers"
ansible_host: "127.0.0.1"
groups: "prohosts"
with_sequence: count={{ app_env.stack_size - 2 }}
no_log: True

View File

@ -0,0 +1,49 @@
---
- name: Create an OpenStack virtual machine
os_server:
state: "present"
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
name: "{{ inventory_hostname }}"
image: "{{ app_env.image_name }}"
key_name: "lampstack"
timeout: 200
flavor: "{{ app_env.flavor_name }}"
network: "{{ app_env.private_net_name }}"
userdata: "{{ lookup('template', 'roles/provision/templates/userdata.j2') }}"
config_drive: "{{ app_env.config_drive | default('no') }}"
security_groups: lampstack_sg
floating_ip_pools: "{{ app_env.public_net_name | default(omit) }}"
meta:
hostname: "{{ inventory_hostname }}"
register: osvm
- name: Setup variables for generating host groups
set_fact:
inter_name: "{{ osvm.openstack.name }}"
public_ip: "{{ osvm.openstack.public_v4 }}"
private_ip: "{{ osvm.openstack.private_v4 }}"
- name: Use public ip address when private ip is empty
set_fact:
private_ip: "{{ osvm.openstack.public_v4 }}"
when: osvm.openstack.private_v4 == ""
- name: Use private ip address when public ip is empty
set_fact:
public_ip: "{{ osvm.openstack.private_v4 }}"
when: osvm.openstack.public_v4 == ""
- name: Attach a volume to the node
os_server_volume:
state: present
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
server: "{{ inventory_hostname }}"
volume: "db_volume"
device: "{{ app_env.block_device_name }}"
when: inventory_hostname == "database"

View File

@ -0,0 +1,14 @@
---
- name: Destroy an OpenStack virtual machine
os_server:
state: "absent"
auth: "{{ auth }}"
region_name: "{{ app_env.region_name }}"
availability_zone: "{{ app_env.availability_zone }}"
validate_certs: "{{ app_env.validate_certs }}"
name: "{{ inventory_hostname }}"
image: "{{ app_env.image_name }}"
timeout: 200
network: "{{ app_env.private_net_name }}"
meta:
hostname: "{{ inventory_hostname }}"

View File

@ -89,18 +89,9 @@
- name: Mount the directory using private IP
mount:
name: /var/www/html/wp-content
src: "{{ hostvars.cloud.database.openstack.private_v4 }}:/storage/wpcontent"
src: "{{ hostvars[groups['dbservers'][0]].inter_ip }}:/storage/wpcontent"
state: mounted
fstype: nfs
when: hostvars.cloud.database.openstack.private_v4 != ""
- name: Mount the directory using public IP
mount:
name: /var/www/html/wp-content
src: "{{ hostvars.cloud.database.openstack.public_v4 }}:/storage/wpcontent"
state: mounted
fstype: nfs
when: hostvars.cloud.database.openstack.private_v4 == ""
- lineinfile: dest=/etc/apache2/apache2.conf line="ServerName localhost"
when: ansible_distribution == 'Ubuntu'
@ -134,22 +125,14 @@
- { then: 'database_name_here', now: 'decision2016' }
- { then: 'username_here', now: "{{ db_user }}" }
- { then: 'password_here', now: "{{ db_pass }}" }
no_log: True
- name: Configure wordpress network access using private IP
replace:
dest: /var/www/html/wp-config.php
regexp: "'localhost'"
replace: "'{{ hostvars.cloud.database.openstack.private_v4 }}'"
replace: "'{{ hostvars[groups['dbservers'][0]].inter_ip }}'"
backup: no
when: hostvars.cloud.database.openstack.private_v4 != ""
- name: Configure wordpress network access using public IP
replace:
dest: /var/www/html/wp-config.php
regexp: "'localhost'"
replace: "'{{ hostvars.cloud.database.openstack.public_v4 }}'"
backup: no
when: hostvars.cloud.database.openstack.private_v4 == ""
- name: Change ownership of wordpress
shell: chown -R www-data:www-data /var/www/html

View File

@ -13,22 +13,11 @@
- name: Install wordpress
command: >
wp core install --path=/var/www/html
--url="http://{{ hostvars.cloud.balancer.openstack.public_v4 }}"
--url="http://{{ groups['balancers'][0] }}"
--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
command: >
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: Install package for automated plugin activation
shell: >

View File

@ -13,28 +13,12 @@
- name: Install wordpress
command: >
wp core install --path=/var/www/html
--url="http://{{ hostvars.cloud.balancer.openstack.public_v4 }}"
--url="http://{{ groups['balancers'][0] }}"
--title='OpenStack Interop Challenge'
--admin_user=wpuser
--admin_password="{{ db_pass }}"
--admin_email='interop@openstack.org'
--allow-root
when: hostvars.cloud.balancer.openstack.public_v4 != ""
- name: Install wordpress
command: >
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'
--allow-root
when: hostvars.cloud.balancer.openstack.public_v4 == ""
- name: Install package for automated plugin activation
shell: >
wp package install itspriddle/wp-cli-tgmpa-plugin --allow-root
- name: Make an initial request, so that later switch-theme hooks work.
shell: >
@ -47,8 +31,16 @@
- name: Install and activate required plugins
shell: >
sudo -u www-data wp --path=/var/www/html
tgmpa-plugin install --all-required --activate
sudo -u www-data wp --path=/var/www/html plugin install {{ item }} --activate
with_items:
- advanced-custom-fields
- cforms2
- co-authors-plus
- disable-comments
- pmzez-page-loader
- responsive-lightbox
- /var/www/html/wp-content/themes/superuser/src/plugins/pbd-ajax-load-posts.zip
- /var/www/html/wp-content/themes/superuser/src/plugins/share-links.zip
args:
warn: no

View File

@ -1,14 +1,47 @@
---
- name: provision servers
- name: Get start timestamp
hosts: cloud
connection: local
tasks:
- set_fact:
starttime: "{{ ansible_date_time }}"
tags: "info"
- name: Prepare to run the workload
hosts: cloud
connection: local
vars_files:
- "vars/{{ env }}.yml"
tasks:
- include: "roles/prepare/tasks/{{ action }}.yml"
roles:
- "{{ action }}"
- prepare
tags: "{{ action }}"
- name: Install python2 for ansible to work
- name: provision servers
hosts: prohosts
connection: local
strategy: free
vars_files:
- "vars/{{ env }}.yml"
tasks:
- include: "roles/provision/tasks/{{ action }}.yml"
roles:
- provision
tags: "{{ action }}"
- name: Post provision process
hosts: cloud
connection: local
vars_files:
- "vars/{{ env }}.yml"
tasks:
- include: "roles/postprovision/tasks/{{ action }}.yml"
roles:
- postprovision
tags: "{{ action }}"
- name: Performe common tasks on all servers
hosts: dbservers, webservers, balancers
gather_facts: false
user: "{{ app_env.ssh_user }}"
@ -91,17 +124,9 @@
- debug:
msg: >-
Access wordpress at
http://{{ hostvars.cloud.balancer.openstack.public_v4 }}.
http://{{ groups['balancers'][0] }}.
wordpress userid is wpuser, password is {{ db_pass }}
when: hostvars.cloud.balancer is defined and
hostvars.cloud.balancer.openstack.public_v4 != ""
- debug:
msg: >-
Access wordpress at
http://{{ hostvars.cloud.balancer.openstack.private_v4 }}.
wordpress userid is wpuser, password is {{ db_pass }}
when: hostvars.cloud.balancer is defined and
hostvars.cloud.balancer.openstack.public_v4 == ""
when: groups['balancers'] is defined
- debug:
msg: >-
The work load test started at {{ hostvars.cloud.starttime.time }},

View File

@ -11,16 +11,16 @@ auth: {
app_env: {
target_os: "ubuntu",
ssh_user: "ubuntu",
image_name: "ubuntu-16.10",
image_name: "Ubuntu 16.04",
region_name: "",
availability_zone: "",
validate_certs: True,
private_net_name: "interopnet",
validate_certs: False,
private_net_name: "demonet",
flavor_name: "m1.small",
public_key_file: "/home/ubuntu/.ssh/id_rsa.pub",
public_key_file: "/home/ubuntu/.ssh/interop.pub",
stack_size: 4,
volume_size: 10,
volume_size: 4,
block_device_name: "/dev/vdb",
wp_latest: "https://wordpress.org/wordpress-4.6.1.tar.gz",
wp_importer: "http://downloads.wordpress.org/plugin/wordpress-importer.0.6.3.zip"
wp_latest: "http://10.0.10.41/lampstack/wordpress-4.6.1.tar.gz",
wp_importer: "http://10.0.10.41/lampstack/wordpress-importer.0.6.3.zip"
}

View File

@ -11,16 +11,17 @@ auth: {
app_env: {
target_os: "ubuntu",
image_name: "ubuntu-14.04",
image_name: "ubuntu-16.04",
region_name: "RegionOne",
availability_zone: "nova",
validate_certs: False,
ssh_user: "ubuntu",
private_net_name: "demonet",
flavor_name: "m1.large",
public_key_file: "/home/ubuntu/.ssh/id_rsa.pub",
public_key_file: "/home/ubuntu/.ssh/interop.pub",
stack_size: 4,
volume_size: 2,
block_device_name: "/dev/vdb",
wp_latest: "https://wordpress.org/wordpress-4.6.tar.gz"
wp_latest: "http://10.0.10.12/lampstack/wordpress-4.6.1.tar.gz",
wp_importer: "http://10.0.10.12/lampstack/wordpress-importer.0.6.3.zip"
}