diff --git a/workloads/ansible/shade/lampstack/README.md b/workloads/ansible/shade/lampstack/README.md old mode 100644 new mode 100755 index dacecd9..1eab3ca --- a/workloads/ansible/shade/lampstack/README.md +++ b/workloads/ansible/shade/lampstack/README.md @@ -53,6 +53,7 @@ You may create one such file per cloud for your tests. } app_env: { + target_os: "ubuntu", image_name: "ubuntu-15.04", region_name: "RegionOne", availability_zone: "nova", @@ -63,9 +64,7 @@ You may create one such file per cloud for your tests. stack_size: 4, volume_size: 2, block_device_name: "/dev/vdb", - config_drive: no, - wp_theme: "https://downloads.wordpress.org/theme/iribbon.2.0.65.zip", - wp_posts: "http://wpcandy.s3.amazonaws.com/resources/postsxml.zip" + config_drive: no } It's also possible to provide download URL's for wordpress and associated @@ -75,11 +74,10 @@ outbound network access to the Internet (defaults show below): app_env: { ... wp_latest: 'https://wordpress.org/latest.tar.gz', - wp_cli: 'https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar', wp_importer: 'http://downloads.wordpress.org/plugin/wordpress-importer.0.6.3.zip' } -The values of these variables should be provided by your cloud provider. When +The values of the auth section should be provided by your cloud provider. When use keystone 2.0 API, you will not need to setup domain name. You can leave region_name empty if you have just one region. You can also leave private_net_name empty if your cloud does not support tenant network or you @@ -88,7 +86,11 @@ have multiple tenant networks. validate_certs should be normally set to True when your cloud uses tls(ssl) and your cloud is not using self signed certificate. If your cloud is using self signed certificate, then the certificate can not be easily validated by ansible. You can skip it by setting -the parameter to False. +the parameter to False. currently the only values available for target_os are +ubuntu and fedora. Supported ubuntu releases are 14.04, 15.04, 15.10, 16.04 +and 16.10. The wordpress theme and sample content are now provided by +OpenStack foundation. If the test is successful, the OpenStack Superuser +award site should be fully functional. ## Provision the LAMP stack diff --git a/workloads/ansible/shade/lampstack/files/wp-cli.phar b/workloads/ansible/shade/lampstack/files/wp-cli.phar new file mode 100644 index 0000000..c298479 Binary files /dev/null and b/workloads/ansible/shade/lampstack/files/wp-cli.phar differ diff --git a/workloads/ansible/shade/lampstack/files/wpposts.zip b/workloads/ansible/shade/lampstack/files/wpposts.zip new file mode 100644 index 0000000..700599d Binary files /dev/null and b/workloads/ansible/shade/lampstack/files/wpposts.zip differ diff --git a/workloads/ansible/shade/lampstack/files/wptheme.zip b/workloads/ansible/shade/lampstack/files/wptheme.zip new file mode 100755 index 0000000..4772d4b Binary files /dev/null and b/workloads/ansible/shade/lampstack/files/wptheme.zip differ diff --git a/workloads/ansible/shade/lampstack/roles/apply/templates/userdata.j2 b/workloads/ansible/shade/lampstack/roles/apply/templates/userdata.j2 index a4079c9..7767d2e 100755 --- a/workloads/ansible/shade/lampstack/roles/apply/templates/userdata.j2 +++ b/workloads/ansible/shade/lampstack/roles/apply/templates/userdata.j2 @@ -1,4 +1,9 @@ #cloud-config +packages: + - python2.7 + runcmd: + - if [ ! -x /usr/bin/python ]; then update-alternatives --install /usr/bin/python python /usr/bin/python2.7 10; fi - addr=$(ip -4 -o addr | grep -v '127.0.0.1' | awk 'NR==1{print $4}' | cut -d '/' -f 1) - - echo $addr `hostname` >> /etc/hosts \ No newline at end of file + - echo $addr `hostname` >> /etc/hosts + \ No newline at end of file diff --git a/workloads/ansible/shade/lampstack/roles/balancer/tasks/main.yml b/workloads/ansible/shade/lampstack/roles/balancer/tasks/main.yml index eedb4a0..c3d9b6d 100755 --- a/workloads/ansible/shade/lampstack/roles/balancer/tasks/main.yml +++ b/workloads/ansible/shade/lampstack/roles/balancer/tasks/main.yml @@ -1,20 +1,8 @@ --- - name: Haproxy install package: - name="{{ item }}" - state=latest - update_cache=yes - with_items: - - haproxy - when: ansible_distribution == 'Ubuntu' - -- name: Haproxy install - package: - name="{{ item }}" - state=latest - with_items: - - haproxy - when: ansible_distribution == 'Fedora' + name: haproxy + state: latest - name: Enable haproxy service replace: @@ -24,21 +12,18 @@ backup: no when: ansible_distribution == 'Ubuntu' -- name: Place the haproxy configuration file - copy: - src: templates/haproxy.cfg.j2 +- name: Modify haproxy configuration + blockinfile: dest: /etc/haproxy/haproxy.cfg - owner: root - group: root - when: ansible_distribution == 'Ubuntu' + insertafter: EOF + block: | + frontend http-in + bind *:80 + default_backend backend_servers + option forwardfor -- name: Place the haproxy configuration file - copy: - src: templates/haproxy_fedora.cfg.j2 - dest: /etc/haproxy/haproxy.cfg - owner: root - group: root - when: ansible_distribution == 'Fedora' + backend backend_servers + balance roundrobin - name: Add web servers to the haproxy lineinfile: diff --git a/workloads/ansible/shade/lampstack/roles/balancer/templates/haproxy.cfg.j2 b/workloads/ansible/shade/lampstack/roles/balancer/templates/haproxy.cfg.j2 deleted file mode 100755 index 17267ed..0000000 --- a/workloads/ansible/shade/lampstack/roles/balancer/templates/haproxy.cfg.j2 +++ /dev/null @@ -1,33 +0,0 @@ -global - log /dev/log local0 - log /dev/log local1 notice - chroot /var/lib/haproxy - user haproxy - group haproxy - daemon - -defaults - log global - mode http - option httplog - option dontlognull - option redispatch - retries 3 - contimeout 5000 - clitimeout 50000 - srvtimeout 50000 - errorfile 400 /etc/haproxy/errors/400.http - errorfile 403 /etc/haproxy/errors/403.http - errorfile 408 /etc/haproxy/errors/408.http - errorfile 500 /etc/haproxy/errors/500.http - errorfile 502 /etc/haproxy/errors/502.http - errorfile 503 /etc/haproxy/errors/503.http - errorfile 504 /etc/haproxy/errors/504.http - -listen webfarm 0.0.0.0:80 - mode http - stats enable - stats uri /haproxy?stats - balance roundrobin - option httpclose - option forwardfor diff --git a/workloads/ansible/shade/lampstack/roles/balancer/templates/haproxy_fedora.cfg.j2 b/workloads/ansible/shade/lampstack/roles/balancer/templates/haproxy_fedora.cfg.j2 deleted file mode 100755 index 015cf4c..0000000 --- a/workloads/ansible/shade/lampstack/roles/balancer/templates/haproxy_fedora.cfg.j2 +++ /dev/null @@ -1,34 +0,0 @@ -global - log /dev/log local0 - log /dev/log local1 notice - chroot /var/lib/haproxy - user haproxy - group haproxy - daemon - -defaults - log global - mode http - option httplog - option dontlognull - option redispatch - retries 3 - contimeout 5000 - clitimeout 50000 - srvtimeout 50000 - errorfile 400 /usr/share/haproxy/400.http - errorfile 403 /usr/share/haproxy/403.http - errorfile 408 /usr/share/haproxy/408.http - errorfile 500 /usr/share/haproxy/500.http - errorfile 502 /usr/share/haproxy/502.http - errorfile 503 /usr/share/haproxy/503.http - errorfile 504 /usr/share/haproxy/504.http - -listen webfarm - bind 0.0.0.0:80 - mode http - stats enable - stats uri /haproxy?stats - balance roundrobin - option httpclose - option forwardfor diff --git a/workloads/ansible/shade/lampstack/roles/common/tasks/main.yml b/workloads/ansible/shade/lampstack/roles/common/tasks/fedora.yml old mode 100644 new mode 100755 similarity index 68% rename from workloads/ansible/shade/lampstack/roles/common/tasks/main.yml rename to workloads/ansible/shade/lampstack/roles/common/tasks/fedora.yml index e76aed2..9a13c0a --- a/workloads/ansible/shade/lampstack/roles/common/tasks/main.yml +++ b/workloads/ansible/shade/lampstack/roles/common/tasks/fedora.yml @@ -3,17 +3,10 @@ local_action: wait_for port=22 host="{{ ansible_ssh_host | default(inventory_hostname) }}" search_regex=OpenSSH delay=10 become: no -- name: Check if running on Fedora - raw: "[ -f /etc/fedora-release ]" - register: fedora_release - ignore_errors: yes - - name: Install python2 for Ansible raw: dnf install -y python2 python2-dnf libselinux-python register: result until: result|success - when: fedora_release.rc == 0 - name: Set SELinux to permisive selinux: policy=targeted state=permissive - when: fedora_release.rc == 0 diff --git a/workloads/ansible/shade/lampstack/roles/common/tasks/ubuntu.yml b/workloads/ansible/shade/lampstack/roles/common/tasks/ubuntu.yml new file mode 100755 index 0000000..a67a4f0 --- /dev/null +++ b/workloads/ansible/shade/lampstack/roles/common/tasks/ubuntu.yml @@ -0,0 +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 diff --git a/workloads/ansible/shade/lampstack/roles/database/tasks/main.yml b/workloads/ansible/shade/lampstack/roles/database/tasks/main.yml index 238d486..48fce5a 100755 --- a/workloads/ansible/shade/lampstack/roles/database/tasks/main.yml +++ b/workloads/ansible/shade/lampstack/roles/database/tasks/main.yml @@ -104,6 +104,12 @@ - python2-mysql when: ansible_distribution == 'Fedora' +- name: Update MySQL root password for all root accounts + mysql_user: name=root host={{ item }} password={{ db_pass }} state=present + with_items: + - 127.0.0.1 + - localhost + - service: name=mysql state=stopped enabled=yes when: ansible_distribution == 'Ubuntu' @@ -125,10 +131,11 @@ register: mysqlflag - name: Configure mysql 5.6+ - replace: - dest: "/etc/mysql/mysql.conf.d/mysqld.cnf" - replace: "bind-address = {{ local_ip.stdout }}" - backup: no + ini_file: + dest=/etc/mysql/mysql.conf.d/mysqld.cnf + section=mysqld + option=bind-address + value={{ local_ip.stdout }} when: mysqlflag.stat.exists == true - stat: path=/etc/my.cnf @@ -152,13 +159,17 @@ mysql_db: name: "decision2016" state: "{{ item }}" + login_user: root + login_password: "{{ db_pass }}" with_items: - - ['present', 'absent', 'present'] + - ['absent', 'present'] - name: Add a user mysql_user: name: "{{ db_user }}" password: "{{ db_pass }}" + login_user: root + login_password: "{{ db_pass }}" host: "%" priv: 'decision2016.*:ALL' state: present diff --git a/workloads/ansible/shade/lampstack/roles/webserver/tasks/main.yml b/workloads/ansible/shade/lampstack/roles/webserver/tasks/main.yml index 6224e00..0ad10ed 100755 --- a/workloads/ansible/shade/lampstack/roles/webserver/tasks/main.yml +++ b/workloads/ansible/shade/lampstack/roles/webserver/tasks/main.yml @@ -8,10 +8,29 @@ - apache2 - php5 - php5-mysql + - php5-gd - nfs-common - unzip - ssmtp - when: ansible_distribution == 'Ubuntu' + when: ansible_distribution == 'Ubuntu' and ansible_distribution_version < '16.04' + +- name: Apache and php 7 + package: + name="{{ item }}" + state=latest + update_cache=yes + with_items: + - apache2 + - php7.0 + - php7.0-mysql + - libapache2-mod-php7.0 + - php7.0-cli + - php7.0-cgi + - php7.0-gd + - nfs-common + - unzip + - ssmtp + when: ansible_distribution == 'Ubuntu' and ansible_distribution_version >= '16.04' - name: Apache and php 5 package: @@ -21,6 +40,7 @@ - httpd - php - php-mysqlnd + - php5-gd - nfs-utils - unzip - ssmtp @@ -30,9 +50,29 @@ args: warn: no +- name: Enable mod_rewrite + apache2_module: name=rewrite state=present + +- name: Enable htaccess + blockinfile: + dest: /etc/apache2/sites-enabled/000-default.conf + insertafter: "DocumentRoot /var/www/html" + content: | + + AllowOverride All + + RewriteEngine On + RewriteBase / + RewriteRule ^index\.php$ - [L] + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule . /index.php [L] + + + - name: Creates share directory for wpcontent file: - path: /var/www/html/wp-content/uploads + path: /var/www/html/wp-content state: directory owner: www-data group: www-data @@ -40,7 +80,7 @@ - name: Creates share directory for wpcontent file: - path: /var/www/html/wp-content/uploads + path: /var/www/html/wp-content state: directory owner: apache group: apache @@ -48,7 +88,7 @@ - name: Mount the directory using private IP mount: - name: /var/www/html/wp-content/uploads + name: /var/www/html/wp-content src: "{{ hostvars.cloud.database.openstack.private_v4 }}:/storage/wpcontent" state: mounted fstype: nfs @@ -56,7 +96,7 @@ - name: Mount the directory using public IP mount: - name: /var/www/html/wp-content/uploads + name: /var/www/html/wp-content src: "{{ hostvars.cloud.database.openstack.public_v4 }}:/storage/wpcontent" state: mounted fstype: nfs @@ -70,8 +110,9 @@ - name: Download wordpress get_url: - url: "{{ app_env.wp_latest | default('https://wordpress.org/latest.tar.gz') }}" + url: "{{ app_env.wp_latest | default('https://wordpress.org/wordpress-4.6.1.tar.gz') }}" dest: /var/www/latest.tar.gz + force: no - name: Unpack latest wordpress shell: tar -xf /var/www/latest.tar.gz -C /var/www/html --strip-components=1 @@ -129,19 +170,8 @@ when: ansible_distribution == 'Fedora' - name: Install wordpress command line tool - get_url: - url: "{{ app_env.wp_cli | default('https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar') }}" + copy: + src: files/wp-cli.phar dest: /usr/local/bin/wp mode: "a+x" - force: no - -- name: Download a wordpress theme - get_url: - url: "{{ app_env.wp_theme }}" - dest: /tmp/wptheme.zip - force: yes - -- name: Install the theme - shell: unzip -o -q /tmp/wptheme.zip -d /var/www/html/wp-content/themes - args: - warn: no + force: no \ No newline at end of file diff --git a/workloads/ansible/shade/lampstack/roles/wordpress/tasks/fedora.yml b/workloads/ansible/shade/lampstack/roles/wordpress/tasks/fedora.yml new file mode 100755 index 0000000..05b5e1f --- /dev/null +++ b/workloads/ansible/shade/lampstack/roles/wordpress/tasks/fedora.yml @@ -0,0 +1,100 @@ +--- +- name: Download a wordpress theme + copy: + src: files/wptheme.zip + dest: /tmp/wptheme.zip + force: no + +- name: Install the theme + shell: sudo -u apache unzip -o -q /tmp/wptheme.zip -d /var/www/html/wp-content/themes + args: + warn: no + +- name: Install wordpress + command: > + 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 + 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: > + wp package install itspriddle/wp-cli-tgmpa-plugin + +- name: Make an initial request, so that later switch-theme hooks work. + shell: > + sudo -u apache wp --path=/var/www/html + cron test + +- name: Activate wordpress theme + command: > + wp --path=/var/www/html theme activate superuser + +- name: Install and activate required plugins + shell: > + sudo -u apache wp --path=/var/www/html + tgmpa-plugin install --all-required --activate + args: + warn: no + +- name: Download wordpress importer plugin + get_url: + url: "{{ app_env.wp_importer | default('http://downloads.wordpress.org/plugin/wordpress-importer.0.6.3.zip') }}" + dest: "/tmp/wordpress-importer.zip" + force: "yes" + +- name: Install wordpress importer plugin + command: > + sudo -u apache wp --path=/var/www/html plugin install /tmp/wordpress-importer.zip --activate + args: + warn: "no" + +- name: Create temporary post directory + file: + path: /tmp/posts + state: directory + mode: "u=rwx,g=rwx,o=rx" + +- name: Unpack the posts + unarchive: + src: files/wpposts.zip + dest: /tmp/posts + remote_src: no + +- name: Wait for the posts to be unpacked + wait_for: + path: /tmp/posts + state: present + +- name: Import wordpress posts + command: > + wp --path=/var/www/html import /tmp/posts/superuser_content.xml --authors=create --quiet + +- name: Regenerate thumbnails for the imported posts + shell: > + sudo -u apache wp --path=/var/www/html media regenerate --yes --quiet + +- name: Trigger post-activation hooks + shell: > + sudo -u apache wp --path=/var/www/html + cron test + +- name: Flush rewrite rules, setup htaccess for nice permalinks + shell: > + sudo -u apache + WP_CLI_CONFIG_PATH=/var/www/html/wp-content/themes/superuser/wp-cli.yml + wp --path=/var/www/html + rewrite flush --hard diff --git a/workloads/ansible/shade/lampstack/roles/wordpress/tasks/main.yml b/workloads/ansible/shade/lampstack/roles/wordpress/tasks/main.yml deleted file mode 100755 index b41f327..0000000 --- a/workloads/ansible/shade/lampstack/roles/wordpress/tasks/main.yml +++ /dev/null @@ -1,73 +0,0 @@ ---- -- name: Install wordpress - command: > - 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 - 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: Activate wordpress theme - command: > - wp --path=/var/www/html theme activate - "{{ app_env.wp_theme.split('/').pop().split('.')[0] }}" - -- name: Download wordpress importer plugin - get_url: - url: "{{ app_env.wp_importer | default('http://downloads.wordpress.org/plugin/wordpress-importer.0.6.3.zip') }}" - dest: "/tmp/wordpress-importer.zip" - force: "yes" - -- name: Install wordpress importer plugin - command: > - 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 - command: > - 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 - command: > - 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 posts - command: unzip -o -q /tmp/wpposts.zip -d /tmp/posts - args: - warn: "no" - -- name: Import wordpress posts - command: > - 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' diff --git a/workloads/ansible/shade/lampstack/roles/wordpress/tasks/ubuntu.yml b/workloads/ansible/shade/lampstack/roles/wordpress/tasks/ubuntu.yml new file mode 100755 index 0000000..783729a --- /dev/null +++ b/workloads/ansible/shade/lampstack/roles/wordpress/tasks/ubuntu.yml @@ -0,0 +1,100 @@ +--- +- name: Download a wordpress theme + copy: + src: files/wptheme.zip + dest: /tmp/wptheme.zip + force: no + +- name: Install the theme + shell: sudo -u www-data unzip -o -q /tmp/wptheme.zip -d /var/www/html/wp-content/themes + args: + warn: no + +- name: Install wordpress + command: > + 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 + 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: > + wp package install itspriddle/wp-cli-tgmpa-plugin + +- name: Make an initial request, so that later switch-theme hooks work. + shell: > + sudo -u www-data wp --path=/var/www/html + cron test + +- name: Activate wordpress theme + command: > + wp --path=/var/www/html theme activate superuser + +- name: Install and activate required plugins + shell: > + sudo -u www-data wp --path=/var/www/html + tgmpa-plugin install --all-required --activate + args: + warn: no + +- name: Download wordpress importer plugin + get_url: + url: "{{ app_env.wp_importer | default('http://downloads.wordpress.org/plugin/wordpress-importer.0.6.3.zip') }}" + dest: "/tmp/wordpress-importer.zip" + force: "yes" + +- name: Install wordpress importer plugin + command: > + sudo -u www-data wp --path=/var/www/html plugin install /tmp/wordpress-importer.zip --activate + args: + warn: "no" + +- name: Create temporary post directory + file: + path: /tmp/posts + state: directory + mode: "u=rwx,g=rwx,o=rx" + +- name: Unpack the posts + unarchive: + src: files/wpposts.zip + dest: /tmp/posts + remote_src: no + +- name: Wait for the posts to be unpacked + wait_for: + path: /tmp/posts + state: present + +- name: Import wordpress posts + command: > + wp --path=/var/www/html import /tmp/posts/superuser_content.xml --authors=create --quiet + +- name: Regenerate thumbnails for the imported posts + shell: > + sudo -u www-data wp --path=/var/www/html media regenerate --yes --quiet + +- name: Trigger post-activation hooks + shell: > + sudo -u www-data wp --path=/var/www/html + cron test + +- name: Flush rewrite rules, setup htaccess for nice permalinks + shell: > + sudo -u www-data + WP_CLI_CONFIG_PATH=/var/www/html/wp-content/themes/superuser/wp-cli.yml + wp --path=/var/www/html + rewrite flush --hard diff --git a/workloads/ansible/shade/lampstack/site.yml b/workloads/ansible/shade/lampstack/site.yml index 25a284f..47728b9 100755 --- a/workloads/ansible/shade/lampstack/site.yml +++ b/workloads/ansible/shade/lampstack/site.yml @@ -6,18 +6,22 @@ - "vars/{{ env }}.yml" roles: - "{{ action }}" + tags: "{{ action }}" - name: Install python2 for ansible to work - hosts: dbservers, webservers, balancers, wps + hosts: dbservers, webservers, balancers gather_facts: false user: "{{ app_env.ssh_user }}" become: true become_user: root vars_files: - "vars/{{ env }}.yml" + tasks: + - include: "roles/common/tasks/{{ app_env.target_os }}.yml" roles: - common environment: "{{ proxy_env }}" + tags: "common" - name: setup database hosts: dbservers @@ -29,9 +33,11 @@ roles: - database environment: "{{proxy_env}}" + tags: "database" - name: setup web servers hosts: webservers + gather_facts: true user: "{{ app_env.ssh_user }}" become: true become_user: root @@ -40,6 +46,7 @@ roles: - webserver environment: "{{proxy_env}}" + tags: "webserver" - name: setup load balancer servers hosts: balancers @@ -51,15 +58,19 @@ roles: - balancer environment: "{{proxy_env}}" + tags: "balancer" - name: install wordpress hosts: wps user: "{{ app_env.ssh_user }}" vars_files: - "vars/{{ env }}.yml" + tasks: + - include: "roles/wordpress/tasks/{{ app_env.target_os }}.yml" roles: - wordpress environment: "{{proxy_env}}" + tags: "wordpress" - name: clean up resources hosts: cloud @@ -71,6 +82,7 @@ roles: - cleaner environment: "{{proxy_env}}" + tags: "cleaner" - name: Inform the installer hosts: cloud @@ -94,3 +106,4 @@ msg: >- The work load test started at {{ hostvars.cloud.starttime.time }}, ended at {{ ansible_date_time.time }} + tags: "info" \ No newline at end of file diff --git a/workloads/ansible/shade/lampstack/vars/bluebox.yml b/workloads/ansible/shade/lampstack/vars/bluebox.yml old mode 100644 new mode 100755 index ab374a8..0d4e5dd --- a/workloads/ansible/shade/lampstack/vars/bluebox.yml +++ b/workloads/ansible/shade/lampstack/vars/bluebox.yml @@ -9,8 +9,9 @@ auth: { } app_env: { + target_os: "ubuntu", ssh_user: "ubuntu", - image_name: "ubuntu-15.04", + image_name: "ubuntu-16.10", region_name: "", availability_zone: "", validate_certs: True, @@ -20,6 +21,6 @@ app_env: { stack_size: 4, volume_size: 10, block_device_name: "/dev/vdb", - wp_theme: "https://downloads.wordpress.org/theme/iribbon.2.0.65.zip", - wp_posts: "http://wpcandy.s3.amazonaws.com/resources/postsxml.zip" + wp_latest: "https://wordpress.org/wordpress-4.6.1.tar.gz", + wp_importer: "http://downloads.wordpress.org/plugin/wordpress-importer.0.6.3.zip" } diff --git a/workloads/ansible/shade/lampstack/vars/dreamhost.yml b/workloads/ansible/shade/lampstack/vars/dreamhost.yml old mode 100644 new mode 100755 index 4112268..2401e8a --- a/workloads/ansible/shade/lampstack/vars/dreamhost.yml +++ b/workloads/ansible/shade/lampstack/vars/dreamhost.yml @@ -9,6 +9,7 @@ auth: { } app_env: { + target_os: "ubuntu", ssh_user: "ubuntu", region_name: "RegionOne", image_name: "Ubuntu-14.04", @@ -19,7 +20,5 @@ app_env: { public_key_file: "/home/reed/.ssh/id_rsa.pub", stack_size: 4, volume_size: 10, - block_device_name: "/dev/vdb", - wp_theme: "https://downloads.wordpress.org/theme/iribbon.2.0.65.zip", - wp_posts: "http://wpcandy.s3.amazonaws.com/resources/postsxml.zip" + block_device_name: "/dev/vdb" } diff --git a/workloads/ansible/shade/lampstack/vars/leap.yml b/workloads/ansible/shade/lampstack/vars/leap.yml old mode 100644 new mode 100755 index b2b0dec..1a6b5fe --- a/workloads/ansible/shade/lampstack/vars/leap.yml +++ b/workloads/ansible/shade/lampstack/vars/leap.yml @@ -10,17 +10,17 @@ auth: { } app_env: { - image_name: "ubuntu-15.04", + target_os: "ubuntu", + image_name: "ubuntu-14.04", region_name: "RegionOne", availability_zone: "nova", validate_certs: False, ssh_user: "ubuntu", - private_net_name: "Bluebox", - flavor_name: "m1.small", - public_key_file: "/home/tong/.ssh/id_rsa.pub", + private_net_name: "demonet", + flavor_name: "m1.large", + public_key_file: "/home/ubuntu/.ssh/id_rsa.pub", stack_size: 4, volume_size: 2, block_device_name: "/dev/vdb", - wp_theme: "https://downloads.wordpress.org/theme/iribbon.2.0.65.zip", - wp_posts: "http://wpcandy.s3.amazonaws.com/resources/postsxml.zip" + wp_latest: "https://wordpress.org/wordpress-4.6.tar.gz" } diff --git a/workloads/ansible/shade/lampstack/vars/osic.yml b/workloads/ansible/shade/lampstack/vars/osic.yml old mode 100644 new mode 100755 index 1a0e0f3..db7363d --- a/workloads/ansible/shade/lampstack/vars/osic.yml +++ b/workloads/ansible/shade/lampstack/vars/osic.yml @@ -10,6 +10,7 @@ auth: { } app_env: { + target_os: "ubuntu", image_name: "ubuntu-server-14.04", region_name: "", availability_zone: "nova", @@ -19,7 +20,5 @@ app_env: { public_key_file: "/home/tong/.ssh/id_rsa.pub", stack_size: 4, volume_size: 2, - block_device_name: "/dev/vdb", - wp_theme: "https://downloads.wordpress.org/theme/iribbon.2.0.65.zip", - wp_posts: "http://wpcandy.s3.amazonaws.com/resources/postsxml.zip" + block_device_name: "/dev/vdb" } diff --git a/workloads/ansible/shade/lampstack/vars/otc.yml b/workloads/ansible/shade/lampstack/vars/otc.yml old mode 100644 new mode 100755 index b863e4c..367e562 --- a/workloads/ansible/shade/lampstack/vars/otc.yml +++ b/workloads/ansible/shade/lampstack/vars/otc.yml @@ -8,6 +8,7 @@ auth: { } app_env: { + target_os: "ubuntu", image_name: "Community_Ubuntu_14.04_TSI_20161004_0", region_name: "", availability_zone: "eu-de-01", @@ -18,7 +19,5 @@ app_env: { ssh_user: "ubuntu", stack_size: 4, volume_size: 2, - block_device_name: "/dev/xvdb", - wp_theme: "https://downloads.wordpress.org/theme/iribbon.2.0.65.zip", - wp_posts: "http://wpcandy.s3.amazonaws.com/resources/postsxml.zip" + block_device_name: "/dev/xvdb" } diff --git a/workloads/ansible/shade/lampstack/vars/ovh.yml b/workloads/ansible/shade/lampstack/vars/ovh.yml old mode 100644 new mode 100755 index 6c3ea18..8599ce0 --- a/workloads/ansible/shade/lampstack/vars/ovh.yml +++ b/workloads/ansible/shade/lampstack/vars/ovh.yml @@ -9,6 +9,7 @@ auth: { } app_env: { + target_os: "ubuntu", ssh_user: "ubuntu", region_name: "SBG1", image_name: "Ubuntu 14.04", @@ -19,7 +20,5 @@ app_env: { public_key_file: "/home/ubuntu/.ssh/id_rsa.pub", stack_size: 4, volume_size: 4, - block_device_name: "/dev/vdb", - wp_theme: "https://downloads.wordpress.org/theme/iribbon.2.0.65.zip", - wp_posts: "http://wpcandy.s3.amazonaws.com/resources/postsxml.zip" + block_device_name: "/dev/vdb" } diff --git a/workloads/ansible/shade/lampstack/vars/trystack.yml b/workloads/ansible/shade/lampstack/vars/trystack.yml old mode 100644 new mode 100755 index 4186837..15135f3 --- a/workloads/ansible/shade/lampstack/vars/trystack.yml +++ b/workloads/ansible/shade/lampstack/vars/trystack.yml @@ -25,6 +25,7 @@ auth: { } app_env: { + target_os: "ubuntu", ssh_user: "ubuntu", image_name: "ubuntu1404", region_name: "regionOne", @@ -35,7 +36,5 @@ app_env: { public_key_file: "/root/.ssh/id_rsa.pub", stack_size: 4, volume_size: 2, - block_device_name: "/dev/vdb", - wp_theme: "https://downloads.wordpress.org/theme/iribbon.2.0.65.zip", - wp_posts: "http://wpcandy.s3.amazonaws.com/resources/postsxml.zip" + block_device_name: "/dev/vdb" } \ No newline at end of file