templates/aws-refarch-wordpress-04-web.yaml [587:650]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                  if [ ! -f /var/www/wordpress/${WPDirectory}/opcache-instanceid.php ]; then
                      wget -P /var/www/wordpress/${WPDirectory}/ https://s3.amazonaws.com/aws-refarch/wordpress/latest/bits/opcache-instanceid.php
                  fi
              mode: 000500
              owner: root
              group: root
        build_wordpress:
          files:
            /tmp/install_wordpress.sh:
              content:
                !Join [
                  "",[
                    "#!/bin/bash -xe\n",
                    "\n",
                    "# install wp-cli\n",
                    "if [ ! -f /bin/wp/wp-cli.phar ]; then\n",
                    "   curl -o /bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar\n",
                    "   chmod +x /bin/wp\n",
                    "fi\n",
                    "\n",
                    "# make site directory\n",
                    "if [ ! -d /var/www/wordpress/", !Ref WPDirectory, " ]; then\n",                    
                    "   mkdir -p /var/www/wordpress/", !Ref WPDirectory, "\n",
                    "\n",
                    "   cd /var/www/wordpress/", !Ref WPDirectory, "\n",
                    "   # install wordpress if not installed\n",
                    "   # use public alb host name if wp domain name was empty\n",
                    "   if ! $(wp core is-installed --allow-root); then\n",
                    "       wp core download --version='", !Ref WPVersion, "' --locale='", !Ref WPLocale, "' --allow-root\n",  
                    "       wp core config --dbname='", !Ref DatabaseName, "' --dbuser='", !Ref DatabaseMasterUsername, "' --dbpass='", !Ref DatabaseMasterPassword, "' --dbhost='", !Ref DatabaseClusterEndpointAddress, "' --dbprefix=wp_ --allow-root\n",
                    "       wp core install --url=", !If [ NoWPDomainName, !Ref PublicAlbHostname, !Join [ "", [ "'http://www.", !Ref WPDomainName, "'" ] ] ], " --title='", !Ref WPTitle, "' --admin_user='", !Ref WPAdminUsername, "' --admin_password='", !Ref WPAdminPassword, "' --admin_email='", !Ref WPAdminEmail, "' --skip-email --allow-root\n",
                    "       wp plugin install w3-total-cache\n",
                    "       sed -i \"/$table_prefix = 'wp_';/ a \\define('WP_HOME', 'http://' . \\$_SERVER['HTTP_HOST']); \" /var/www/wordpress/", !Ref WPDirectory, "/wp-config.php\n",
                    "       sed -i \"/$table_prefix = 'wp_';/ a \\define('WP_SITEURL', 'http://' . \\$_SERVER['HTTP_HOST']); \" /var/www/wordpress/", !Ref WPDirectory, "/wp-config.php\n",
                    "       # enable HTTPS in wp-config.php if ACM Public SSL Certificate parameter was not empty\n",
                            !If [ NoSslCertificate, !Join [ '', [ "       sed -i \"/$table_prefix = 'wp_';/ a \\# No ACM Public SSL Certificate \" /var/www/wordpress/", !Ref WPDirectory, "/wp-config.php\n" ] ] , !Join [ '', [ "       sed -i \"/$table_prefix = 'wp_';/ a \\$_SERVER['HTTPS'] = 'on';\" /var/www/wordpress/", !Ref WPDirectory, "/wp-config.php\n" ] ] ],
                    "\n",
                    "       # set permissions of wordpress site directories\n", 
                    "       chown -R apache:apache /var/www/wordpress/", !Ref WPDirectory, "\n",
                    "       chmod u+wrx /var/www/wordpress/", !Ref WPDirectory, "/wp-content/*\n",
                    "       if [ ! -f /var/www/wordpress/", !Ref WPDirectory, "/opcache-instanceid.php ]; then\n",
                    "         wget -P /var/www/wordpress/", !Ref WPDirectory, "/ https://s3.amazonaws.com/aws-refarch/wordpress/latest/bits/opcache-instanceid.php\n",
                    "       fi\n",
                    "   fi\n",
                    "   RESULT=$?\n",
                    "   if [ $RESULT -eq 0 ]; then\n",
                    "       touch /var/www/wordpress/", !Ref WPDirectory, "/wordpress.initialized\n",
                    "         else\n",
                    "       touch /var/www/wordpress/", !Ref WPDirectory, "/wordpress.failed\n",
                    "   fi\n",
                    "fi\n"
                  ]
                ]
              mode: 000500
              owner: root
              group: root
        download_aws_ini: 
          files:
            /tmp/download_aws_ini.sh:
              content:
                !Join [
                  "",[
                    "#!/bin/bash -x\n",
                    "\n",
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



templates/aws-refarch-wordpress-04-web.yaml [1004:1067]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                  if [ ! -f /var/www/wordpress/${WPDirectory}/opcache-instanceid.php ]; then
                      wget -P /var/www/wordpress/${WPDirectory}/ https://s3.amazonaws.com/aws-refarch/wordpress/latest/bits/opcache-instanceid.php
                  fi
              mode: 000500
              owner: root
              group: root
        build_wordpress:
          files:
            /tmp/install_wordpress.sh:
              content:
                !Join [
                  "",[
                    "#!/bin/bash -xe\n",
                    "\n",
                    "# install wp-cli\n",
                    "if [ ! -f /bin/wp/wp-cli.phar ]; then\n",
                    "   curl -o /bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar\n",
                    "   chmod +x /bin/wp\n",
                    "fi\n",
                    "\n",
                    "# make site directory\n",
                    "if [ ! -d /var/www/wordpress/", !Ref WPDirectory, " ]; then\n",                    
                    "   mkdir -p /var/www/wordpress/", !Ref WPDirectory, "\n",
                    "\n",
                    "   cd /var/www/wordpress/", !Ref WPDirectory, "\n",
                    "   # install wordpress if not installed\n",
                    "   # use public alb host name if wp domain name was empty\n",
                    "   if ! $(wp core is-installed --allow-root); then\n",
                    "       wp core download --version='", !Ref WPVersion, "' --locale='", !Ref WPLocale, "' --allow-root\n",  
                    "       wp core config --dbname='", !Ref DatabaseName, "' --dbuser='", !Ref DatabaseMasterUsername, "' --dbpass='", !Ref DatabaseMasterPassword, "' --dbhost='", !Ref DatabaseClusterEndpointAddress, "' --dbprefix=wp_ --allow-root\n",
                    "       wp core install --url=", !If [ NoWPDomainName, !Ref PublicAlbHostname, !Join [ "", [ "'http://www.", !Ref WPDomainName, "'" ] ] ], " --title='", !Ref WPTitle, "' --admin_user='", !Ref WPAdminUsername, "' --admin_password='", !Ref WPAdminPassword, "' --admin_email='", !Ref WPAdminEmail, "' --skip-email --allow-root\n",
                    "       wp plugin install w3-total-cache\n",
                    "       sed -i \"/$table_prefix = 'wp_';/ a \\define('WP_HOME', 'http://' . \\$_SERVER['HTTP_HOST']); \" /var/www/wordpress/", !Ref WPDirectory, "/wp-config.php\n",
                    "       sed -i \"/$table_prefix = 'wp_';/ a \\define('WP_SITEURL', 'http://' . \\$_SERVER['HTTP_HOST']); \" /var/www/wordpress/", !Ref WPDirectory, "/wp-config.php\n",
                    "       # enable HTTPS in wp-config.php if ACM Public SSL Certificate parameter was not empty\n",
                            !If [ NoSslCertificate, !Join [ '', [ "       sed -i \"/$table_prefix = 'wp_';/ a \\# No ACM Public SSL Certificate \" /var/www/wordpress/", !Ref WPDirectory, "/wp-config.php\n" ] ] , !Join [ '', [ "       sed -i \"/$table_prefix = 'wp_';/ a \\$_SERVER['HTTPS'] = 'on';\" /var/www/wordpress/", !Ref WPDirectory, "/wp-config.php\n" ] ] ],
                    "\n",
                    "       # set permissions of wordpress site directories\n", 
                    "       chown -R apache:apache /var/www/wordpress/", !Ref WPDirectory, "\n",
                    "       chmod u+wrx /var/www/wordpress/", !Ref WPDirectory, "/wp-content/*\n",
                    "       if [ ! -f /var/www/wordpress/", !Ref WPDirectory, "/opcache-instanceid.php ]; then\n",
                    "         wget -P /var/www/wordpress/", !Ref WPDirectory, "/ https://s3.amazonaws.com/aws-refarch/wordpress/latest/bits/opcache-instanceid.php\n",
                    "       fi\n",
                    "   fi\n",
                    "   RESULT=$?\n",
                    "   if [ $RESULT -eq 0 ]; then\n",
                    "       touch /var/www/wordpress/", !Ref WPDirectory, "/wordpress.initialized\n",
                    "         else\n",
                    "       touch /var/www/wordpress/", !Ref WPDirectory, "/wordpress.failed\n",
                    "   fi\n",
                    "fi\n"
                  ]
                ]
              mode: 000500
              owner: root
              group: root
        download_aws_ini: 
          files:
            /tmp/download_aws_ini.sh:
              content:
                !Join [
                  "",[
                    "#!/bin/bash -x\n",
                    "\n",
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



