|
4 | 4 | "Parameters" : { |
5 | 5 | "KeyName" : { |
6 | 6 | "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instances", |
7 | | - "Type" : "String", |
8 | | - "MinLength" : "1", |
9 | | - "MaxLength" : "64", |
10 | | - "AllowedPattern" : "[-+_.@ a-zA-Z0-9]+", |
11 | | - "ConstraintDescription" : "can contain only alphanumeric characters, spaces, dashes, plusses, underscores, dots, and at signs." |
| 7 | + "Type" : "AWS::EC2::KeyPair::KeyName" |
12 | 8 | }, |
13 | 9 | "MasterInstanceType" : { |
14 | 10 | "Description" : "Master Server EC2 instance type", |
|
164 | 160 | }, |
165 | 161 | "VPCId" : { |
166 | 162 | "Description" : "ID of the VPC you want to provision cluster into. Only used with UseVPCBase=false", |
167 | | - "Type" : "String" |
| 163 | + "Type" : "AWS::EC2::VPC::Id" |
168 | 164 | }, |
169 | 165 | "SSHFrom" : { |
170 | 166 | "Description" : "Lockdown SSH access (default can be accessed from anywhere)", |
|
321 | 317 | "torque", |
322 | 318 | "test" |
323 | 319 | ] |
| 320 | + }, |
| 321 | + "SharedDir" : { |
| 322 | + "Description" : "The path/mountpoint for the shared drive", |
| 323 | + "Type" : "String", |
| 324 | + "Default" : "/shared" |
| 325 | + }, |
| 326 | + "CLITemplate" : { |
| 327 | + "Type" : "String" |
324 | 328 | } |
325 | 329 | }, |
326 | 330 | "Conditions" : { |
|
1051 | 1055 | }, |
1052 | 1056 | "Condition" : "UseS3ReadWritePolicy" |
1053 | 1057 | }, |
1054 | | - "MasterIPAddress" : { |
| 1058 | + "MasterEIP" : { |
1055 | 1059 | "Type" : "AWS::EC2::EIP", |
1056 | 1060 | "Properties" : { |
1057 | | - "Domain" : "vpc", |
1058 | | - "InstanceId" : { |
1059 | | - "Ref" : "MasterServer" |
1060 | | - } |
| 1061 | + "Domain" : "vpc" |
1061 | 1062 | }, |
1062 | 1063 | "Condition" : "MasterPublicIp" |
1063 | 1064 | }, |
|
1108 | 1109 | "#!/bin/bash\n\n", |
1109 | 1110 | "function error_exit\n", |
1110 | 1111 | "{\n", |
1111 | | - " cfn-signal ${proxy_args} -e 1 -r \"$1\" '", |
| 1112 | + " cfn-signal ${proxy_args} --exit-code=1 --reason=\"$1\" --stack=", |
1112 | 1113 | { |
1113 | | - "Ref" : "MasterServerWaitHandle" |
| 1114 | + "Ref" : "AWS::StackName" |
| 1115 | + }, |
| 1116 | + " --resource=MasterServer --region=", |
| 1117 | + { |
| 1118 | + "Ref" : "AWS::Region" |
1114 | 1119 | }, |
1115 | | - "'\n", |
| 1120 | + "\n", |
1116 | 1121 | " exit 1\n", |
1117 | 1122 | "}\n", |
1118 | 1123 | "proxy=", |
|
1121 | 1126 | }, |
1122 | 1127 | "\n", |
1123 | 1128 | "if [ \"$proxy\" != \"NONE\" ]; then\n", |
1124 | | - " proxy_args=\"--http-proxy=${proxy}\"\n", |
| 1129 | + " proxy_args=\"--http-proxy=${proxy} --https-proxy=${proxy}\"\n", |
| 1130 | + " proxy_host=$(echo \"$proxy\" | awk -F/ '{print $3}' | cut -d: -f1)\n", |
| 1131 | + " proxy_port=$(echo \"$proxy\" | awk -F/ '{print $3}' | cut -d: -f2)\n", |
| 1132 | + " echo -e \"[Boto]\nproxy = ${proxy_host}\nproxy_port = ${proxy_port}\n\" >/etc/boto.cfg\n", |
1125 | 1133 | "else\n", |
1126 | 1134 | " proxy_args=\"\"\n", |
1127 | 1135 | "fi\n", |
|
1153 | 1161 | }, |
1154 | 1162 | " -c /tmp/cwlogs/cfn-logs.conf || error_exit 'Failed to run CloudWatch Logs agent setup'\n", |
1155 | 1163 | "fi\n", |
1156 | | - "cfn-signal ${proxy_args} -e 0 -r \"MasterServer setup complete\" '", |
| 1164 | + "cfn-signal ${proxy_args} --exit-code=0 --reason=\"MasterServer setup complete\" --stack=", |
| 1165 | + { |
| 1166 | + "Ref" : "AWS::StackName" |
| 1167 | + }, |
| 1168 | + " --resource=MasterServer --region=", |
1157 | 1169 | { |
1158 | | - "Ref" : "MasterServerWaitHandle" |
| 1170 | + "Ref" : "AWS::Region" |
1159 | 1171 | }, |
1160 | | - "'\n", |
| 1172 | + "\n", |
1161 | 1173 | "# End of file\n" |
1162 | 1174 | ] |
1163 | 1175 | ] |
|
1346 | 1358 | "owner" : "root", |
1347 | 1359 | "group" : "root" |
1348 | 1360 | }, |
1349 | | - "/opt/cfncluster/sqswatcher/sqswatcher.cfg" : { |
| 1361 | + "/etc/sqswatcher.cfg" : { |
1350 | 1362 | "content" : { |
1351 | 1363 | "Fn::Join" : [ |
1352 | 1364 | "", |
|
1393 | 1405 | "owner" : "root", |
1394 | 1406 | "group" : "root" |
1395 | 1407 | }, |
1396 | | - "/opt/cfncluster/cfncluster_supervisord.conf" : { |
| 1408 | + "/etc/cfncluster/cfncluster_supervisord.conf" : { |
1397 | 1409 | "content" : { |
1398 | 1410 | "Fn::Join" : [ |
1399 | 1411 | "", |
1400 | 1412 | [ |
1401 | 1413 | "[program:sqswatcher]\n", |
1402 | | - "directory = /opt/cfncluster/sqswatcher\n", |
1403 | | - "command = python ./sqswatcher.py\n" |
| 1414 | + "command = /usr/bin/sqswatcher\n" |
1404 | 1415 | ] |
1405 | 1416 | ] |
1406 | 1417 | }, |
|
1418 | 1429 | } |
1419 | 1430 | } |
1420 | 1431 | } |
| 1432 | + }, |
| 1433 | + "CreationPolicy" : { |
| 1434 | + "ResourceSignal" : { |
| 1435 | + "Count" : "1", |
| 1436 | + "Timeout" : "PT30M" |
| 1437 | + } |
1421 | 1438 | } |
1422 | 1439 | }, |
1423 | | - "MasterServerWaitCondition" : { |
1424 | | - "Type" : "AWS::CloudFormation::WaitCondition", |
1425 | | - "Properties" : { |
1426 | | - "Handle" : { |
1427 | | - "Ref" : "MasterServerWaitHandle" |
1428 | | - }, |
1429 | | - "Timeout" : "1800" |
1430 | | - } |
1431 | | - }, |
1432 | | - "MasterServerWaitHandle" : { |
1433 | | - "Type" : "AWS::CloudFormation::WaitConditionHandle" |
1434 | | - }, |
1435 | 1440 | "ComputeFleet" : { |
1436 | 1441 | "Type" : "AWS::AutoScaling::AutoScalingGroup", |
1437 | 1442 | "Properties" : { |
|
1506 | 1511 | ] |
1507 | 1512 | } |
1508 | 1513 | }, |
1509 | | - "DependsOn" : "MasterServerWaitCondition" |
| 1514 | + "DependsOn" : "MasterServer", |
| 1515 | + "CreationPolicy" : { |
| 1516 | + "ResourceSignal" : { |
| 1517 | + "Timeout" : "PT30M", |
| 1518 | + "Count" : { |
| 1519 | + "Ref" : "ComputeWaitConditionCount" |
| 1520 | + } |
| 1521 | + } |
| 1522 | + } |
1510 | 1523 | }, |
1511 | 1524 | "ComputeServerLaunchConfig" : { |
1512 | 1525 | "Type" : "AWS::AutoScaling::LaunchConfiguration", |
|
1555 | 1568 | "#!/bin/bash\n", |
1556 | 1569 | "function error_exit\n", |
1557 | 1570 | "{\n", |
1558 | | - " cfn-signal ${proxy_args} -e 1 -r \"$1\" '", |
| 1571 | + " cfn-signal ${proxy_args} --exit-code=1 --reason=\"$1\" --stack=", |
1559 | 1572 | { |
1560 | | - "Ref" : "ComputeWaitHandle" |
| 1573 | + "Ref" : "AWS::StackName" |
1561 | 1574 | }, |
1562 | | - "'\n", |
| 1575 | + " --resource=ComputeFleet --region=", |
| 1576 | + { |
| 1577 | + "Ref" : "AWS::Region" |
| 1578 | + }, |
| 1579 | + "\n", |
1563 | 1580 | " exit 1\n", |
1564 | 1581 | "}\n", |
1565 | 1582 | "proxy=", |
|
1568 | 1585 | }, |
1569 | 1586 | "\n", |
1570 | 1587 | "if [ \"$proxy\" != \"NONE\" ]; then\n", |
1571 | | - " proxy_args=\"--http-proxy=${proxy}\"\n", |
| 1588 | + " proxy_args=\"--http-proxy=${proxy} --https-proxy=${proxy}\"\n", |
| 1589 | + " proxy_host=$(echo \"$proxy\" | awk -F/ '{print $3}' | cut -d: -f1)\n", |
| 1590 | + " proxy_port=$(echo \"$proxy\" | awk -F/ '{print $3}' | cut -d: -f2)\n", |
| 1591 | + " echo -e \"[Boto]\nproxy = ${proxy_host}\nproxy_port = ${proxy_port}\n\" >/etc/boto.cfg\n", |
1572 | 1592 | "else\n", |
1573 | 1593 | " proxy_args=\"\"\n", |
1574 | 1594 | "fi\n", |
|
1601 | 1621 | }, |
1602 | 1622 | " -c /tmp/cwlogs/cfn-logs.conf || error_exit 'Failed to run CloudWatch Logs agent setup'\n", |
1603 | 1623 | "fi\n", |
1604 | | - "cfn-signal ${proxy_args} -e 0 -r \"Compute setup complete\" '", |
| 1624 | + "cfn-signal ${proxy_args} --exit-code=0 --reason=\"Compute setup complete\" --stack=", |
1605 | 1625 | { |
1606 | | - "Ref" : "ComputeWaitHandle" |
| 1626 | + "Ref" : "AWS::StackName" |
1607 | 1627 | }, |
1608 | | - "'\n" |
| 1628 | + " --resource=ComputeFleet --region=", |
| 1629 | + { |
| 1630 | + "Ref" : "AWS::Region" |
| 1631 | + }, |
| 1632 | + "\n" |
1609 | 1633 | ] |
1610 | 1634 | ] |
1611 | 1635 | } |
|
1733 | 1757 | "owner" : "root", |
1734 | 1758 | "group" : "root" |
1735 | 1759 | }, |
1736 | | - "/opt/cfncluster/nodewatcher/nodewatcher.cfg" : { |
| 1760 | + "/etc/nodewatcher.cfg" : { |
1737 | 1761 | "content" : { |
1738 | 1762 | "Fn::Join" : [ |
1739 | 1763 | "", |
|
1756 | 1780 | "owner" : "root", |
1757 | 1781 | "group" : "root" |
1758 | 1782 | }, |
1759 | | - "/opt/cfncluster/cfncluster_supervisord.conf" : { |
| 1783 | + "/etc/cfncluster/cfncluster_supervisord.conf" : { |
1760 | 1784 | "content" : { |
1761 | 1785 | "Fn::Join" : [ |
1762 | 1786 | "", |
1763 | 1787 | [ |
1764 | 1788 | "[program:nodewatcher]\n", |
1765 | | - "directory = /opt/cfncluster/nodewatcher\n", |
1766 | | - "command = python ./nodewatcher.py\n" |
| 1789 | + "command = /usr/bin/nodewatcher\n" |
1767 | 1790 | ] |
1768 | 1791 | ] |
1769 | 1792 | }, |
|
1830 | 1853 | } |
1831 | 1854 | } |
1832 | 1855 | }, |
1833 | | - "ComputeWaitHandle" : { |
1834 | | - "Type" : "AWS::CloudFormation::WaitConditionHandle" |
1835 | | - }, |
1836 | | - "ComputeWaitCondition" : { |
1837 | | - "Type" : "AWS::CloudFormation::WaitCondition", |
1838 | | - "Properties" : { |
1839 | | - "Handle" : { |
1840 | | - "Ref" : "ComputeWaitHandle" |
1841 | | - }, |
1842 | | - "Timeout" : "900", |
1843 | | - "Count" : { |
1844 | | - "Ref" : "ComputeWaitConditionCount" |
1845 | | - } |
1846 | | - } |
1847 | | - }, |
1848 | 1856 | "ScaleUpPolicy2" : { |
1849 | 1857 | "Type" : "AWS::AutoScaling::ScalingPolicy", |
1850 | 1858 | "Properties" : { |
|
2152 | 2160 | "RetentionInDays" : 7 |
2153 | 2161 | }, |
2154 | 2162 | "Condition" : "CloudWatchLogs" |
| 2163 | + }, |
| 2164 | + "AssosiateEIP" : { |
| 2165 | + "Type" : "AWS::EC2::EIPAssociation", |
| 2166 | + "Properties" : { |
| 2167 | + "AllocationId" : { |
| 2168 | + "Fn::GetAtt" : [ |
| 2169 | + "MasterEIP", |
| 2170 | + "AllocationId" |
| 2171 | + ] |
| 2172 | + }, |
| 2173 | + "NetworkInterfaceId" : { |
| 2174 | + "Ref" : "MasterENI" |
| 2175 | + } |
| 2176 | + }, |
| 2177 | + "Condition" : "MasterPublicIp" |
2155 | 2178 | } |
2156 | 2179 | }, |
2157 | 2180 | "Outputs" : { |
|
0 commit comments