Skip to content
Permalink
Browse files

WordPressのインストールディレクトリを設定可能なパラメータを追加(未入力のとき/var/www/html直下にインストールするよう…

…条件分岐)
  • Loading branch information
imo-tikuwa committed Nov 4, 2019
1 parent d58c25e commit 861a82ce6ba09a632022cebd8d29662862b5cea7
Showing with 60 additions and 5 deletions.
  1. +60 −5 templates/simple/wordpress.json
@@ -18,6 +18,11 @@
"standard"
]
},
"WordPressInstallDirectoryName": {
"Description": "enter WordPress install directory name. If not entered, it will be installed directly under /var/www/html",
"Type": "String",
"Default": "wordpress"
},
"KeyName": {
"Description": "Name of an existing EC2 KeyPair to enable SSH access to the instances",
"Type": "AWS::EC2::KeyPair::KeyName",
@@ -131,6 +136,16 @@
"ConstraintDescription": "must contain only alphanumeric characters."
}
},
"Conditions": {
"WordPressInstallDirectoryNameIsEmpty": {
"Fn::Equals": [
{
"Ref": "WordPressInstallDirectoryName"
},
""
]
}
},
"Mappings": {
"AWSInstanceType2Arch": {
"t1.micro": {
@@ -723,7 +738,43 @@
"",
[
"#!/bin/bash -xe\n",
"cp /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-config.php\n",
"cd /var/www/html\n",
"\n",
"# wordpress move\n",
{
"Fn::If": [
"WordPressInstallDirectoryNameIsEmpty",
{
"Fn::Join": [
"",
[
"mv wordpress/* ./\n",
"rm -fR wordpress/\n"
]
]
},
{
"Fn::Join": [
"",
[
"mv wordpress ",
{
"Ref": "WordPressInstallDirectoryName"
},
"\n",
"cd ",
{
"Ref": "WordPressInstallDirectoryName"
},
"\n"
]
]
}
]
},
"\n",
"# create wp-config.php\n",
"cp wp-config-sample.php wp-config.php\n",
"sed -i \"s/'database_name_here'/'",
{
"Ref": "DBName"
@@ -749,7 +800,7 @@
"done <<< \"$SALTS\"\n",
"\n",
"# apache setting\n",
"chown -R apache: /var/www/html/wordpress\n"
"chown -R apache: .\n"
]
]
},
@@ -835,7 +886,7 @@
},
"03_configure_wordpress": {
"command": "/tmp/create-wp-config",
"cwd": "/var/www/html/wordpress"
"cwd": "~"
}
}
}
@@ -939,7 +990,10 @@
"PublicDnsName"
]
},
"/wordpress"
"/",
{
"Ref": "WordPressInstallDirectoryName"
}
]
]
},
@@ -971,7 +1025,8 @@
"Parameters": [
"InstanceType",
"WebServerVolumeType",
"WebServerVolumeSize"
"WebServerVolumeSize",
"WordPressInstallDirectoryName"
]
},
{

0 comments on commit 861a82c

Please sign in to comment.
You can’t perform that action at this time.