Retire murano-deployment
Change-Id: I379c64805e45a3462d5d2530865cec2f878d57d3
This commit is contained in:
parent
8550b8e679
commit
c75c682069
|
@ -1,5 +0,0 @@
|
|||
[gerrit]
|
||||
host=review.openstack.org
|
||||
port=29418
|
||||
project=openstack/murano-deployment.git
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
This project is no longer maintained.
|
||||
|
||||
The contents of this repository are still available in the Git
|
||||
source code management system. To see the contents of this
|
||||
repository before it reached its end of life, please check out the
|
||||
previous commit with "git checkout HEAD^1".
|
||||
|
||||
For any further questions, please email
|
||||
openstack-discuss@lists.openstack.org or join #murano on Freenode.
|
30
README.rst
30
README.rst
|
@ -1,30 +0,0 @@
|
|||
========================
|
||||
Team and repository tags
|
||||
========================
|
||||
|
||||
.. image:: https://governance.openstack.org/badges/murano-deployment.svg
|
||||
:target: https://governance.openstack.org/reference/tags/index.html
|
||||
|
||||
.. Change things from this point on
|
||||
|
||||
Murano
|
||||
======
|
||||
Murano Project introduces an application catalog, which allows application
|
||||
developers and cloud administrators to publish various cloud-ready
|
||||
applications in a browsable categorised catalog, which may be used by the
|
||||
cloud users (including the inexperienced ones) to pick-up the needed
|
||||
applications and services and composes the reliable environments out of them
|
||||
in a "push-the-button" manner.
|
||||
|
||||
murano-deployment
|
||||
-----------------
|
||||
murano-deployment repository contains scripts and automation tools for
|
||||
murano CI system.
|
||||
|
||||
Project Resources
|
||||
-----------------
|
||||
* `Murano at Launchpad <http://launchpad.net/murano>`__
|
||||
* `Wiki <https://wiki.openstack.org/wiki/Murano>`__
|
||||
* `Code Review <https://review.openstack.org/>`__
|
||||
* `Sources <https://wiki.openstack.org/wiki/Murano/SourceCode>`__
|
||||
* `Developers Guide <http://murano-docs.github.io/latest/developers-guide/content/ch02.html>`__
|
|
@ -1,147 +0,0 @@
|
|||
CirrOS Notes
|
||||
############
|
||||
|
||||
|
||||
Launching CirrOS in KVM
|
||||
=======================
|
||||
|
||||
* Install KVM on your host
|
||||
|
||||
::
|
||||
|
||||
># apt-get install kvm libvirt-bin
|
||||
..
|
||||
|
||||
* Download CirrOS image from launchpad
|
||||
|
||||
::
|
||||
|
||||
># wget https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img -O cirros.qcow2
|
||||
..
|
||||
|
||||
* Add 169.254.169.254 to virbr0
|
||||
|
||||
::
|
||||
|
||||
># ip addr add 169.254.169.254/32 dev virbr0
|
||||
..
|
||||
|
||||
* Start CirrOS
|
||||
|
||||
::
|
||||
|
||||
># kvm -m 512 -drive file=cirros.qcow2 -net nic,model=virtio -net tap,ifname=tap0 -nographic
|
||||
..
|
||||
|
||||
* To poweroff the system and return to your console type
|
||||
|
||||
::
|
||||
|
||||
>$ sudo poweroff
|
||||
..
|
||||
|
||||
Modifying the image
|
||||
===================
|
||||
|
||||
http://alexeytorkhov.blogspot.ru/2009/09/mounting-raw-and-qcow2-vm-disk-images.html
|
||||
|
||||
* Get additional files to support muptipart userdata:
|
||||
|
||||
::
|
||||
|
||||
>$ cd ~
|
||||
>$ git clone https://github.com/openstack/murano-deployment.git
|
||||
..
|
||||
|
||||
* Convert Cirros image into RAW format (skip arch which you don't need):
|
||||
|
||||
::
|
||||
|
||||
># mkdir /tmp/cirros
|
||||
># cd /tmp/cirros
|
||||
>$ wget https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-i386-disk.img
|
||||
>$ wget https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img
|
||||
..
|
||||
|
||||
* Download murano-agent (skip arch which you don't need):
|
||||
|
||||
::
|
||||
|
||||
># cd /tmp/cirros
|
||||
># wget https://www.dropbox.com/sh/zthldcxnp6r4flm/Os1Q9W5ZIx/murano-agent-i386
|
||||
># wget https://www.dropbox.com/sh/zthldcxnp6r4flm/7dsz0mMg1_/murano-agent-x86_64
|
||||
..
|
||||
|
||||
* Convert Cirros image into RAW format:
|
||||
|
||||
::
|
||||
|
||||
># cd /tmp/cirros
|
||||
>$ qemu-img convert -O raw cirros-0.3.0-<ARCH>-disk.img cirros-raw.img
|
||||
..
|
||||
|
||||
* Mount the RAW image:
|
||||
|
||||
::
|
||||
|
||||
># mkdir /mnt/image
|
||||
># losetup /dev/loop0 cirros-raw.img
|
||||
># kpartx -a /dev/loop0
|
||||
># mount /dev/mapper/loop0p1 /mnt/image
|
||||
># cd /mnt/image
|
||||
..
|
||||
|
||||
* Copy new files and apply patch:
|
||||
|
||||
::
|
||||
|
||||
># cp ~/murano-deployment/cirros/config.local.sh /mnt/image/var/lib/cloud
|
||||
># patch -d /mnt/image/etc/init.d < ~/murano-deployment/cirros/cloud-userdata.patch
|
||||
..
|
||||
|
||||
* Copy murano-agent
|
||||
|
||||
::
|
||||
|
||||
># cp /tmp/cirros/murano-agent-<ARCH> /mnt/image/usr/sbin/murano-agent
|
||||
># chmod 755 /mnt/image/usr/sbin/murano-agent
|
||||
># chown root:root /mnt/image/usr/sbin/murano-agent
|
||||
..
|
||||
|
||||
* Copy init script
|
||||
|
||||
::
|
||||
|
||||
># cp /tmp/cirros/murano-agent.init /mnt/image/etc/init.d/murano-agent
|
||||
># chmod 755 /mnt/image/etc/init.d/murano-agent
|
||||
># chown root:root /mnt/image/etc/init.d/murano-agent
|
||||
..
|
||||
|
||||
* Create symlink
|
||||
|
||||
::
|
||||
|
||||
># cd /mnt/image/etc/rc3.d
|
||||
># ln -s ../init.d/murano-agent S99-murano-agent
|
||||
..
|
||||
|
||||
* Do everything else you need.
|
||||
|
||||
**WARNING**
|
||||
|
||||
::
|
||||
|
||||
Be careful creating links - use only relative paths for link targets!
|
||||
..
|
||||
|
||||
* Unmount the image and convert it back to QCOW:
|
||||
|
||||
::
|
||||
|
||||
># cd /tmp/cirros
|
||||
># umount /mnt/image
|
||||
># kpartx -d /dev/loop0
|
||||
># losetup -d /dev/loop0
|
||||
># qemu-img convert -O qcow2 cirros-raw.img murano-cirros.qcow2
|
||||
..
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -o xtrace
|
||||
set -o errexit
|
||||
|
||||
arch=${1:-i386}
|
||||
# Image Builder Root
|
||||
IBR=${IBR:-/tmp/murano-cirros/$arch}
|
||||
LOOP_DEV=${LOOP_DEV:-loop0}
|
||||
DEBUG='false'
|
||||
|
||||
|
||||
die() {
|
||||
cat "
|
||||
|
||||
***** ***** ***** ***** *****
|
||||
$@
|
||||
***** ***** ***** ***** *****
|
||||
"
|
||||
}
|
||||
|
||||
apt-get install kpartx |:
|
||||
|
||||
mkdir -p $IBR |:
|
||||
|
||||
case $arch in
|
||||
i386)
|
||||
wget -O $IBR/cirros.img https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-i386-disk.img
|
||||
if [ "$DEBUG" = 'true' ] ; then
|
||||
wget -O $IBR/murano-agent https://www.dropbox.com/sh/zthldcxnp6r4flm/Os1Q9W5ZIx/murano-agent-i386
|
||||
else
|
||||
wget -O $IBR/murano-agent https://www.dropbox.com/sh/zthldcxnp6r4flm/Os1Q9W5ZIx/murano-agent-i386
|
||||
fi
|
||||
;;
|
||||
x86_64)
|
||||
wget -O $IBR/cirros.img https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img
|
||||
if [ "$DEBUG" = 'true' ] ; then
|
||||
wget -O $IBR/murano-agent https://www.dropbox.com/sh/zthldcxnp6r4flm/CAEdNRkJAD/murano-agent-x86_64-debug
|
||||
else
|
||||
wget -O $IBR/murano-agent https://www.dropbox.com/sh/zthldcxnp6r4flm/7dsz0mMg1_/murano-agent-x86_64
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
die "Unsupported arch '$arch'"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
qemu-img convert -O raw $IBR/cirros.img $IBR/cirros.raw
|
||||
|
||||
mkdir /mnt/image |:
|
||||
|
||||
losetup --all | grep -q $LOOP_DEV && \
|
||||
die "Device /dev/$LOOP_DEV already exists."
|
||||
|
||||
|
||||
losetup /dev/$LOOP_DEV $IBR/cirros.raw
|
||||
kpartx -a /dev/$LOOP_DEV
|
||||
mount /dev/mapper/${LOOP_DEV}p1 /mnt/image
|
||||
|
||||
|
||||
cp ./config.local.sh /mnt/image/var/lib/cloud
|
||||
patch -d /mnt/image/etc/init.d < ./cloud-userdata.patch
|
||||
|
||||
cp $IBR/murano-agent /mnt/image/usr/sbin
|
||||
chmod 755 /mnt/image/usr/sbin/murano-agent
|
||||
chown root:root /mnt/image/usr/sbin/murano-agent
|
||||
|
||||
cp ./murano-agent.init /mnt/image/etc/init.d/murano-agent
|
||||
chmod 755 /mnt/image/etc/init.d/murano-agent
|
||||
chown root:root /mnt/image/etc/init.d/murano-agent
|
||||
cd /mnt/image/etc/rc3.d && ln -s ../init.d/murano-agent S47-murano-agent
|
||||
|
||||
cd $IBR
|
||||
sleep 5
|
||||
|
||||
umount /mnt/image
|
||||
kpartx -d /dev/$LOOP_DEV
|
||||
losetup -d /dev/$LOOP_DEV
|
||||
|
||||
|
||||
qemu-img convert -O qcow2 $IBR/cirros.raw $IBR/murano-cirros.qcow2
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
--- cloud-userdata.orig 2013-10-01 04:06:29.000000000 -0700
|
||||
+++ cloud-userdata 2013-10-01 04:07:03.000000000 -0700
|
||||
@@ -22,13 +22,7 @@
|
||||
wget -q -O - "${UDURL}" > "${udf}" ||
|
||||
{ msg "failed to read user data url: ${UDURL}"; return 1; }
|
||||
|
||||
- shebang="#!"
|
||||
- read a < "${udf}"
|
||||
- [ "${a#${shebang}}" = "${a}" ] &&
|
||||
- { msg "user data not a script"; return 0; }
|
||||
-
|
||||
- chmod 755 "${udf}"
|
||||
- exec "${udf}"
|
||||
+ exec_userdata "${udf}"
|
||||
}
|
||||
|
||||
case "$1" in
|
|
@ -1,54 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
get_boundary() {
|
||||
local udf=${1}
|
||||
|
||||
sed -nr 's/Content-Type: multipart\/mixed; boundary="(.*)"/\1/p' "${udf}"
|
||||
}
|
||||
|
||||
split_multipart() {
|
||||
local udf=${1}
|
||||
local n=0
|
||||
|
||||
shift
|
||||
while [ $# -ge 2 ] ; do
|
||||
tail -n +$((${1} + 1)) "${udf}" | head -n $((${2} - ${1} - 1)) | \
|
||||
awk "//{if(f2==1){print \$0;next}} /^$/{if(f2==0){f1=1;next}} //{if(f1==1){f2=1;print \$0}}" > "${udf}.part.${n}"
|
||||
echo ${n}
|
||||
n=$((n + 1))
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
exec_userdata() {
|
||||
local udf=${1}
|
||||
local boundary=$(get_boundary "${udf}")
|
||||
local boundary_line_numbers=""
|
||||
local n=""
|
||||
local parts=""
|
||||
|
||||
if [ -z "${boundary}" ] ; then
|
||||
exec_script "${udf}"
|
||||
else
|
||||
boundary_line_numbers=$(awk -F ':' "/\-\-${boundary}/{s=s \" \" NR} END{print s}" "${udf}")
|
||||
parts=$(split_multipart "${udf}" $boundary_line_numbers)
|
||||
|
||||
for n in ${parts} ; do
|
||||
exec_script "${udf}.part.${n}"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
exec_script() {
|
||||
local udf=${1}
|
||||
local shebang="#!/bin/sh"
|
||||
local a=""
|
||||
|
||||
read a < "${udf}"
|
||||
[ "${a#${shebang}}" = "${a}" ] &&
|
||||
{ msg "user data not a script"; return 0; }
|
||||
|
||||
chmod 755 "${udf}"
|
||||
exec "${udf}"
|
||||
}
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Starts murano-agent
|
||||
#
|
||||
|
||||
AGENT_CONFIG=/etc/murano/agent.config
|
||||
AGENT_LOG=/var/log/murano-agent.log
|
||||
|
||||
echo "M U R A N O"
|
||||
|
||||
check_agent() {
|
||||
# Make sure that the murano-agent progam exists
|
||||
[ -f /usr/sbin/murano-agent ] || exit 0
|
||||
[ -f "$AGENT_CONFIG" ] || exit 0
|
||||
}
|
||||
|
||||
start() {
|
||||
echo -n "Starting murano-agent: "
|
||||
umask 077
|
||||
echo "$(/bin/date) starting /usr/sbin/murano-agent $AGENT_CONFIG $AGENT_LOG" > $AGENT_LOG
|
||||
start-stop-daemon -S -u root -q -b -x /usr/sbin/murano-agent -- $AGENT_CONFIG $AGENT_LOG
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n "Stopping murano-agent: "
|
||||
start-stop-daemon -K -u root -x /usr/sbin/murano-agent
|
||||
#killall murano-agent
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
check_agent
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart|reload)
|
||||
restart
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
{
|
||||
"Scripts": [
|
||||
"DQpGdW5jdGlvbiBJbnN0YWxsLVJvbGVQcmltYXJ5RG9tYWluQ29udHJvbGxlcg0Kew0KPCMNCi5TWU5PUFNJUw0KQ29uZmlndXJlIG5vZGUncyBuZXR3b3JrIGFkYXB0ZXJzLg0KQ3JlYXRlIGZpcnN0IGRvbWFpbiBjb250cm9sbGVyIGluIHRoZSBmb3Jlc3QuDQoNCi5FWEFNUExFDQpQUz4gSW5zdGFsbC1Sb2xlUHJpbWFyeURvbWFpbkNvbnRyb2xsZXIgLURvbWFpbk5hbWUgYWNtZS5sb2NhbCAtU2FmZU1vZGVQYXNzd29yZCAiUEBzc3cwcmQiDQoNCkluc3RhbGwgRE5TIGFuZCBBRERTLCBjcmVhdGUgZm9yZXN0IGFuZCBkb21haW4gJ2FjbWUubG9jYWwnLg0KU2V0IERDIHJlY292ZXJ5IG1vZGUgcGFzc3dvcmQgdG8gJ1BAc3N3MHJkJy4NCiM+DQoJDQoJcGFyYW0NCgkoDQoJCVtTdHJpbmddDQoJCSMgTmV3IGRvbWFpbiBuYW1lLg0KCQkkRG9tYWluTmFtZSwNCgkJDQoJCVtTdHJpbmddDQoJCSMgRG9tYWluIGNvbnRyb2xsZXIgcmVjb3ZlcnkgbW9kZSBwYXNzd29yZC4NCgkJJFNhZmVNb2RlUGFzc3dvcmQNCgkpDQoNCgl0cmFwIHsgU3RvcC1FeGVjdXRpb24gJF8gfQ0KDQogICAgICAgICMgQWRkIHJlcXVpcmVkIHdpbmRvd3MgZmVhdHVyZXMNCglBZGQtV2luZG93c0ZlYXR1cmVXcmFwcGVyIGANCgkJLU5hbWUgIkROUyIsIkFELURvbWFpbi1TZXJ2aWNlcyIsIlJTQVQtREZTLU1nbXQtQ29uIiBgDQoJCS1JbmNsdWRlTWFuYWdlbWVudFRvb2xzIGANCiAgICAgICAgLU5vdGlmeVJlc3RhcnQNCg0KDQoJV3JpdGUtTG9nICJDcmVhdGluZyBmaXJzdCBkb21haW4gY29udHJvbGxlciAuLi4iDQoJCQ0KCSRTTUFQID0gQ29udmVydFRvLVNlY3VyZVN0cmluZyAtU3RyaW5nICRTYWZlTW9kZVBhc3N3b3JkIC1Bc1BsYWluVGV4dCAtRm9yY2UNCgkJDQoJSW5zdGFsbC1BRERTRm9yZXN0IGANCgkJLURvbWFpbk5hbWUgJERvbWFpbk5hbWUgYA0KCQktU2FmZU1vZGVBZG1pbmlzdHJhdG9yUGFzc3dvcmQgJFNNQVAgYA0KCQktRG9tYWluTW9kZSBEZWZhdWx0IGANCgkJLUZvcmVzdE1vZGUgRGVmYXVsdCBgDQoJCS1Ob1JlYm9vdE9uQ29tcGxldGlvbiBgDQoJCS1Gb3JjZSBgDQoJCS1FcnJvckFjdGlvbiBTdG9wIHwgT3V0LU51bGwNCg0KCVdyaXRlLUxvZyAiV2FpdGluZyBmb3IgcmVib290IC4uLiIJCQ0KIwlTdG9wLUV4ZWN1dGlvbiAtRXhpdENvZGUgMzAxMCAtRXhpdFN0cmluZyAiQ29tcHV0ZXIgbXVzdCBiZSByZXN0YXJ0ZWQgdG8gZmluaXNoIGRvbWFpbiBjb250cm9sbGVyIHByb21vdGlvbi4iDQojCVdyaXRlLUxvZyAiUmVzdGFyaW5nIGNvbXB1dGVyIC4uLiINCiMJUmVzdGFydC1Db21wdXRlciAtRm9yY2UNCn0NCg=="
|
||||
],
|
||||
"Commands": [
|
||||
{
|
||||
"Name": "Import-Module",
|
||||
"Arguments": {
|
||||
"Name": "CoreFunctions"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Set-LocalUserPassword",
|
||||
"Arguments": {
|
||||
"UserName": "Administrator",
|
||||
"Password": "P@ssw0rd123",
|
||||
"Force": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Install-RolePrimaryDomainController",
|
||||
"Arguments": {
|
||||
"DomainName": "acme.local",
|
||||
"SafeModePassword": "P@ssw0rd"
|
||||
}
|
||||
}
|
||||
],
|
||||
"RebootOnCompletion": 1
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
include Install-RolePrimaryDomainController.ps1
|
||||
|
||||
call Import-Module Name="CoreFunctions"
|
||||
call Set-LocalUserPassword UserName="Administrator" , Password="P@ssw0rd123" , Force=true
|
||||
call Install-RolePrimaryDomainController DomainName="acme.local" , SafeModePassword="P@ssw0rd"
|
||||
|
||||
reboot 1
|
||||
|
||||
out CreatePrimaryDC.json
|
|
@ -1,21 +0,0 @@
|
|||
Scripts:
|
||||
- Install-RolePrimaryDomainController.ps1
|
||||
|
||||
Commands:
|
||||
- Name: Import-Module
|
||||
Arguments:
|
||||
Name: CoreFunctions
|
||||
|
||||
- Name: Set-LocalUserPassword
|
||||
Arguments:
|
||||
UserName: "Administrator"
|
||||
Password: "P@ssw0rd123"
|
||||
Force: true
|
||||
|
||||
- Name: Install-RolePrimaryDomainController
|
||||
Arguments:
|
||||
DomainName: "acme.local"
|
||||
SafeModePassword: "P@ssw0rd"
|
||||
|
||||
RebootOnCompletion: 1
|
||||
|
|
@ -1 +0,0 @@
|
|||
..\ExecutionPlanGenerator.exe ExecutionPlan.txt
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
for yaml_file in *.yaml ; do
|
||||
[[ -e $yaml_file ]] || break # handle the case of no *.yaml files
|
||||
echo "Converting $yaml_file ..."
|
||||
../ExecutionPlanGenerator.py $yaml_file
|
||||
done
|
||||
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
|
||||
Function Install-RolePrimaryDomainController
|
||||
{
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Configure node's network adapters.
|
||||
Create first domain controller in the forest.
|
||||
|
||||
.EXAMPLE
|
||||
PS> Install-RolePrimaryDomainController -DomainName acme.local -SafeModePassword "P@ssw0rd"
|
||||
|
||||
Install DNS and ADDS, create forest and domain 'acme.local'.
|
||||
Set DC recovery mode password to 'P@ssw0rd'.
|
||||
#>
|
||||
|
||||
param
|
||||
(
|
||||
[String]
|
||||
# New domain name.
|
||||
$DomainName,
|
||||
|
||||
[String]
|
||||
# Domain controller recovery mode password.
|
||||
$SafeModePassword
|
||||
)
|
||||
|
||||
trap { Stop-Execution $_ }
|
||||
|
||||
# Add required windows features
|
||||
Add-WindowsFeatureWrapper `
|
||||
-Name "DNS","AD-Domain-Services","RSAT-DFS-Mgmt-Con" `
|
||||
-IncludeManagementTools `
|
||||
-NotifyRestart
|
||||
|
||||
|
||||
Write-Log "Creating first domain controller ..."
|
||||
|
||||
$SMAP = ConvertTo-SecureString -String $SafeModePassword -AsPlainText -Force
|
||||
|
||||
Install-ADDSForest `
|
||||
-DomainName $DomainName `
|
||||
-SafeModeAdministratorPassword $SMAP `
|
||||
-DomainMode Default `
|
||||
-ForestMode Default `
|
||||
-NoRebootOnCompletion `
|
||||
-Force `
|
||||
-ErrorAction Stop | Out-Null
|
||||
|
||||
Write-Log "Waiting for reboot ..."
|
||||
# Stop-Execution -ExitCode 3010 -ExitString "Computer must be restarted to finish domain controller promotion."
|
||||
# Write-Log "Restaring computer ..."
|
||||
# Restart-Computer -Force
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
import ../../WindowsPowerShell/Functions/Join-Domain.ps1
|
||||
|
||||
call Import-Module Name="CoreFunctions"
|
||||
call Set-NetworkAdapterConfiguration FirstAvailable=true , DNSServer="10.0.102.2"
|
||||
call Join-Domain DomainName="acme.local" , Username="Administrator" , Password="P@ssw0rd123"
|
||||
|
||||
reboot 1
|
||||
|
||||
out out.json
|
||||
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
Scripts:
|
||||
- ../../WindowsPowerShell/Functions/Join-Domain.ps1
|
||||
|
||||
Commands:
|
||||
- Name: Import-Module
|
||||
Arguments:
|
||||
Name: "CoreFunctions"
|
||||
|
||||
- Name: Set-NetworkAdapterConfiguration
|
||||
Arguments:
|
||||
FirstAvailable: true
|
||||
DNSServer: "10.0.102.2"
|
||||
|
||||
- Name: Join-Domain
|
||||
Arguments:
|
||||
DomainName: "acme.local"
|
||||
Username: "Administrator"
|
||||
Password: "P@ssw0rd123"
|
||||
OUPath: ""
|
||||
|
||||
RebootOnCompletion: 1
|
||||
|
||||
|
|
@ -1 +0,0 @@
|
|||
..\ExecutionPlanGenerator.exe ExecutionPlan.txt
|
|
@ -1,8 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
for yaml_file in *.yaml ; do
|
||||
[[ -e $yaml_file ]] || break # handle the case of no *.yaml files
|
||||
echo "Converting $yaml_file ..."
|
||||
../ExecutionPlanGenerator.py $yaml_file
|
||||
done
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
"Scripts": [],
|
||||
"Commands": [
|
||||
{
|
||||
"Name": "Import-Module",
|
||||
"Arguments": {
|
||||
"Name": "CoreFunctions"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Set-NetworkAdapterConfiguration",
|
||||
"Arguments": {
|
||||
"FirstAvailable": true,
|
||||
"DNSServer": "10.0.102.2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Join-Domain",
|
||||
"Arguments": {
|
||||
"DomainName": "acme.local",
|
||||
"Username": "Administrator",
|
||||
"Password": "P@ssw0rd123"
|
||||
}
|
||||
}
|
||||
],
|
||||
"RebootOnCompletion": 1
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
include Install-RoleSecondaryDomainController.ps1
|
||||
|
||||
call Import-Module Name="CoreFunctions"
|
||||
call Install-RoleSecondaryDomainController DomainName="acme.local" , UserName="Administrator" , Password="P@ssw0rd123" , SafeModePassword="P@ssw0rd"
|
||||
|
||||
reboot 1
|
||||
|
||||
out out.json
|
|
@ -1,16 +0,0 @@
|
|||
Scripts:
|
||||
- Install-RoleSecondaryDomainController.ps1
|
||||
|
||||
Commands:
|
||||
- Name: Import-Module
|
||||
Arguments:
|
||||
Name: "CoreFunctions"
|
||||
|
||||
- Name: Install-RoleSecondaryDomainController
|
||||
Arguments:
|
||||
DomainName: "acme.local"
|
||||
UserName: "Administrator"
|
||||
Password: "P@ssw0rd123"
|
||||
SafeModePassword: "P@ssw0rd"
|
||||
|
||||
RebootOnCompletion: 1
|
|
@ -1 +0,0 @@
|
|||
..\ExecutionPlanGenerator.exe ExecutionPlan.txt
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
for yaml_file in *.yaml ; do
|
||||
[[ -e $yaml_file ]] || break # handle the case of no *.yaml files
|
||||
echo "Converting $yaml_file ..."
|
||||
../ExecutionPlanGenerator.py $yaml_file
|
||||
done
|
||||
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
Function Install-RoleSecondaryDomainController
|
||||
{
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Install additional (secondary) domain controller.
|
||||
|
||||
#>
|
||||
param
|
||||
(
|
||||
[String]
|
||||
# Domain name to join to.
|
||||
$DomainName,
|
||||
|
||||
[String]
|
||||
# Domain user who is allowed to join computer to domain.
|
||||
$UserName,
|
||||
|
||||
[String]
|
||||
# User's password.
|
||||
$Password,
|
||||
|
||||
[String]
|
||||
# Domain controller recovery mode password.
|
||||
$SafeModePassword
|
||||
)
|
||||
|
||||
trap { Stop-Execution $_ }
|
||||
|
||||
$Credential = New-Credential -UserName "$DomainName\$UserName" -Password $Password
|
||||
|
||||
# Add required windows features
|
||||
Add-WindowsFeatureWrapper `
|
||||
-Name "DNS","AD-Domain-Services","RSAT-DFS-Mgmt-Con" `
|
||||
-IncludeManagementTools `
|
||||
-NotifyRestart
|
||||
|
||||
|
||||
Write-Log "Adding secondary domain controller ..."
|
||||
|
||||
$SMAP = ConvertTo-SecureString -String $SafeModePassword -AsPlainText -Force
|
||||
|
||||
Install-ADDSDomainController `
|
||||
-DomainName $DomainName `
|
||||
-SafeModeAdministratorPassword $SMAP `
|
||||
-Credential $Credential `
|
||||
-NoRebootOnCompletion `
|
||||
-Force `
|
||||
-ErrorAction Stop | Out-Null
|
||||
|
||||
Write-Log "Waiting for restart ..."
|
||||
# Stop-Execution -ExitCode 3010 -ExitString "Computer must be restarted to finish domain controller promotion."
|
||||
# Write-Log "Restarting computer ..."
|
||||
# Restart-Computer -Force
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
{
|
||||
"Scripts": [
|
||||
"RnVuY3Rpb24gSW5zdGFsbC1Sb2xlU2Vjb25kYXJ5RG9tYWluQ29udHJvbGxlcg0Kew0KPCMNCi5TWU5PUFNJUw0KSW5zdGFsbCBhZGRpdGlvbmFsIChzZWNvbmRhcnkpIGRvbWFpbiBjb250cm9sbGVyLg0KDQojPg0KCXBhcmFtDQoJKA0KCQlbU3RyaW5nXQ0KCQkjIERvbWFpbiBuYW1lIHRvIGpvaW4gdG8uDQoJCSREb21haW5OYW1lLA0KCQkNCgkJW1N0cmluZ10NCgkJIyBEb21haW4gdXNlciB3aG8gaXMgYWxsb3dlZCB0byBqb2luIGNvbXB1dGVyIHRvIGRvbWFpbi4NCgkJJFVzZXJOYW1lLA0KCQkNCgkJW1N0cmluZ10NCgkJIyBVc2VyJ3MgcGFzc3dvcmQuDQoJCSRQYXNzd29yZCwNCgkJDQoJCVtTdHJpbmddDQoJCSMgRG9tYWluIGNvbnRyb2xsZXIgcmVjb3ZlcnkgbW9kZSBwYXNzd29yZC4NCgkJJFNhZmVNb2RlUGFzc3dvcmQNCgkpDQoNCgl0cmFwIHsgU3RvcC1FeGVjdXRpb24gJF8gfQ0KCQ0KCSRDcmVkZW50aWFsID0gTmV3LUNyZWRlbnRpYWwgLVVzZXJOYW1lICIkRG9tYWluTmFtZVwkVXNlck5hbWUiIC1QYXNzd29yZCAkUGFzc3dvcmQNCgkJDQoJIyBBZGQgcmVxdWlyZWQgd2luZG93cyBmZWF0dXJlcw0KCUFkZC1XaW5kb3dzRmVhdHVyZVdyYXBwZXIgYA0KCQktTmFtZSAiRE5TIiwiQUQtRG9tYWluLVNlcnZpY2VzIiwiUlNBVC1ERlMtTWdtdC1Db24iIGANCgkJLUluY2x1ZGVNYW5hZ2VtZW50VG9vbHMgYA0KICAgICAgICAgICAgICAgIC1Ob3RpZnlSZXN0YXJ0DQoJCQ0KCQ0KICAgICAgICBXcml0ZS1Mb2cgIkFkZGluZyBzZWNvbmRhcnkgZG9tYWluIGNvbnRyb2xsZXIgLi4uIg0KICAgIA0KCSRTTUFQID0gQ29udmVydFRvLVNlY3VyZVN0cmluZyAtU3RyaW5nICRTYWZlTW9kZVBhc3N3b3JkIC1Bc1BsYWluVGV4dCAtRm9yY2UNCg0KCUluc3RhbGwtQUREU0RvbWFpbkNvbnRyb2xsZXIgYA0KCQktRG9tYWluTmFtZSAkRG9tYWluTmFtZSBgDQoJCS1TYWZlTW9kZUFkbWluaXN0cmF0b3JQYXNzd29yZCAkU01BUCBgDQoJCS1DcmVkZW50aWFsICRDcmVkZW50aWFsIGANCgkJLU5vUmVib290T25Db21wbGV0aW9uIGANCgkJLUZvcmNlIGANCgkJLUVycm9yQWN0aW9uIFN0b3AgfCBPdXQtTnVsbA0KDQoJV3JpdGUtTG9nICJXYWl0aW5nIGZvciByZXN0YXJ0IC4uLiINCiMJU3RvcC1FeGVjdXRpb24gLUV4aXRDb2RlIDMwMTAgLUV4aXRTdHJpbmcgIkNvbXB1dGVyIG11c3QgYmUgcmVzdGFydGVkIHRvIGZpbmlzaCBkb21haW4gY29udHJvbGxlciBwcm9tb3Rpb24uIg0KIwlXcml0ZS1Mb2cgIlJlc3RhcnRpbmcgY29tcHV0ZXIgLi4uIg0KIwlSZXN0YXJ0LUNvbXB1dGVyIC1Gb3JjZQ0KfQ0K"
|
||||
],
|
||||
"Commands": [
|
||||
{
|
||||
"Name": "Import-Module",
|
||||
"Arguments": {
|
||||
"Name": "CoreFunctions"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Install-RoleSecondaryDomainController",
|
||||
"Arguments": {
|
||||
"DomainName": "acme.local",
|
||||
"UserName": "Administrator",
|
||||
"Password": "P@ssw0rd123",
|
||||
"SafeModePassword": "P@ssw0rd"
|
||||
}
|
||||
}
|
||||
],
|
||||
"RebootOnCompletion": 1
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
include Install-RoleSecondaryDomainController.ps1
|
||||
|
||||
call Import-Module Name="CoreFunctions"
|
||||
call Set-NetworkAdapterConfiguration FirstAvailable=true , DNSServer="10.0.102.2"
|
||||
call Join-Domain DomainName="acme.local" , Username="Administrator" , Password="P@ssw0rd123" , AllowRestart=true
|
||||
call Install-RoleSecondaryDomainController DomainName="acme.local" , UserName="Administrator" , Password="P@ssw0rd123" , SafeModePassword="P@ssw0rd"
|
||||
|
||||
reboot 1
|
||||
|
||||
out out.json
|
|
@ -1,29 +0,0 @@
|
|||
Scripts:
|
||||
- Install-RoleSecondaryDomainController.ps1
|
||||
- ../../WindowsPowerShell/Functions/Join-Domain.ps1
|
||||
|
||||
Commands:
|
||||
- Name: Import-Module
|
||||
Arguments:
|
||||
Name: "CoreFunctions"
|
||||
|
||||
- Name: Set-NetworkAdapterConfiguration
|
||||
Arguments:
|
||||
FirstAvailable: true
|
||||
DNSServer: "10.0.102.2"
|
||||
|
||||
- Name: Join-Domain
|
||||
Arguments:
|
||||
DomainName; "acme.local"
|
||||
Username: "Administrator"
|
||||
Password: "P@ssw0rd123"
|
||||
AllowRestart: true
|
||||
|
||||
- Name: Install-RoleSecondaryDomainController
|
||||
Arguments:
|
||||
DomainName: "acme.local"
|
||||
UserName: "Administrator"
|
||||
Password: "P@ssw0rd123"
|
||||
SafeModePassword: "P@ssw0rd"
|
||||
|
||||
RebootOnCompletion: 1
|
|
@ -1 +0,0 @@
|
|||
..\ExecutionPlanGenerator.exe ExecutionPlan.txt
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
for yaml_file in *.yaml ; do
|
||||
[[ -e $yaml_file ]] || break # handle the case of no *.yaml files
|
||||
echo "Converting $yaml_file ..."
|
||||
../ExecutionPlanGenerator.py $yaml_file
|
||||
done
|
||||
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
Function Install-RoleSecondaryDomainController
|
||||
{
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Install additional (secondary) domain controller.
|
||||
|
||||
#>
|
||||
param
|
||||
(
|
||||
[String]
|
||||
# Domain name to join to.
|
||||
$DomainName,
|
||||
|
||||
[String]
|
||||
# Domain user who is allowed to join computer to domain.
|
||||
$UserName,
|
||||
|
||||
[String]
|
||||
# User's password.
|
||||
$Password,
|
||||
|
||||
[String]
|
||||
# Domain controller recovery mode password.
|
||||
$SafeModePassword
|
||||
)
|
||||
|
||||
trap { Stop-Execution $_ }
|
||||
|
||||
$Credential = New-Credential -UserName "$DomainName\$UserName" -Password $Password
|
||||
|
||||
# Add required windows features
|
||||
Add-WindowsFeatureWrapper `
|
||||
-Name "DNS","AD-Domain-Services","RSAT-DFS-Mgmt-Con" `
|
||||
-IncludeManagementTools `
|
||||
-NotifyRestart
|
||||
|
||||
|
||||
Write-Log "Adding secondary domain controller ..."
|
||||
|
||||
$SMAP = ConvertTo-SecureString -String $SafeModePassword -AsPlainText -Force
|
||||
|
||||
Install-ADDSDomainController `
|
||||
-DomainName $DomainName `
|
||||
-SafeModeAdministratorPassword $SMAP `
|
||||
-Credential $Credential `
|
||||
-NoRebootOnCompletion `
|
||||
-Force `
|
||||
-ErrorAction Stop | Out-Null
|
||||
|
||||
Write-Log "Waiting for restart ..."
|
||||
# Stop-Execution -ExitCode 3010 -ExitString "Computer must be restarted to finish domain controller promotion."
|
||||
# Write-Log "Restarting computer ..."
|
||||
# Restart-Computer -Force
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
{
|
||||
"Scripts": [
|
||||
"RnVuY3Rpb24gSW5zdGFsbC1Sb2xlU2Vjb25kYXJ5RG9tYWluQ29udHJvbGxlcg0Kew0KPCMNCi5TWU5PUFNJUw0KSW5zdGFsbCBhZGRpdGlvbmFsIChzZWNvbmRhcnkpIGRvbWFpbiBjb250cm9sbGVyLg0KDQojPg0KCXBhcmFtDQoJKA0KCQlbU3RyaW5nXQ0KCQkjIERvbWFpbiBuYW1lIHRvIGpvaW4gdG8uDQoJCSREb21haW5OYW1lLA0KCQkNCgkJW1N0cmluZ10NCgkJIyBEb21haW4gdXNlciB3aG8gaXMgYWxsb3dlZCB0byBqb2luIGNvbXB1dGVyIHRvIGRvbWFpbi4NCgkJJFVzZXJOYW1lLA0KCQkNCgkJW1N0cmluZ10NCgkJIyBVc2VyJ3MgcGFzc3dvcmQuDQoJCSRQYXNzd29yZCwNCgkJDQoJCVtTdHJpbmddDQoJCSMgRG9tYWluIGNvbnRyb2xsZXIgcmVjb3ZlcnkgbW9kZSBwYXNzd29yZC4NCgkJJFNhZmVNb2RlUGFzc3dvcmQNCgkpDQoNCgl0cmFwIHsgU3RvcC1FeGVjdXRpb24gJF8gfQ0KCQ0KCSRDcmVkZW50aWFsID0gTmV3LUNyZWRlbnRpYWwgLVVzZXJOYW1lICIkRG9tYWluTmFtZVwkVXNlck5hbWUiIC1QYXNzd29yZCAkUGFzc3dvcmQNCgkJDQoJIyBBZGQgcmVxdWlyZWQgd2luZG93cyBmZWF0dXJlcw0KCUFkZC1XaW5kb3dzRmVhdHVyZVdyYXBwZXIgYA0KCQktTmFtZSAiRE5TIiwiQUQtRG9tYWluLVNlcnZpY2VzIiwiUlNBVC1ERlMtTWdtdC1Db24iIGANCgkJLUluY2x1ZGVNYW5hZ2VtZW50VG9vbHMgYA0KICAgICAgICAgICAgICAgIC1Ob3RpZnlSZXN0YXJ0DQoJCQ0KCQ0KICAgICAgICBXcml0ZS1Mb2cgIkFkZGluZyBzZWNvbmRhcnkgZG9tYWluIGNvbnRyb2xsZXIgLi4uIg0KICAgIA0KCSRTTUFQID0gQ29udmVydFRvLVNlY3VyZVN0cmluZyAtU3RyaW5nICRTYWZlTW9kZVBhc3N3b3JkIC1Bc1BsYWluVGV4dCAtRm9yY2UNCg0KCUluc3RhbGwtQUREU0RvbWFpbkNvbnRyb2xsZXIgYA0KCQktRG9tYWluTmFtZSAkRG9tYWluTmFtZSBgDQoJCS1TYWZlTW9kZUFkbWluaXN0cmF0b3JQYXNzd29yZCAkU01BUCBgDQoJCS1DcmVkZW50aWFsICRDcmVkZW50aWFsIGANCgkJLU5vUmVib290T25Db21wbGV0aW9uIGANCgkJLUZvcmNlIGANCgkJLUVycm9yQWN0aW9uIFN0b3AgfCBPdXQtTnVsbA0KDQoJV3JpdGUtTG9nICJXYWl0aW5nIGZvciByZXN0YXJ0IC4uLiINCiMJU3RvcC1FeGVjdXRpb24gLUV4aXRDb2RlIDMwMTAgLUV4aXRTdHJpbmcgIkNvbXB1dGVyIG11c3QgYmUgcmVzdGFydGVkIHRvIGZpbmlzaCBkb21haW4gY29udHJvbGxlciBwcm9tb3Rpb24uIg0KIwlXcml0ZS1Mb2cgIlJlc3RhcnRpbmcgY29tcHV0ZXIgLi4uIg0KIwlSZXN0YXJ0LUNvbXB1dGVyIC1Gb3JjZQ0KfQ0K"
|
||||
],
|
||||
"Commands": [
|
||||
{
|
||||
"Name": "Import-Module",
|
||||
"Arguments": {
|
||||
"Name": "CoreFunctions"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Set-NetworkAdapterConfiguration",
|
||||
"Arguments": {
|
||||
"FirstAvailable": true,
|
||||
"DNSServer": "10.0.102.2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Join-Domain",
|
||||
"Arguments": {
|
||||
"DomainName": "acme.local",
|
||||
"Username": "Administrator",
|
||||
"Password": "P@ssw0rd123",
|
||||
"AllowRestart": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Install-RoleSecondaryDomainController",
|
||||
"Arguments": {
|
||||
"DomainName": "acme.local",
|
||||
"UserName": "Administrator",
|
||||
"Password": "P@ssw0rd123",
|
||||
"SafeModePassword": "P@ssw0rd"
|
||||
}
|
||||
}
|
||||
],
|
||||
"RebootOnCompletion": 1
|
||||
}
|
|
@ -1,119 +0,0 @@
|
|||
|
||||
function Register-WebApp {
|
||||
<#
|
||||
.LINKS
|
||||
|
||||
http://www.iis.net/learn/manage/powershell/powershell-snap-in-creating-web-sites-web-applications-virtual-directories-and-application-pools
|
||||
#>
|
||||
param (
|
||||
[String] $Source,
|
||||
[String] $Path = "C:\inetpub\wwwroot",
|
||||
[String] $Name = "",
|
||||
[String] $Username = "",
|
||||
[String] $Password = ""
|
||||
)
|
||||
|
||||
Import-Module WebAdministration
|
||||
|
||||
if ($Name -eq "") {
|
||||
$Name = @([IO.Path]::GetDirectoryName($Source) -split '\\')[-1]
|
||||
if ($Name -eq "wwwroot") {
|
||||
throw("Application pool name couldn't be 'wwwroot'.")
|
||||
}
|
||||
}
|
||||
else {
|
||||
$Path = [IO.Path]::Combine($Path, $Name)
|
||||
}
|
||||
|
||||
Copy-Item -Path $Source -Destination $Path -Recurse -Force
|
||||
|
||||
|
||||
# Create new application pool
|
||||
$AppPool = New-WebAppPool -Name $Name -Force
|
||||
#$AppPool = Get-Item "IIS:\AppPools\$Name"
|
||||
$AppPool.managedRuntimeVersion = 'v4.0'
|
||||
$AppPool.managedPipelineMode = 'Classic'
|
||||
$AppPool.processModel.loadUserProfile = $true
|
||||
$AppPool.processModel.logonType = 'LogonBatch'
|
||||
|
||||
#Set Identity type
|
||||
if ($Username -eq "") {
|
||||
$AppPool.processModel.identityType = 'ApplicationPoolIdentity'
|
||||
}
|
||||
else {
|
||||
$AppPool.processModel.identityType = 'SpecificUser'
|
||||
$AppPool.processModel.userName = $Username
|
||||
$AppPool.processModel.password = $Password
|
||||
$AppPool | Set-Item
|
||||
}
|
||||
|
||||
|
||||
# Create Website
|
||||
$WebSite = New-WebSite -Name $Name -Port 80 -HostHeader $Name -PhysicalPath $Path -Force
|
||||
#$WebSite = Get-Item "IIS:\Sites\$Name"
|
||||
|
||||
# Set the Application Pool
|
||||
Set-ItemProperty "IIS:\Sites\$Name" 'ApplicationPool' $Name
|
||||
|
||||
#Turn on Directory Browsing
|
||||
#Set-WebConfigurationProperty -Filter '/system.webServer/directoryBrowse' -Name 'enabled' -Value $true -PSPath "IIS:\Sites\$Name"
|
||||
|
||||
# Update Authentication
|
||||
#Set-WebConfigurationProperty -Filter '/system.WebServer/security/authentication/AnonymousAuthentication' -Name 'enabled' -Value $true -Location $name
|
||||
#Set-WebConfigurationProperty -Filter '/system.WebServer/security/authentication/windowsAuthentication' -Name 'enabled' -Value $false -Location $Name
|
||||
#Set-WebConfigurationProperty -Filter '/system.WebServer/security/authentication/basicAuthentication' -Name 'enabled' -Value $false -Location $Name
|
||||
|
||||
$WebSite.Start()
|
||||
|
||||
Add-Content -Path "C:\Windows\System32\Drivers\etc\hosts" -Value "127.0.0.1 $Name"
|
||||
}
|
||||
|
||||
|
||||
function Deploy-WebAppFromGit {
|
||||
param (
|
||||
[String] $URL,
|
||||
[String] $TempPath = [IO.Path]::Combine([IO.Path]::GetTempPath(), [IO.Path]::GetRandomFileName()),
|
||||
[String] $OutputPath = [IO.Path]::Combine([IO.Path]::GetTempPath(), [IO.Path]::GetRandomFileName())
|
||||
)
|
||||
Write-Log "TempPath = '$TempPath'"
|
||||
Write-Log "OutputPath = '$OutputPath'"
|
||||
|
||||
|
||||
# Fetch web application
|
||||
#----------------------
|
||||
Write-Log "Fetching sources from Git ..."
|
||||
|
||||
$null = New-Item -Path $TempPath -ItemType Container
|
||||
Exec -FilePath 'git.exe' -ArgumentList @('clone', $URL) -WorkingDir $TempPath -RedirectStreams
|
||||
|
||||
$Path = @(Get-ChildItem $TempPath)[0].FullName
|
||||
#----------------------
|
||||
|
||||
|
||||
# Build web application
|
||||
#----------------------
|
||||
Write-Log "Building sources ..."
|
||||
|
||||
$msbuild = "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe"
|
||||
|
||||
$null = New-Item -Path $OutputPath -ItemType Container
|
||||
|
||||
$SlnFiles = @(Get-ChildItem -Path $Path -Filter *.sln -Recurse)
|
||||
|
||||
# Start new processs with additional env variables:
|
||||
#* VisualStudioVersion = "10.0"
|
||||
#* EnableNuGetPackageRestore = "true"
|
||||
Exec -FilePath $msbuild `
|
||||
-ArgumentList @($SlnFiles[0].FullName, "/p:OutputPath=$OutputPath") `
|
||||
-Environment @{'VisualStudioVersion' = '10.0'; 'EnableNuGetPackageRestore' = 'true'} `
|
||||
-RedirectStreams
|
||||
|
||||
$AppFolder = @(Get-ChildItem ([IO.Path]::Combine($OutputPath, '_PublishedWebsites')))[0]
|
||||
#----------------------
|
||||
|
||||
|
||||
# Install web application
|
||||
#------------------------
|
||||
Register-WebApp -Source $AppFolder.FullName -Name $AppFolder.Name
|
||||
#------------------------
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
include Deploy-WebApp.ps1
|
||||
|
||||
call Import-Module Name="CoreFunctions"
|
||||
call Deploy-WebAppFromGit URL="git://github.com/Mirantis/murano-mvc-demo.git"
|
||||
|
||||
reboot 0
|
||||
|
||||
out out.json
|
|
@ -1,13 +0,0 @@
|
|||
Scripts:
|
||||
- Deploy-WebApp.ps1
|
||||
|
||||
Commands:
|
||||
- Name: Import-Module
|
||||
Arguments:
|
||||
Name: "CoreFunctions"
|
||||
|
||||
- Name: Deploy-WebAppFromGit
|
||||
Arguments:
|
||||
URL: "git://github.com/Mirantis/murano-mvc-demo.git"
|
||||
|
||||
RebootOnCompletion: 0
|
|
@ -1 +0,0 @@
|
|||
..\ExecutionPlanGenerator.exe ExecutionPlan.txt
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
for yaml_file in *.yaml ; do
|
||||
[[ -e $yaml_file ]] || break # handle the case of no *.yaml files
|
||||
echo "Converting $yaml_file ..."
|
||||
../ExecutionPlanGenerator.py $yaml_file
|
||||
done
|
||||
|
||||
|
Binary file not shown.
|
@ -1,53 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import argparse
|
||||
import base64
|
||||
import yaml
|
||||
import simplejson as json
|
||||
|
||||
allowedKeys = ('Scripts', 'Commands', 'RebootOnCompletion')
|
||||
requiredKeys = ('Scripts', 'Commands')
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser(description='YAML to JSON converter.')
|
||||
parser.add_argument('filePath', nargs='?', default='ExecutionPlan.yaml')
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
inputFile = open(args.filePath)
|
||||
yamlData = yaml.safe_load(inputFile)
|
||||
inputFile.close()
|
||||
|
||||
|
||||
providedKeys = yamlData.keys()
|
||||
|
||||
for k in providedKeys:
|
||||
if k not in allowedKeys:
|
||||
raise Exception("Key '{0}'' is not allowed!".format(k))
|
||||
|
||||
for k in requiredKeys:
|
||||
if k not in providedKeys:
|
||||
raise Exception("Key '{0}'' is required but not found!".format(k))
|
||||
|
||||
|
||||
for i in range(0, len(yamlData['Scripts'])):
|
||||
f = open(yamlData['Scripts'][i], 'rb')
|
||||
yamlData['Scripts'][i] = base64.b64encode(f.read())
|
||||
f.close()
|
||||
|
||||
|
||||
outputFile = open(args.filePath + '.json', 'w+')
|
||||
|
||||
json.dump(yamlData, outputFile, indent=' ')
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
for yaml_file in *.yaml ; do
|
||||
[[ -e $yaml_file ]] || break # handle the case of no *.yaml files
|
||||
echo "Converting $yaml_file ..."
|
||||
../ExecutionPlanGenerator.py $yaml_file
|
||||
done
|
||||
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
#
|
||||
# ## Failover Cluster Input Data (from the UI)
|
||||
#
|
||||
# * Domain Membership
|
||||
# - [String] / [Select box] $DomainName - Domain name
|
||||
# * Domain User Credentials
|
||||
# - [String] $UserName - Name of the user who is member of Domain Admins group
|
||||
# - [Password string] $UserPassword - User password
|
||||
# * Shared Folder Information
|
||||
# - [String] $ShareServer - Server which will host the shared folder for FC
|
||||
# - [String] $ShareName - 'External' name for the share
|
||||
# - [String] $SharePath - Shared folder internal path
|
||||
# * Failover Cluster Members
|
||||
# - [String] $ClusterName - Cluster name
|
||||
# - [String] $ClusterIP - Static IP address that will be assigned to the cluster
|
||||
# - [String[]] $ClusterNodes - List of node names
|
||||
#
|
||||
#
|
||||
#
|
||||
# ## Failover Cluster creation workflow
|
||||
#
|
||||
# * Create AD domain
|
||||
# * Join all the VMs to that domain
|
||||
# * Prepare nodes (execute on all nodes)
|
||||
# - Install Failover Cluster prerequisites on all FC nodes
|
||||
# * Create failover cluster (execute on any node)
|
||||
# - Create new cluster
|
||||
# - Add members
|
||||
# * Confugure FC quorum (execute on the same node)
|
||||
# - Create new folder that will be shared
|
||||
# - Share that folder with appropriate permissions
|
||||
# - Configure quorum mode
|
||||
#
|
||||
|
||||
Scripts:
|
||||
- ../../WindowsPowerShell/Functions/ImportCoreFunctions.ps1
|
||||
- ../../WindowsPowerShell/Functions/Start-PowerShellProcess.ps1
|
||||
- ../../WindowsPowerShell/Functions/Failover-Cluster.ps1
|
||||
|
||||
Commands:
|
||||
- Name: New-FailoverCluster
|
||||
Arguments:
|
||||
# [String] $ClusterName - Cluster name
|
||||
ClusterName: $clusterName
|
||||
# [String] $ClusterIP - Static IP address that will be assigned to the cluster
|
||||
StaticAddress: $clusterIP
|
||||
# [String[]] $ClusterNodes - List of cluster nodes
|
||||
ClusterNodes: $clusterNodes
|
||||
# [String] $domainAdminAccountName - Name of the user who is member of Domain Admins group
|
||||
UserName: $domainAdminAccountName
|
||||
# [Password string] $domainAdminAccountPassword - Password for that user
|
||||
UserPassword: $domainAdminAccountPassword
|
||||
|
||||
RebootOnCompletion: 0
|
File diff suppressed because one or more lines are too long
|
@ -1,9 +0,0 @@
|
|||
Scripts:
|
||||
- ../../WindowsPowerShell/Functions/ImportCoreFunctions.ps1
|
||||
- ../../WindowsPowerShell/Functions/Failover-Cluster.ps1
|
||||
|
||||
Commands:
|
||||
- Name: Install-FailoverClusterPrerequisites
|
||||
Arguments: {}
|
||||
|
||||
RebootOnCompletion: 0
|
File diff suppressed because one or more lines are too long
|
@ -1,7 +0,0 @@
|
|||
include Get-DnsListeningIpAddress.ps1
|
||||
|
||||
call Get-DnsListeningIpAddress
|
||||
|
||||
reboot 0
|
||||
|
||||
out out.json
|
|
@ -1,8 +0,0 @@
|
|||
Scripts:
|
||||
- Get-DnsListeningIpAddress.ps1
|
||||
|
||||
Commands:
|
||||
- Name: Get-DnsListeningIpAddress
|
||||
Arguments: {}
|
||||
|
||||
RebootOnCompletion: 0
|
|
@ -1 +0,0 @@
|
|||
..\ExecutionPlanGenerator.exe ExecutionPlan.txt
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
for yaml_file in *.yaml ; do
|
||||
[[ -e $yaml_file ]] || break # handle the case of no *.yaml files
|
||||
echo "Converting $yaml_file ..."
|
||||
../ExecutionPlanGenerator.py $yaml_file
|
||||
done
|
||||
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
function Get-DnsListeningIpAddress {
|
||||
Import-Module DnsServer
|
||||
(Get-DNSServer -ComputerName localhost).ServerSetting.ListeningIpAddress |
|
||||
Where-Object { $_ -match "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" }
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"Scripts": [
|
||||
"ZnVuY3Rpb24gR2V0LURuc0xpc3RlbmluZ0lwQWRkcmVzcyB7DQogICAgSW1wb3J0LU1vZHVsZSBEbnNTZXJ2ZXINCiAgICAoR2V0LUROU1NlcnZlciAtQ29tcHV0ZXJOYW1lIGxvY2FsaG9zdCkuU2VydmVyU2V0dGluZy5MaXN0ZW5pbmdJcEFkZHJlc3MgfA0KICAgICAgICBXaGVyZS1PYmplY3QgeyAkXyAtbWF0Y2ggIlxkezEsM31cLlxkezEsM31cLlxkezEsM31cLlxkezEsM30iIH0NCn0NCg=="
|
||||
],
|
||||
"Commands": [
|
||||
{
|
||||
"Name": "Get-DnsListeningIpAddress",
|
||||
"Arguments": {}
|
||||
}
|
||||
],
|
||||
"RebootOnCompletion": 0
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
include Install-WebServer.ps1
|
||||
|
||||
call Import-Module Name="CoreFunctions"
|
||||
call Copy-Prerequisites Destination="C:\Prerequisites"
|
||||
call Install-WebServer PrerequisitesPath="C:\Prerequisites"
|
||||
|
||||
reboot 0
|
||||
|
||||
out out.json
|
|
@ -1,17 +0,0 @@
|
|||
Scripts:
|
||||
- Install-WebServer.ps1
|
||||
|
||||
Commands:
|
||||
- Name: Import-Module
|
||||
Arguments:
|
||||
Name: "CoreFunctions"
|
||||
|
||||
- Name: Copy-Prerequisites
|
||||
Arguments:
|
||||
Destination: "C:\Prerequisites"
|
||||
|
||||
- Name: Install-WebServer
|
||||
Arguments:
|
||||
PrerequisitesPath: "C:\Prerequisites"
|
||||
|
||||
RebootOnCompletion: 0
|
|
@ -1 +0,0 @@
|
|||
..\ExecutionPlanGenerator.exe ExecutionPlan.txt
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
for yaml_file in *.yaml ; do
|
||||
[[ -e $yaml_file ]] || break # handle the case of no *.yaml files
|
||||
echo "Converting $yaml_file ..."
|
||||
../ExecutionPlanGenerator.py $yaml_file
|
||||
done
|
||||
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
function Copy-Prerequisites {
|
||||
param (
|
||||
[String] $Path = '',
|
||||
[String] $Destination = ''
|
||||
)
|
||||
|
||||
Write-Log "--> Copy-Prerequisites"
|
||||
|
||||
if ($Destination -eq '') {
|
||||
throw("Copy-Prerequisites: Destination path not specified!")
|
||||
}
|
||||
|
||||
if ($Path -eq '') {
|
||||
$Path = [Environment]::GetEnvironmentVariable('MuranoFileShare')
|
||||
if ($Path -eq $null) {
|
||||
throw("Copy-Prerequisites: Unable to determine source path for prerequisites.")
|
||||
}
|
||||
}
|
||||
|
||||
Write-Log "Creating new PSDrive ..."
|
||||
New-PSDrive -Name 'P' -PSProvider 'FileSystem' -Root $Path | Out-Null
|
||||
Write-Log "Creating destination folder ..."
|
||||
New-Item -Path $Destination -ItemType Container -Force | Out-Null
|
||||
Write-Log "Copying items ..."
|
||||
Copy-Item -Path 'P:\Prerequisites\IIS' -Destination $Destination -Recurse -Force | Out-Null
|
||||
Write-Log "Removing PSDrive ..."
|
||||
Remove-PSDrive -Name 'P' -PSProvider 'FileSystem' -Force | Out-Null
|
||||
|
||||
Write-Log "<-- Copy-Prerequisites"
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Install-WebServer {
|
||||
param (
|
||||
[String] $PrerequisitesPath
|
||||
)
|
||||
|
||||
Write-Log "--> Install-WebServer"
|
||||
|
||||
$FeatureList = @(
|
||||
'Web-Server',
|
||||
'Web-Net-Ext45',
|
||||
'Web-ASP',
|
||||
'Web-Asp-Net45',
|
||||
'Web-ISAPI-Ext',
|
||||
'Web-ISAPI-Filter',
|
||||
'Web-Includes'
|
||||
)
|
||||
|
||||
$PrerequisitesList = @(
|
||||
'AspNetMvc4Setup.exe',
|
||||
'WebApplications.exe'
|
||||
)
|
||||
|
||||
$PrerequisitesPath = [IO.Path]::Combine($PrerequisitesPath, 'IIS')
|
||||
|
||||
Write-Log "Validating prerequisites based on the list ..."
|
||||
foreach ($FileName in $PrerequisitesList) {
|
||||
$FilePath = [IO.Path]::Combine($PrerequisitesPath, $FileName)
|
||||
if (-not (Test-Path -Path $FilePath -PathType Leaf)) {
|
||||
throw("Prerequisite file not found: '$FilePath'")
|
||||
}
|
||||
}
|
||||
|
||||
Import-Module ServerManager
|
||||
|
||||
Write-Log "Installing Web Server ..."
|
||||
Install-WindowsFeature $FeatureList -IncludeManagementTools
|
||||
|
||||
Write-Log "Installing AspNetMvp4 ..."
|
||||
$Exec = Exec -FilePath $([IO.Path]::Combine($PrerequisitesPath, 'AspNetMvc4Setup.exe')) -ArgumentList '/q' -PassThru
|
||||
if ($Exec.ExitCode -ne 0) {
|
||||
throw("Installation of 'AspNetMvc4Setup.exe' failed. Process exit code '$($Exec.ExitCode)'")
|
||||
}
|
||||
|
||||
# Extract WebApplications folder with *.target files to
|
||||
# C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0
|
||||
Write-Log "Installing WebApplication targets ..."
|
||||
$WebApplicationsTargetsRoot = 'C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0'
|
||||
$null = New-Item -Path $WebApplicationsTargetsRoot -ItemType Container
|
||||
$Exec = Exec -FilePath $([IO.Path]::Combine($PrerequisitesPath, 'WebApplications.exe')) -ArgumentList @("-o`"$WebApplicationsTargetsRoot`"", '-y') -PassThru
|
||||
if ($Exec.ExitCode -ne 0) {
|
||||
throw("Installation of 'WebApplications.exe' failed. Process exit code '$($Exec.ExitCode)'")
|
||||
}
|
||||
|
||||
Write-Log "<-- Install-WebServer"
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
{
|
||||
"Scripts": [
|
||||
"ZnVuY3Rpb24gQ29weS1QcmVyZXF1aXNpdGVzIHsNCglwYXJhbSAoDQoJCVtTdHJpbmddICRQYXRoID0gJycsDQoJCVtTdHJpbmddICREZXN0aW5hdGlvbiA9ICcnDQoJKQ0KDQoJV3JpdGUtTG9nICItLT4gQ29weS1QcmVyZXF1aXNpdGVzIg0KDQogICAgaWYgKCREZXN0aW5hdGlvbiAtZXEgJycpIHsNCiAgICAgICAgdGhyb3coIkNvcHktUHJlcmVxdWlzaXRlczogRGVzdGluYXRpb24gcGF0aCBub3Qgc3BlY2lmaWVkISIpDQogICAgfQ0KDQogICAgaWYgKCRQYXRoIC1lcSAnJykgew0KICAgICAgICAkUGF0aCA9IFtFbnZpcm9ubWVudF06OkdldEVudmlyb25tZW50VmFyaWFibGUoJ011cmFub0ZpbGVTaGFyZScpDQogICAgICAgIGlmICgkUGF0aCAtZXEgJG51bGwpIHsNCiAgICAgICAgICAgIHRocm93KCJDb3B5LVByZXJlcXVpc2l0ZXM6IFVuYWJsZSB0byBkZXRlcm1pbmUgc291cmNlIHBhdGggZm9yIHByZXJlcXVpc2l0ZXMuIikNCiAgICAgICAgfQ0KICAgIH0NCg0KCVdyaXRlLUxvZyAiQ3JlYXRpbmcgbmV3IFBTRHJpdmUgLi4uIg0KCU5ldy1QU0RyaXZlIC1OYW1lICdQJyAtUFNQcm92aWRlciAnRmlsZVN5c3RlbScgLVJvb3QgJFBhdGggfCBPdXQtTnVsbA0KCVdyaXRlLUxvZyAiQ3JlYXRpbmcgZGVzdGluYXRpb24gZm9sZGVyIC4uLiINCglOZXctSXRlbSAtUGF0aCAkRGVzdGluYXRpb24gLUl0ZW1UeXBlIENvbnRhaW5lciAtRm9yY2UgfCBPdXQtTnVsbA0KCVdyaXRlLUxvZyAiQ29weWluZyBpdGVtcyAuLi4iDQoJQ29weS1JdGVtIC1QYXRoICdQOlxQcmVyZXF1aXNpdGVzXElJUycgLURlc3RpbmF0aW9uICREZXN0aW5hdGlvbiAtUmVjdXJzZSAtRm9yY2UgfCBPdXQtTnVsbA0KCVdyaXRlLUxvZyAiUmVtb3ZpbmcgUFNEcml2ZSAuLi4iDQoJUmVtb3ZlLVBTRHJpdmUgLU5hbWUgJ1AnIC1QU1Byb3ZpZGVyICdGaWxlU3lzdGVtJyAtRm9yY2UgfCBPdXQtTnVsbA0KCQ0KCVdyaXRlLUxvZyAiPC0tIENvcHktUHJlcmVxdWlzaXRlcyINCn0NCg0KDQoNCmZ1bmN0aW9uIEluc3RhbGwtV2ViU2VydmVyIHsNCglwYXJhbSAoDQoJCVtTdHJpbmddICRQcmVyZXF1aXNpdGVzUGF0aA0KCSkNCgkNCglXcml0ZS1Mb2cgIi0tPiBJbnN0YWxsLVdlYlNlcnZlciINCg0KCSRGZWF0dXJlTGlzdCA9IEAoDQoJCSdXZWItU2VydmVyJywNCgkJJ1dlYi1OZXQtRXh0NDUnLA0KCQknV2ViLUFTUCcsDQoJCSdXZWItQXNwLU5ldDQ1JywNCgkJJ1dlYi1JU0FQSS1FeHQnLA0KCQknV2ViLUlTQVBJLUZpbHRlcicsDQoJCSdXZWItSW5jbHVkZXMnDQoJKQ0KCQ0KCSRQcmVyZXF1aXNpdGVzTGlzdCA9IEAoDQoJCSdBc3BOZXRNdmM0U2V0dXAuZXhlJywNCgkJJ1dlYkFwcGxpY2F0aW9ucy5leGUnDQoJKQ0KICAgIA0KCSRQcmVyZXF1aXNpdGVzUGF0aCA9IFtJTy5QYXRoXTo6Q29tYmluZSgkUHJlcmVxdWlzaXRlc1BhdGgsICdJSVMnKQ0KICAgIA0KCVdyaXRlLUxvZyAiVmFsaWRhdGluZyBwcmVyZXF1aXNpdGVzIGJhc2VkIG9uIHRoZSBsaXN0IC4uLiINCglmb3JlYWNoICgkRmlsZU5hbWUgaW4gJFByZXJlcXVpc2l0ZXNMaXN0KSB7DQoJCSRGaWxlUGF0aCA9IFtJTy5QYXRoXTo6Q29tYmluZSgkUHJlcmVxdWlzaXRlc1BhdGgsICRGaWxlTmFtZSkNCgkJaWYgKC1ub3QgKFRlc3QtUGF0aCAtUGF0aCAkRmlsZVBhdGggLVBhdGhUeXBlIExlYWYpKSB7DQoJCQl0aHJvdygiUHJlcmVxdWlzaXRlIGZpbGUgbm90IGZvdW5kOiAnJEZpbGVQYXRoJyIpDQoJCX0NCgl9DQoJDQoJSW1wb3J0LU1vZHVsZSBTZXJ2ZXJNYW5hZ2VyDQoJDQoJV3JpdGUtTG9nICJJbnN0YWxsaW5nIFdlYiBTZXJ2ZXIgLi4uIg0KCUluc3RhbGwtV2luZG93c0ZlYXR1cmUgJEZlYXR1cmVMaXN0IC1JbmNsdWRlTWFuYWdlbWVudFRvb2xzDQoJDQoJV3JpdGUtTG9nICJJbnN0YWxsaW5nIEFzcE5ldE12cDQgLi4uIg0KCSRFeGVjID0gRXhlYyAtRmlsZVBhdGggJChbSU8uUGF0aF06OkNvbWJpbmUoJFByZXJlcXVpc2l0ZXNQYXRoLCAnQXNwTmV0TXZjNFNldHVwLmV4ZScpKSAtQXJndW1lbnRMaXN0ICcvcScgLVBhc3NUaHJ1DQoJaWYgKCRFeGVjLkV4aXRDb2RlIC1uZSAwKSB7DQoJCXRocm93KCJJbnN0YWxsYXRpb24gb2YgJ0FzcE5ldE12YzRTZXR1cC5leGUnIGZhaWxlZC4gUHJvY2VzcyBleGl0IGNvZGUgJyQoJEV4ZWMuRXhpdENvZGUpJyIpDQoJfQ0KCQ0KCSMgRXh0cmFjdCBXZWJBcHBsaWNhdGlvbnMgZm9sZGVyIHdpdGggKi50YXJnZXQgZmlsZXMgdG8NCgkjICAgQzpcUHJvZ3JhbSBGaWxlcyAoeDg2KVxNU0J1aWxkXE1pY3Jvc29mdFxWaXN1YWxTdHVkaW9cdjEwLjANCglXcml0ZS1Mb2cgIkluc3RhbGxpbmcgV2ViQXBwbGljYXRpb24gdGFyZ2V0cyAuLi4iDQoJJFdlYkFwcGxpY2F0aW9uc1RhcmdldHNSb290ID0gJ0M6XFByb2dyYW0gRmlsZXMgKHg4NilcTVNCdWlsZFxNaWNyb3NvZnRcVmlzdWFsU3R1ZGlvXHYxMC4wJw0KCSRudWxsID0gTmV3LUl0ZW0gLVBhdGggJFdlYkFwcGxpY2F0aW9uc1RhcmdldHNSb290IC1JdGVtVHlwZSBDb250YWluZXINCgkkRXhlYyA9IEV4ZWMgLUZpbGVQYXRoICQoW0lPLlBhdGhdOjpDb21iaW5lKCRQcmVyZXF1aXNpdGVzUGF0aCwgJ1dlYkFwcGxpY2F0aW9ucy5leGUnKSkgLUFyZ3VtZW50TGlzdCBAKCItb2AiJFdlYkFwcGxpY2F0aW9uc1RhcmdldHNSb290YCIiLCAnLXknKSAtUGFzc1RocnUNCglpZiAoJEV4ZWMuRXhpdENvZGUgLW5lIDApIHsNCgkJdGhyb3coIkluc3RhbGxhdGlvbiBvZiAnV2ViQXBwbGljYXRpb25zLmV4ZScgZmFpbGVkLiBQcm9jZXNzIGV4aXQgY29kZSAnJCgkRXhlYy5FeGl0Q29kZSknIikNCgl9DQoNCglXcml0ZS1Mb2cgIjwtLSBJbnN0YWxsLVdlYlNlcnZlciINCn0NCg0K"
|
||||
],
|
||||
"Commands": [
|
||||
{
|
||||
"Name": "Import-Module",
|
||||
"Arguments": {
|
||||
"Name": "CoreFunctions"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Copy-Prerequisites",
|
||||
"Arguments": {
|
||||
"Destination": "C:\\Prerequisites"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Install-WebServer",
|
||||
"Arguments": {
|
||||
"PrerequisitesPath": "C:\\Prerequisites"
|
||||
}
|
||||
}
|
||||
],
|
||||
"RebootOnCompletion": 0
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
Scripts:
|
||||
- ../../WindowsPowerShell/Functions/ImportCoreFunctions.ps1
|
||||
- ../../WindowsPowerShell/Functions/OptionParser.ps1
|
||||
- ../../WindowsPowerShell/Functions/SQLServerOptionParsers.ps1
|
||||
- ../../WindowsPowerShell/Functions/SQLServerInstaller.ps1
|
||||
- ../../WindowsPowerShell/Functions/Install-SQLServer.ps1
|
||||
|
||||
Commands:
|
||||
- Name: Install-SQLServer
|
||||
Arguments:
|
||||
MixedModeAuth: false
|
||||
SAPassword: ""
|
||||
|
||||
RebootOnCompletion: 0
|
File diff suppressed because one or more lines are too long
|
@ -1,9 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
for yaml_file in *.yaml ; do
|
||||
[[ -e $yaml_file ]] || break # handle the case of no *.yaml files
|
||||
echo "Converting $yaml_file ..."
|
||||
../ExecutionPlanGenerator.py $yaml_file
|
||||
done
|
||||
|
||||
|
Binary file not shown.
|
@ -1,24 +0,0 @@
|
|||
Execution Plan
|
||||
==============
|
||||
|
||||
Execution Plan is a sequence of actions that should be run on an instance in order to configure it.
|
||||
|
||||
Execution Plan contains at least one step, and may reboot the instance.
|
||||
|
||||
An Exectution Plan definition file may contain following sections:
|
||||
* PowerShell functions that are passed to the instance as part of Execution Plan
|
||||
* At least one execution step
|
||||
* Conditional reboot statement
|
||||
|
||||
In order to simplify the process of Execution Plan creation, a simple SDL was introduced.
|
||||
|
||||
SDL's statements:
|
||||
* include <file with PowerShell functions>
|
||||
* call <PowerShell function name> [<argument name>=<argument value> [...]]
|
||||
* reboot <condition>
|
||||
* out <output file name>
|
||||
|
||||
SEE ALSO
|
||||
========
|
||||
* `Murano <http://murano.mirantis.com>`__
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
# Inputs:
|
||||
#
|
||||
# Workflow:
|
||||
# - Create new domain controller
|
||||
# - Create new Failover Cluster using N nodes
|
||||
# - Run current execution plan once on any domain controller node
|
||||
#
|
||||
# Notes:
|
||||
# - This script runs on one node only (Availability Group Primary node)
|
||||
|
||||
Scripts:
|
||||
- ../../WindowsPowerShell/Functions/ImportCoreFunctions.ps1
|
||||
- ../../WindowsPowerShell/Functions/SQLServerForAOAG.ps1
|
||||
- ../../WindowsPowerShell/Functions/New-SqlServerSystemAccount.ps1
|
||||
|
||||
Commands:
|
||||
# - Name: Install-SqlServerPowerShellModule
|
||||
# Arguments: {}
|
||||
|
||||
# - Name: Disable-Firewall
|
||||
# Arguments: {}
|
||||
|
||||
- Name: Enable-TrustedHosts
|
||||
Arguments: {}
|
||||
|
||||
# - Name: New-SqlServerSystemAccount
|
||||
# Arguments:
|
||||
# # [String] (REQUIRED) Domain Name
|
||||
# DomainName: $domainName
|
||||
# # [String] (REQUIRED) User name who has permissions to create and modify userPassword
|
||||
# # Usually this is the domain administrator '$domainName\Administrator' account
|
||||
# UserName: $domainAdminAccountName
|
||||
# # [String] (REQUIRED) Password for that user
|
||||
# UserPassword: $domainAdminAccountPassword
|
||||
# # [String] (REQUIRED) User name for a new account that will be used to run SQL Server
|
||||
# SQLServiceUserName: $sqlServiceUserName
|
||||
# # [String] (REQUIRED) Password for that user
|
||||
# SQLServiceUserPassword: $sqlServiceUserPassword
|
||||
# # Name of the AOAG primary node
|
||||
# PrimaryNode: $primaryNode
|
||||
|
||||
- Name: New-SharedFolderForAOAG
|
||||
Arguments:
|
||||
# Name of the AOAG primary node
|
||||
PrimaryNode: $primaryNode
|
File diff suppressed because one or more lines are too long
|
@ -1,51 +0,0 @@
|
|||
# Workflow:
|
||||
# - Create AD domain
|
||||
# - Join all the VMs to that domain
|
||||
# - Prepare nodes (execute on all nodes)
|
||||
# - Install Failover Cluster prerequisites on all FC nodes
|
||||
# - Create failover cluster and cluster quorum. Execute on any node.
|
||||
# - Create new cluster
|
||||
# - Add members
|
||||
# - Create new folder that will be shared
|
||||
# - Share that folder with appropriate permissions
|
||||
# - Configure quorum mode
|
||||
#
|
||||
# Notes:
|
||||
# - This script runs on one node only (Failover Cluster "master" node)
|
||||
|
||||
Scripts:
|
||||
- ../../WindowsPowerShell/Functions/ImportCoreFunctions.ps1
|
||||
- ../../WindowsPowerShell/Functions/New-SqlServerSystemAccount.ps1
|
||||
- ../../WindowsPowerShell/Functions/Start-PowerShellProcess.ps1
|
||||
- ../../WindowsPowerShell/Functions/Failover-Cluster.ps1
|
||||
|
||||
Commands:
|
||||
- Name: New-FailoverCluster
|
||||
Arguments:
|
||||
# [String] $ClusterName - Cluster name
|
||||
ClusterName: $clusterName
|
||||
# [String] $ClusterIP - Static IP address that will be assigned to the cluster
|
||||
StaticAddress: $clusterIP
|
||||
# [String[]] $ClusterNodes - List of cluster nodes
|
||||
ClusterNodes: $clusterNodes
|
||||
# Domain name
|
||||
DomainName: $domainName
|
||||
# [String] $domainAdminAccountName - Name of the user who is member of Domain Admins group
|
||||
UserName: $domainAdminAccountName
|
||||
# [Password string] $domainAdminAccountPassword - Password for that user
|
||||
UserPassword: $domainAdminAccountPassword
|
||||
|
||||
- Name: New-FailoverClusterSharedFolder
|
||||
Arguments:
|
||||
# Share server name - for example, one of domain controllers
|
||||
ShareServer: $shareServer
|
||||
# [String] $ClusterName - Cluster name
|
||||
ClusterName: $clusterName
|
||||
# Domain name
|
||||
DomainName: $domainName
|
||||
# [String] $domainAdminAccountName - Name of the user who is member of Domain Admins group
|
||||
UserName: $domainAdminAccountName
|
||||
# [Password string] $domainAdminAccountPassword - Password for that user
|
||||
UserPassword: $domainAdminAccountPassword
|
||||
|
||||
RebootOnCompletion: 0
|
File diff suppressed because one or more lines are too long
|
@ -1,21 +0,0 @@
|
|||
Scripts:
|
||||
- ../../WindowsPowerShell/Functions/ImportCoreFunctions.ps1
|
||||
- ../../WindowsPowerShell/Functions/Update-ServiceConfig.ps1
|
||||
- ../../WindowsPowerShell/Functions/SQLServerForAOAG.ps1
|
||||
- ../../WindowsPowerShell/Functions/Failover-Cluster.ps1
|
||||
|
||||
Commands:
|
||||
- Name: Install-FailoverClusterPrerequisites
|
||||
Arguments: {}
|
||||
|
||||
- Name: Enable-TrustedHosts
|
||||
Arguments: {}
|
||||
|
||||
- Name: Update-ServiceConfig
|
||||
Arguments:
|
||||
Name: Murano Agent
|
||||
RunAsUser: $domainAdminAccountName
|
||||
DomainName: $domainName
|
||||
Password: $domainAdminAccountPassword
|
||||
|
||||
RebootOnCompletion: 1
|
File diff suppressed because one or more lines are too long
|
@ -1,9 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
for yaml_file in *.yaml ; do
|
||||
[[ -e $yaml_file ]] || break # handle the case of no *.yaml files
|
||||
echo "Converting $yaml_file ..."
|
||||
../ExecutionPlanGenerator.py $yaml_file
|
||||
done
|
||||
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
# Inputs:
|
||||
#
|
||||
# Workflow:
|
||||
# - Create new domain controller
|
||||
# - Create new Failover Cluster using N nodes
|
||||
# - Create service account for SQL Server using 'ConfigureEnvironmentForAOAG' execution plan
|
||||
# - On each node of Failover Cluster install SQL server using 'InstallSqlServerForAOAG' execution plan
|
||||
# - Execute current execution plan BEFORE 'InitializeAOAGSecondaryReplica' on ALL nodes of SQL Failover Cluster
|
||||
|
||||
Scripts:
|
||||
- ../../WindowsPowerShell/Functions/ImportCoreFunctions.ps1
|
||||
- ../../WindowsPowerShell/Functions/OptionParser.ps1
|
||||
- ../../WindowsPowerShell/Functions/SQLServerOptionParsers.ps1
|
||||
- ../../WindowsPowerShell/Functions/SQLServerInstaller.ps1
|
||||
- ../../WindowsPowerShell/Functions/SQLServerForAOAG.ps1
|
||||
- ../../WindowsPowerShell/Functions/Export-Function.ps1
|
||||
- ../../WindowsPowerShell/Functions/Start-PowerShellProcess.ps1
|
||||
|
||||
Commands:
|
||||
- Name: Initialize-AOAGPrimaryReplica
|
||||
Arguments:
|
||||
# [String] Availability Group Name
|
||||
GroupName: $groupName
|
||||
# [String[]] (REQUIRED) Nodes that will be configured as replica partners.
|
||||
NodeList: $nodeList
|
||||
# [String] (REQUIRED) Node name that will be primary for selected Availability Group
|
||||
PrimaryNode: $primaryNode
|
||||
# [String[]] (REQUIRED) Database list that will be added to the Availability Group
|
||||
DatabaseList: $databaseList
|
||||
# [String] (REQUIRED) Listener name that will be used by clients to connect to databases in that AG
|
||||
ListenerName: $listenerName
|
||||
# [String] (REQUIRED) IP address of the listener
|
||||
ListenerIP: $listenerIP
|
||||
# [String[]] (REQUIRED) Node list which are in synchronous commit mode
|
||||
SyncModeNodeList: $syncModeNodeList
|
||||
# Domain name
|
||||
DomainName: $domainName
|
||||
# Domain admin account user name
|
||||
UserName: $domainAdminAccountName
|
||||
# Domain admin account password
|
||||
UserPassword: $domainAdminAccountPassword
|
||||
|
File diff suppressed because one or more lines are too long
|
@ -1,33 +0,0 @@
|
|||
# Inputs:
|
||||
#
|
||||
# Workflow:
|
||||
# - Create new domain controller
|
||||
# - Create new Failover Cluster using N nodes
|
||||
# - Create service account for SQL Server using 'ConfigureEnvironmentForAOAG' execution plan
|
||||
# - On each node of Failover Cluster install SQL server using 'InstallSqlServerForAOAG' execution plan
|
||||
# - Execute 'InitializeAOAGPrimaryReplica' execution plan BEFORE current execution plan on ALL nodes of SQL Failover Cluster
|
||||
# - Execute current execution plan AFTER 'InitializeAOAGPrimaryReplica' on ALL nodes of SQL Failover Cluster
|
||||
|
||||
Scripts:
|
||||
- ../../WindowsPowerShell/Functions/ImportCoreFunctions.ps1
|
||||
- ../../WindowsPowerShell/Functions/OptionParser.ps1
|
||||
- ../../WindowsPowerShell/Functions/SQLServerOptionParsers.ps1
|
||||
- ../../WindowsPowerShell/Functions/SQLServerInstaller.ps1
|
||||
- ../../WindowsPowerShell/Functions/SQLServerForAOAG.ps1
|
||||
- ../../WindowsPowerShell/Functions/Export-Function.ps1
|
||||
- ../../WindowsPowerShell/Functions/Start-PowerShellProcess.ps1
|
||||
|
||||
Commands:
|
||||
- Name: Initialize-AOAGSecondaryReplica
|
||||
Arguments:
|
||||
# [String[]] (REQUIRED) Nodes that will be configured as replica partners.
|
||||
NodeList: $nodeList
|
||||
# [String] (REQUIRED) Node name that will be primary for selected Availability Group
|
||||
PrimaryNode: $primaryNode
|
||||
# Current domain name
|
||||
DomainName: $domainName
|
||||
# Domain Admin user name
|
||||
UserName: $domainAdminAccountName
|
||||
# Password for that user
|
||||
UserPassword: $domainAdminAccountPassword
|
||||
|
File diff suppressed because one or more lines are too long
|
@ -1,22 +0,0 @@
|
|||
Scripts:
|
||||
- ../../WindowsPowerShell/Functions/ImportCoreFunctions.ps1
|
||||
- ../../WindowsPowerShell/Functions/OptionParser.ps1
|
||||
- ../../WindowsPowerShell/Functions/SQLServerOptionParsers.ps1
|
||||
- ../../WindowsPowerShell/Functions/SQLServerInstaller.ps1
|
||||
- ../../WindowsPowerShell/Functions/Export-Function.ps1
|
||||
- ../../WindowsPowerShell/Functions/Start-PowerShellProcess.ps1
|
||||
- ../../WindowsPowerShell/Functions/SQLServerForAOAG.ps1
|
||||
|
||||
Commands:
|
||||
- Name: Initialize-AlwaysOnAvailabilityGroup
|
||||
Arguments:
|
||||
# Domain name
|
||||
DomainName: $domainName
|
||||
# Domain Admin account user name
|
||||
DomainAdminAccountName: $domainAdminAccountName
|
||||
# Domain Admin account password
|
||||
DomainAdminAccountPassword: $domainAdminAccountPassword
|
||||
# AOAG primary node
|
||||
PrimaryNode: $primaryNode
|
||||
# List of AOAG nodes
|
||||
NodeList: $nodeList
|
File diff suppressed because one or more lines are too long
|
@ -1,30 +0,0 @@
|
|||
# Inputs:
|
||||
#
|
||||
# Workflow:
|
||||
# - Create new domain controller
|
||||
# - Create new Failover Cluster using N nodes
|
||||
# - Create service account for SQL Server using 'ConfigureEnvironmentForAOAG' execution plan
|
||||
# - On each node of Failover Cluster install SQL server using this execution plan
|
||||
|
||||
Scripts:
|
||||
- ../../WindowsPowerShell/Functions/ImportCoreFunctions.ps1
|
||||
- ../../WindowsPowerShell/Functions/OptionParser.ps1
|
||||
- ../../WindowsPowerShell/Functions/SQLServerOptionParsers.ps1
|
||||
- ../../WindowsPowerShell/Functions/SQLServerInstaller.ps1
|
||||
- ../../WindowsPowerShell/Functions/SQLServerForAOAG.ps1
|
||||
|
||||
Commands:
|
||||
- Name: Disable-Firewall
|
||||
Arguments: {}
|
||||
|
||||
- Name: Install-SQLServerForAOAG
|
||||
Arguments:
|
||||
# [String] (REQUIRED) Domain name
|
||||
SQLServiceUserDomain: $domainName
|
||||
# [String] (REQUIRED) User name for the account which will be used by SQL service
|
||||
SQLServiceUserName: $domainAdminAccountName
|
||||
# [String] (REQUIRED) Password for that user
|
||||
SQLServiceUserPassword: $domainAdminAccountPassword
|
||||
|
||||
- Name: Install-SqlServerPowerShellModule
|
||||
Arguments: {}
|
File diff suppressed because one or more lines are too long
|
@ -1,41 +0,0 @@
|
|||
# AlwaysOn Availability Group workflow
|
||||
|
||||
## Create Active Directory domain
|
||||
|
||||
## Install Failover Cluster prerequisites
|
||||
|
||||
Execute **FailoverClusterPrerequisites.yaml** execution plan on each node of the cluster.
|
||||
|
||||
## Install and configure Failover Cluster
|
||||
|
||||
Choose one node from Failover Cluster nodes. This will be "Failover Cluster Master" node.
|
||||
|
||||
Execute **FailoverCluster.yaml** execution plan on 'Failover Cluster Master' node.
|
||||
|
||||
## Configure environment for SQL Server installation
|
||||
|
||||
Choose one node from Failover Cluster. This will be "AG Primary" node. It might be the same node as "Faiover Cluster Master" node.
|
||||
|
||||
'primaryNode' parameter in execution plans refers to "AG Primary" node.
|
||||
|
||||
Execute **ConfigureEnvironmentForAOAG.yaml** on each node of the cluster.
|
||||
|
||||
## Install SQL Server
|
||||
|
||||
Execute **InstallSqlServerForAOAG.yaml** on each node of the cluster.
|
||||
|
||||
## Initialize AlwaysOn on SQL Server instancesces
|
||||
|
||||
Execute **InitializeAlwaysOn.yaml** on each node of the cluster.
|
||||
|
||||
## Initialize AOAG Primary replica
|
||||
|
||||
Execute **InitializeAOAGPrimaryReplica.yaml** on each node of the cluster.
|
||||
|
||||
The underlying scripts will check 'primaryNode' parameter and execute the script if it is equal to instance's name.
|
||||
|
||||
## Initialize AOAG Secondary replicas
|
||||
|
||||
Execute **InitializeAOAGSecondaryReplica.yaml** on each node of the cluster.
|
||||
|
||||
The underlying scripts will check 'primaryNode' parameter and execute the script if it is NOT equal to instance's name.
|
|
@ -1,11 +0,0 @@
|
|||
Unattended Installation Files
|
||||
=============================
|
||||
|
||||
Windows unattended installation files for GUI and Core modes.
|
||||
|
||||
These files should be passed to Sysprep.exe.
|
||||
|
||||
SEE ALSO
|
||||
========
|
||||
* `Murano <http://murano.mirantis.com>`__
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<unattend xmlns="urn:schemas-microsoft-com:unattend">
|
||||
<settings pass="specialize">
|
||||
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<TimeZone>Pacific Standard Time</TimeZone>
|
||||
</component>
|
||||
</settings>
|
||||
<settings pass="oobeSystem">
|
||||
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<AutoLogon>
|
||||
<Password>
|
||||
<Value>UABAAHMAcwB3ADAAcgBkAFAAYQBzAHMAdwBvAHIAZAA=</Value>
|
||||
<PlainText>false</PlainText>
|
||||
</Password>
|
||||
<Username>Administrator</Username>
|
||||
<LogonCount>1</LogonCount>
|
||||
<Enabled>false</Enabled>
|
||||
</AutoLogon>
|
||||
<UserAccounts>
|
||||
<AdministratorPassword>
|
||||
<Value>UABAAHMAcwB3ADAAcgBkAEEAZABtAGkAbgBpAHMAdAByAGEAdABvAHIAUABhAHMAcwB3AG8AcgBkAA==</Value>
|
||||
<PlainText>false</PlainText>
|
||||
</AdministratorPassword>
|
||||
</UserAccounts>
|
||||
<RegisteredOrganization>-</RegisteredOrganization>
|
||||
<RegisteredOwner>-</RegisteredOwner>
|
||||
<OOBE>
|
||||
<HideEULAPage>true</HideEULAPage>
|
||||
</OOBE>
|
||||
</component>
|
||||
<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<InputLocale>en-US</InputLocale>
|
||||
<SystemLocale>en-US</SystemLocale>
|
||||
<UILanguage>en-US</UILanguage>
|
||||
<UserLocale>en-US</UserLocale>
|
||||
</component>
|
||||
</settings>
|
||||
<settings pass="generalize">
|
||||
<component name="Microsoft-Windows-Security-SPP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<SkipRearm>1</SkipRearm>
|
||||
</component>
|
||||
</settings>
|
||||
<cpi:offlineImage cpi:source="wim:d:/aik/install.wim#Windows Server 2012 SERVERSTANDARDCORE" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
|
||||
</unattend>
|
|
@ -1,51 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<unattend xmlns="urn:schemas-microsoft-com:unattend">
|
||||
<settings pass="specialize">
|
||||
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<TimeZone>Pacific Stantard Time</TimeZone>
|
||||
</component>
|
||||
</settings>
|
||||
<settings pass="oobeSystem">
|
||||
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<AutoLogon>
|
||||
<Password>
|
||||
<Value>UABAAHMAcwB3ADAAcgBkAFAAYQBzAHMAdwBvAHIAZAA=</Value>
|
||||
<PlainText>false</PlainText>
|
||||
</Password>
|
||||
<LogonCount>1</LogonCount>
|
||||
<Username>Administrator</Username>
|
||||
<Enabled>true</Enabled>
|
||||
</AutoLogon>
|
||||
<UserAccounts>
|
||||
<AdministratorPassword>
|
||||
<Value>UABAAHMAcwB3ADAAcgBkAEEAZABtAGkAbgBpAHMAdAByAGEAdABvAHIAUABhAHMAcwB3AG8AcgBkAA==</Value>
|
||||
<PlainText>false</PlainText>
|
||||
</AdministratorPassword>
|
||||
</UserAccounts>
|
||||
<RegisteredOrganization>-</RegisteredOrganization>
|
||||
<RegisteredOwner>-</RegisteredOwner>
|
||||
<OOBE>
|
||||
<HideEULAPage>true</HideEULAPage>
|
||||
</OOBE>
|
||||
<FirstLogonCommands>
|
||||
<SynchronousCommand wcm:action="add">
|
||||
<RequiresUserInput>true</RequiresUserInput>
|
||||
<CommandLine>powershell.exe -File C:\Deploy\Scripts\FirstLogon.ps1</CommandLine>
|
||||
<Order>1</Order>
|
||||
</SynchronousCommand>
|
||||
</FirstLogonCommands>
|
||||
</component>
|
||||
<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<InputLocale>en-US</InputLocale>
|
||||
<SystemLocale>en-US</SystemLocale>
|
||||
<UILanguage>en-US</UILanguage>
|
||||
<UserLocale>en-US</UserLocale>
|
||||
</component>
|
||||
</settings>
|
||||
<settings pass="generalize">
|
||||
<component name="Microsoft-Windows-Security-SPP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<SkipRearm>1</SkipRearm>
|
||||
</component>
|
||||
</settings>
|
||||
<cpi:offlineImage cpi:source="wim:d:/aik/install.wim#Windows Server 2012 SERVERSTANDARD" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
|
||||
</unattend>
|
|
@ -1,28 +0,0 @@
|
|||
Murano Windows Agent README
|
||||
============================
|
||||
|
||||
Murano Windows Agent is a component that does all the work on a target node.
|
||||
Currently only Windows nodes are supported.
|
||||
|
||||
Agent embeddes PowerShell engine which is the only execution engine.
|
||||
|
||||
|
||||
Interaction with Conductor
|
||||
--------------------------
|
||||
|
||||
Interaction with Conductor (receiving execution plans and submitting results) is performed via RabbitMQ server.
|
||||
|
||||
Agent receives execution plan, caches it and executes. Reboots during execution are allowed.
|
||||
|
||||
When execution completes, all output from PowerShell engine is passed back via the RabbitMQ server to the Conductor.
|
||||
|
||||
|
||||
Agent Configuration
|
||||
-------------------
|
||||
|
||||
All necessary configuration is performed during instance creation process. No manual actions needed.
|
||||
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
* `Murano <http://murano.mirantis.com>`__
|
|
@ -1,61 +0,0 @@
|
|||
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
function Export-Function {
|
||||
param (
|
||||
[String[]] $Name,
|
||||
|
||||
[Parameter(ValueFromPipeline=$true)]
|
||||
[String] $Path = [IO.Path]::GetTempFileName(),
|
||||
|
||||
[Switch] $All
|
||||
)
|
||||
|
||||
if ([IO.Path]::GetExtension($Path) -ne 'ps1') {
|
||||
$null = Rename-Item -Path $Path -NewName "$Path.ps1" -Force
|
||||
$Path = "$Path.ps1"
|
||||
}
|
||||
|
||||
$SystemFunctions = @(
|
||||
'A:', 'B:', 'C:', 'D:', 'E:', 'F:', 'G:', 'H:', 'I:', 'J:',
|
||||
'K:', 'L:', 'M:', 'N:', 'O:', 'P:', 'Q:', 'R:', 'S:', 'T:',
|
||||
'U:', 'V:', 'W:', 'X:', 'Y:', 'Z:',
|
||||
'cd..', 'cd\', 'help', 'mkdir', 'more', 'oss', 'prompt',
|
||||
'Clear-Host', 'Get-Verb', 'Pause', 'TabExpansion2'
|
||||
)
|
||||
|
||||
if ($All) {
|
||||
Get-ChildItem Function: |
|
||||
Where-Object {$_.ModuleName -eq ''} |
|
||||
Where-Object {$SystemFunctions -notcontains $_.Name} |
|
||||
ForEach-Object {
|
||||
Add-Content -Path $Path -Value @"
|
||||
|
||||
|
||||
function $($_.Name) {
|
||||
$($_.ScriptBlock)
|
||||
}
|
||||
|
||||
"@
|
||||
}
|
||||
}
|
||||
else {
|
||||
foreach ($FunctionName in $Name) {
|
||||
$FunctionObject = Get-ChildItem "Function:\$FunctionName"
|
||||
if ($FunctionObject -ne $null) {
|
||||
Add-Content -Path $Path -Value @"
|
||||
|
||||
|
||||
function $FunctionName {
|
||||
$($FunctionObject.ScriptBlock)
|
||||
}
|
||||
|
||||
"@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $Path
|
||||
}
|
|
@ -1,223 +0,0 @@
|
|||
<#
|
||||
.DESCRIPTION
|
||||
|
||||
## Failover Cluster Input Data (from the UI)
|
||||
|
||||
* Domain Membership
|
||||
- [String] / [Select box] $DomainName - Domain name
|
||||
* Domain User Credentials
|
||||
- [String] $UserName - Username
|
||||
- [Password string] $UserPassword - User password
|
||||
* Shared Folder Information
|
||||
- [String] $ShareServer - Server which will host the folder
|
||||
- [String] $ShareName - Share name
|
||||
- [String] $SharePath - Shared folder internal path
|
||||
* Failover Cluster Members
|
||||
- [String] $ClusterName - Cluster name
|
||||
- [String] $ClusterIP - Static IP address that will be assigned to the cluster
|
||||
- [String[]] $ClusterNodes - List of node names
|
||||
|
||||
|
||||
|
||||
## Failover Cluster creation workflow
|
||||
|
||||
* Create AD domain
|
||||
* Join all the VMs to that domain
|
||||
* Prepare nodes
|
||||
- Install Failover Cluster prerequisites on all FC nodes
|
||||
* Create failover cluster
|
||||
- Create new cluster
|
||||
- Add members
|
||||
* Confugure FC quorum
|
||||
- Create new folder that will be shared
|
||||
- Share that folder with appropriate permissions
|
||||
- Configure quorum mode
|
||||
|
||||
|
||||
|
||||
## Helpful SmbShare* Functions
|
||||
|
||||
* New-SmbShare
|
||||
* Grant-SmbShareAccess
|
||||
|
||||
#>
|
||||
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Install-FailoverClusterPrerequisites {
|
||||
#Import-Module FailoverClusters
|
||||
|
||||
Add-WindowsFeature Failover-Clustering, RSAT-Clustering-PowerShell
|
||||
}
|
||||
|
||||
|
||||
|
||||
function New-FailoverClusterSharedFolder {
|
||||
param (
|
||||
[String] $ClusterName,
|
||||
[String] $DomainName,
|
||||
[String] $ShareServer,
|
||||
[String] $SharePath = $($Env:SystemDrive + '\FCShare'),
|
||||
[String] $ShareName = 'FCShare',
|
||||
[String] $UserName,
|
||||
[String] $UserPassword,
|
||||
$Credential = $null
|
||||
)
|
||||
begin {
|
||||
Show-InvocationInfo $MyInvocation
|
||||
}
|
||||
end {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
Write-Log "--> New-FailoverClusterSharedFolder"
|
||||
|
||||
Write-Log "Creating shared folder for Failover Cluster ..."
|
||||
|
||||
if ($Credential -eq $null) {
|
||||
$Credential = New-Credential -UserName "$DomainName\$UserName" -Password "$UserPassword"
|
||||
}
|
||||
|
||||
if ((Test-Connection -ComputerName $ShareServer -Count 1 -Quiet) -eq $false) {
|
||||
throw("Server '$ShareServer' is unreachable via ICMP.")
|
||||
}
|
||||
|
||||
$Session = New-PSSession -ComputerName $ShareServer -Credential $Credential
|
||||
|
||||
Write-Log "Creating folder on '$ShareServer' ..."
|
||||
Invoke-Command -Session $Session -ScriptBlock {
|
||||
param (
|
||||
[String] $SharePath,
|
||||
[String] $ShareName,
|
||||
[String] $ClusterAccount
|
||||
)
|
||||
|
||||
Remove-SmbShare -Name $ShareName -Force -ErrorAction 'SilentlyContinue'
|
||||
Remove-Item -Path $SharePath -Force -ErrorAction 'SilentlyContinue'
|
||||
|
||||
New-Item -Path $SharePath -ItemType Container -Force
|
||||
|
||||
New-SmbShare -Path $SharePath `
|
||||
-Name $ShareName `
|
||||
-FullAccess "$ClusterAccount", 'Everyone' `
|
||||
-Description "Shared folder for Failover Cluster."
|
||||
|
||||
} -ArgumentList $SharePath, $ShareName, "$DomainName\$ClusterName`$"
|
||||
|
||||
Write-Log "Confguring Failover Cluster to use shared folder as qourum resourse ..."
|
||||
|
||||
$null = Set-ClusterQuorum -NodeAndFileShareMajority "\\$ShareServer\$ShareName"
|
||||
|
||||
Write-Log "<-- New-FailoverClusterSharedFolder"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function New-FailoverCluster {
|
||||
param (
|
||||
[String] $ClusterName,
|
||||
[String] $StaticAddress,
|
||||
[String[]] $ClusterNodes,
|
||||
[String] $DomainName,
|
||||
[String] $UserName,
|
||||
[String] $UserPassword,
|
||||
$Credential
|
||||
)
|
||||
begin {
|
||||
Show-InvocationInfo $MyInvocation
|
||||
}
|
||||
end {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
Write-Log "ClusterNodes: $($ClusterNodes -join ', ')"
|
||||
|
||||
if ($Credential -eq $null) {
|
||||
$Credential = New-Credential -UserName "$DomainName\$UserName" -Password "$UserPassword"
|
||||
}
|
||||
|
||||
Import-Module FailoverClusters
|
||||
|
||||
if ((Get-Cluster $ClusterName -ErrorAction SilentlyContinue) -eq $null) {
|
||||
Write-Log "Creating new cluster '$ClusterName' ..."
|
||||
Start-PowerShellProcess -Command @"
|
||||
Import-Module FailoverClusters
|
||||
New-Cluster -Name '$ClusterName' -StaticAddress '$StaticAddress'
|
||||
"@ -Credential $Credential -NoBase64
|
||||
Start-Sleep -Seconds 15
|
||||
}
|
||||
else {
|
||||
Write-Log "Cluster '$ClusterName' already exists."
|
||||
}
|
||||
|
||||
foreach ($Node in $ClusterNodes) {
|
||||
Write-Log "Adding node '$Node' to the cluster '$ClusterName' ..."
|
||||
if ((Get-ClusterNode $Node -ErrorAction SilentlyContinue) -eq $null) {
|
||||
Write-Log "Adding node ..."
|
||||
Start-PowerShellProcess -Command @"
|
||||
Import-Module FailoverClusters
|
||||
Add-ClusterNode -Cluster '$ClusterName' -Name '$Node'
|
||||
"@ -Credential $Credential -NoBase64
|
||||
}
|
||||
else {
|
||||
Write-Log "Node '$Node' already a part of the cluster '$ClusterName'."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
<#
|
||||
|
||||
# Example
|
||||
|
||||
$DomainName = 'fc-acme.local'
|
||||
$DomainUser = 'Administrator'
|
||||
$DomainPassword = 'P@ssw0rd'
|
||||
|
||||
$ClusterName = 'fc-test'
|
||||
$ClusterIP = '10.200.0.60'
|
||||
$ClusterNodes = @('fc-node-01','fc-node-02','fc-node-03')
|
||||
|
||||
$ShareServer = 'fc-dc-01'
|
||||
$ShareName = 'FCShare'
|
||||
|
||||
$SharePath = "C:\$ShareName"
|
||||
|
||||
|
||||
|
||||
Import-Module CoreFunctions -Force
|
||||
|
||||
$Creds = New-Credential `
|
||||
-UserName "$DomainName\$DomainUser" `
|
||||
-Password "$DomainPassword"
|
||||
|
||||
New-FailoverCluster `
|
||||
-ClusterName $ClusterName `
|
||||
-StaticAddress $ClusterIP `
|
||||
-ClusterNodes $ClusterNodes `
|
||||
-Credential $Creds
|
||||
|
||||
New-FailoverClusterSharedFolder `
|
||||
-ClusterName $ClusterName `
|
||||
-DomainName $DomainName `
|
||||
-ShareServer $ShareServer `
|
||||
-SharePath "$SharePath" `
|
||||
-ShareName "$ShareName" `
|
||||
-Credential $Creds
|
||||
|
||||
#>
|
|
@ -1,117 +0,0 @@
|
|||
function Init-Clustering {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Installs all the prerequisites for windows failover cluster.
|
||||
|
||||
.DESCRIPTION
|
||||
Checks that computer is a part of Windows Domain.
|
||||
Installs Failover Clustering windows feature with management tools if needed.
|
||||
Restart may be required to continue installation, so check this cmdlet exit code.
|
||||
If exit code is $true, a restart is required. System should be restarted and
|
||||
CmdLet should be re-executed to perform all the configuration tasks left.
|
||||
|
||||
Is is safe to execute this CmdLet multiple times. It checks which components
|
||||
are missing / unconfigured and performs only necessary steps.
|
||||
|
||||
#>
|
||||
$ComputerSystem = Get-WmiObject Win32_ComputerSystem
|
||||
if (-not $ComputerSystem.PartOfDomain) {
|
||||
throw "The computer should be joined to domain first"
|
||||
}
|
||||
Import-Module ServerManager
|
||||
$Feature = Get-WindowsFeature Failover-Clustering
|
||||
if ($Feature -eq $null) {
|
||||
throw "Failover-Clustering not found" # Should not happen on Win Server 2012
|
||||
}
|
||||
if (-not $Feature.Installed) {
|
||||
Write-Host "Failover Clustering feature is not installed. Installing it using Server Manager..."
|
||||
$FeatureOpResult = Add-WindowsFeature $Feature -IncludeManagementTools
|
||||
if (-not $FeatureOpResult.Success) {
|
||||
throw "Failed to install Failover-Clustering: " + $FeatureOpResult.ExitCode.toString()
|
||||
}
|
||||
if ($FeatureOpResult.RestartNeeded) {
|
||||
Write-Host "Restart is required to continue..."
|
||||
return $true
|
||||
}
|
||||
}
|
||||
$Feature = Get-WindowsFeature RSAT-Clustering
|
||||
if ($Feature -eq $null) {
|
||||
throw "Failover Clustering Tools feature not found" # Should not happen on Win Server 2012
|
||||
}
|
||||
if (-not $Feature.Installed) {
|
||||
Write-Host "Failover Clustering Tools feature is not installed. Installing it using Server Manager..."
|
||||
$FeatureOpResult = Add-WindowsFeature $Feature
|
||||
if (-not $FeatureOpResult.Success) {
|
||||
throw "Failed to install RSAT-Clustering: " + $FeatureOpResult.ExitCode.toString()
|
||||
}
|
||||
if ($FeatureOpResult.RestartNeeded) {
|
||||
Write-Host "Restart is required to continue..."
|
||||
return $true
|
||||
}
|
||||
}
|
||||
$Feature = Get-WindowsFeature RSAT-Clustering-Mgmt
|
||||
if ($Feature -eq $null) {
|
||||
throw "Failover Cluster Management Tools feature not found" # Should not happen on Win Server 2012
|
||||
}
|
||||
if (-not $Feature.Installed) {
|
||||
Write-Host "Failover Cluster Management Tools feature is not installed. Installing it using Server Manager..."
|
||||
$FeatureOpResult = Add-WindowsFeature $Feature
|
||||
if (-not $FeatureOpResult.Success) {
|
||||
throw "Failed to install RSAT-Clustering-Mgmt: " + $FeatureOpResult.ExitCode.toString()
|
||||
}
|
||||
if ($FeatureOpResult.RestartNeeded) {
|
||||
Write-Host "Restart is required to continue..."
|
||||
return $true
|
||||
}
|
||||
}
|
||||
$Feature = Get-WindowsFeature RSAT-Clustering-PowerShell
|
||||
if ($Feature -eq $null) {
|
||||
throw "Failover Cluster Module for Windows PowerShell feature not found" # Should not happen on Win Server 2012
|
||||
}
|
||||
if (-not $Feature.Installed) {
|
||||
Write-Host "Failover Cluster Module for Windows PowerShell feature is not installed. Installing it using Server Manager..."
|
||||
$FeatureOpResult = Add-WindowsFeature $Feature
|
||||
if (-not $FeatureOpResult.Success) {
|
||||
throw "Failed to install RSAT-Clustering-PowerShell: " + $FeatureOpResult.ExitCode.toString()
|
||||
}
|
||||
if ($FeatureOpResult.RestartNeeded) {
|
||||
Write-Host "Restart is required to continue..."
|
||||
return $true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function New-WindowsFailoverCluster {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creates a Windows Failover Cluster.
|
||||
|
||||
.DESCRIPTION
|
||||
Installs all the prerequisites and creates a new Windows Failover Cluster. Init-Clustering is executed
|
||||
by this cmdlet to ensure that all the required server components are installed. A reboot mey be
|
||||
required to complete installation. In case if this CmdLet returns $true, reboot the system and
|
||||
re-invoke the CmdLet with the same arguments to continue installation.
|
||||
|
||||
.PARAMETER ClusterName
|
||||
Failover Cluster Name. The installation will fail if a cluster or other object with the same name
|
||||
already exists in the domain.
|
||||
|
||||
.PARAMETER Nodes
|
||||
List of computers (fully qualified domain names are recommmeneded) to participate in the cluster.
|
||||
Current user should have all the required permissions to join all the machones to the cluster.
|
||||
#>
|
||||
param(
|
||||
[parameter(Mandatory = $true)]
|
||||
[string]$ClusterName,
|
||||
[parameter(Mandatory = $true)]
|
||||
[array]$Nodes
|
||||
)
|
||||
|
||||
if (Init-Clustering) {
|
||||
return $true
|
||||
}
|
||||
Import-Module FailoverClusters
|
||||
[void](Test-Cluster -Cluster $ClusterName -Node $Nodes)
|
||||
[void](New-Cluster -Name $ClusterName -Node @("bravo.murano.local", "charlie.murano.local") -NoStorage)
|
||||
return $false
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
Import-Module CoreFunctions -Force
|
||||
|
||||
|
||||
function Show-InvocationInfo {
|
||||
param (
|
||||
$Invocation,
|
||||
[Switch] $End
|
||||
)
|
||||
|
||||
if ($End) {
|
||||
Write-LogDebug "</function name='$($Invocation.MyCommand.Name)'>"
|
||||
}
|
||||
else {
|
||||
Write-LogDebug "<function name='$($Invocation.MyCommand.Name)'>"
|
||||
Write-LogDebug "<param>"
|
||||
foreach ($Parameter in $Invocation.MyCommand.Parameters) {
|
||||
foreach ($Key in $Parameter.Keys) {
|
||||
$Type = $Parameter[$Key].ParameterType.FullName
|
||||
foreach ($Value in $Invocation.BoundParameters[$Key]) {
|
||||
Write-LogDebug "[$Type] $Key = '$Value'"
|
||||
}
|
||||
}
|
||||
}
|
||||
Write-LogDebug "</param>"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$TrapHandler = {
|
||||
Write-LogError @("<exception>", $_) -EntireObject
|
||||
Write-LogError "</exception>"
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
|
||||
<#
|
||||
# Usage example for Show-InvocationInfo
|
||||
|
||||
function MyFunction {
|
||||
param (
|
||||
[String] $Value1,
|
||||
[String] $Value2,
|
||||
[Int] $Int1
|
||||
)
|
||||
begin {
|
||||
Show-InvocationInfo $MyInvocation
|
||||
}
|
||||
end {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
# Main code here
|
||||
}
|
||||
}
|
||||
#>
|
|
@ -1,84 +0,0 @@
|
|||
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
|
||||
|
||||
Function ConvertTo-Boolean {
|
||||
param (
|
||||
$InputObject,
|
||||
[Boolean] $Default = $false
|
||||
)
|
||||
try {
|
||||
[System.Convert]::ToBoolean($InputObject)
|
||||
}
|
||||
catch {
|
||||
$Default
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Function Show-Environment {
|
||||
foreach ($item in (Get-ChildItem Env:)) {
|
||||
Write-Log ("'{0}' --> '{1}'" -f $item.Name, $item.Value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Function Install-SqlServer {
|
||||
param (
|
||||
[String] $SetupRoot = '',
|
||||
[String] $SAPassword = '',
|
||||
[String] $MuranoFileShare = '',
|
||||
[Switch] $MixedModeAuth = $false,
|
||||
[Switch] $UpdateEnabled = $false
|
||||
)
|
||||
begin {
|
||||
Show-InvocationInfo $MyInvocation
|
||||
}
|
||||
end {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
if ($SetupRoot -eq '') {
|
||||
if ($MuranoFileShare -eq '') {
|
||||
$MuranoFileShare = [Environment]::GetEnvironmentVariable('MuranoFileShare')
|
||||
if ($MuranoFileShare -eq '') {
|
||||
throw("Unable to find MuranoFileShare path.")
|
||||
}
|
||||
}
|
||||
|
||||
$SetupRoot = [IO.Path]::Combine($MuranoFileShare, 'Prerequisites\SQL Server\2012')
|
||||
}
|
||||
|
||||
#$MixedModeAuthSwitch = ConvertTo-Boolean $MixedModeAuth
|
||||
|
||||
$ExtraOptions = @{}
|
||||
|
||||
if ($MixedModeAuth -eq $true) {
|
||||
$ExtraOptions += @{'SECURITYMODE' = 'SQL'}
|
||||
if ($SAPassword -eq '') {
|
||||
throw("SAPassword must be set when MixedModeAuth is requisted!")
|
||||
}
|
||||
}
|
||||
|
||||
if ($SAPassword -ne '') {
|
||||
$ExtraOptions += @{'SAPWD' = $SAPassword}
|
||||
}
|
||||
|
||||
if (-not $UpdateEnabled) {
|
||||
$ExtraOptions += @{'UpdateEnabled' = $false}
|
||||
}
|
||||
|
||||
Show-Environment
|
||||
|
||||
New-SqlServer -SetupRoot $SetupRoot -ExtraOptions $ExtraOptions
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
|
||||
Function Join-Domain {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Executes "Join domain" action.
|
||||
|
||||
Requires 'CoreFunctions' module.
|
||||
#>
|
||||
param (
|
||||
[String] $DomainName = '',
|
||||
[String] $UserName = '',
|
||||
[String] $Password = '',
|
||||
[String] $OUPath = '',
|
||||
[Switch] $AllowRestart
|
||||
)
|
||||
|
||||
if ($UserName -eq '') {
|
||||
$UserName = 'Administrator'
|
||||
}
|
||||
|
||||
$Credential = New-Credential -UserName "$DomainName\$UserName" -Password $Password
|
||||
|
||||
if (Test-ComputerName -DomainName $DomainName) {
|
||||
Write-LogWarning "Computer already joined to domain '$DomainName'"
|
||||
}
|
||||
else {
|
||||
Write-Log "Joining computer to domain '$DomainName' ..."
|
||||
|
||||
if ($OUPath -eq '') {
|
||||
Add-Computer -DomainName $DomainName -Credential $Credential -Force -ErrorAction Stop
|
||||
}
|
||||
else {
|
||||
Add-Computer -DomainName $DomainName -Credential $Credential -OUPath $OUPath -Force -ErrorAction Stop
|
||||
}
|
||||
|
||||
if ($AllowRestart) {
|
||||
Write-Log "Restarting computer ..."
|
||||
Restart-Computer -Force
|
||||
}
|
||||
else {
|
||||
Write-Log "Please restart the computer now."
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
|
||||
|
||||
function New-SqlServerSystemAccount {
|
||||
param (
|
||||
# (REQUIRED) Domain Name
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String] $DomainName,
|
||||
|
||||
# (REQUIRED) User name who has permissions to create and modify userPassword
|
||||
# Usually this is the domain administrator '$domainName\Administrator' account
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String] $UserName,
|
||||
|
||||
# (REQUIRED) Password for that user
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String] $UserPassword,
|
||||
|
||||
# (REQUIRED) User name for a new account that will be used to run SQL Server
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String] $SQLServiceUserName,
|
||||
|
||||
# (REQUIRED) Password for that user
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String] $SQLServiceUserPassword,
|
||||
|
||||
[String] $PrimaryNode = ' '
|
||||
)
|
||||
begin {
|
||||
Show-InvocationInfo $MyInvocation
|
||||
}
|
||||
end {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
if ($PrimaryNode.ToLower() -ne ($Env:ComputerName).ToLower()) {
|
||||
Write-Log "THis function runs on AOAG primary node only."
|
||||
Write-Log "Exiting."
|
||||
return
|
||||
}
|
||||
|
||||
Write-Log "Installing 'RSAT-AD-PowerShell' ... "
|
||||
Add-WindowsFeature RSAT-AD-PowerShell
|
||||
|
||||
Import-Module ActiveDirectory
|
||||
|
||||
$Creds = New-Credential -UserName "$DomainName\$UserName" -Password "$UserPassword"
|
||||
|
||||
Write-Log "Adding new user ..."
|
||||
$null = New-ADUser `
|
||||
-Name $SQLServiceUserName `
|
||||
-AccountPassword $(ConvertTo-SecureString -String $SQLServiceUserPassword -AsPlainText -Force) `
|
||||
-Credential $Creds `
|
||||
-ErrorAction 'Stop'
|
||||
}
|
||||
}
|
|
@ -1,280 +0,0 @@
|
|||
function New-Option ([string]$Name, [switch]$Switch, [switch]$Boolean, [switch]$String, [switch]$List, $Constraints=$null) {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creates Option object
|
||||
|
||||
.DESCRIPTION
|
||||
Option object is a virtual object represtnting typed command line option. These objects encapsulate escaping and
|
||||
validation matters.
|
||||
|
||||
One and only one of the switches 'Switch', 'Boolean', 'String' or 'List' should be provided.
|
||||
|
||||
.PARAMETER Name
|
||||
Option name as it appears in the command line.
|
||||
|
||||
.PARAMETER Switch
|
||||
Use this switch to create valueless option (a switch).
|
||||
|
||||
.PARAMETER Boolean
|
||||
Use this switch to create boolean option. Its value is always converted to "1" or "0"
|
||||
|
||||
.PARAMETER String
|
||||
Use this switch to create string option. Its value will be properly quoted if necessary.
|
||||
|
||||
.PARAMETER List
|
||||
Use this switch to create option with list value. Values will be put into command line using valid value delemiter (a comma)
|
||||
|
||||
.PARAMETER Constraints
|
||||
When this parameter is specified, option values are limited to options from that list.
|
||||
|
||||
#>
|
||||
|
||||
$Option = New-Object -TypeName PSObject
|
||||
|
||||
# Fields
|
||||
$Option | Add-Member NoteProperty Type -value $null
|
||||
$Option | Add-Member NoteProperty Name -value $null
|
||||
$Option | Add-Member NoteProperty AllowedValues -value $null
|
||||
|
||||
# Init
|
||||
|
||||
$Option | Add-Member ScriptMethod __init__ {
|
||||
param([string]$Name, $Switch, $Boolean, $String, $List)
|
||||
|
||||
$this.Name = $Name
|
||||
|
||||
# With respect for our developers we do not check for double type selected
|
||||
if ($Switch) {
|
||||
AugmentOptionSwitch($this)
|
||||
} elseif ($Boolean) {
|
||||
AugmentOptionBoolean($this)
|
||||
} elseif ($String) {
|
||||
AugmentOptionString($this)
|
||||
} elseif ($List) {
|
||||
AugmentOptionList($this)
|
||||
} else {
|
||||
throw "Switch, Boolean, String or List option type must be provided for option '$Name'"
|
||||
}
|
||||
}
|
||||
|
||||
$Option | Add-Member ScriptMethod __post_init__ {
|
||||
param($Constraints=$null)
|
||||
if ($Constraints -ne $null) {
|
||||
$this.AllowedValues = @()
|
||||
$this.AllowedValues = $this.AllowedValues + $Constraints
|
||||
} else {
|
||||
$Constraints = $null
|
||||
}
|
||||
}
|
||||
|
||||
# Methods
|
||||
|
||||
$Option | Add-Member -Force ScriptMethod Validate {
|
||||
if ($this.AllowedValues -ne $null) {
|
||||
if (-not($this.AllowedValues -contains $this.Value)) {
|
||||
$Cts = $this.AllowedValues -join ','
|
||||
throw "Option '$($this.Name)' may have values ($Cts) but not '$($this.Value)'"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$Option | Add-Member -Force ScriptMethod ToString {
|
||||
return "/$($this.Name)"
|
||||
}
|
||||
|
||||
# invoke constructor
|
||||
|
||||
$Option.__init__($Name, $Switch, $Boolean, $String, $List)
|
||||
$Option.__post_init__($Constraints)
|
||||
|
||||
return $Option
|
||||
}
|
||||
|
||||
function AugmentOptionSwitch($Option) {
|
||||
}
|
||||
|
||||
function AugmentOptionBoolean($Option) {
|
||||
# Fields
|
||||
$Option | Add-Member NoteProperty Value -value $false
|
||||
|
||||
# Methods
|
||||
|
||||
$Option | Add-Member -Force ScriptMethod ToString {
|
||||
if ($this.Value) {
|
||||
return "/$($this.Name)=1"
|
||||
} else {
|
||||
return "/$($this.Name)=0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function AugmentOptionString($Option) {
|
||||
# Fields
|
||||
$Option | Add-Member NoteProperty Value -value ""
|
||||
|
||||
# Methods
|
||||
|
||||
$Option | Add-Member -Force ScriptMethod ToString {
|
||||
$v = "$($this.Value)"
|
||||
if ($v -match '.* .*') {
|
||||
# TODO: Escape double quote characters if possible
|
||||
return "/$($this.Name)=`"$v`""
|
||||
} else {
|
||||
return "/$($this.Name)=$v"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function AugmentOptionList($Option) {
|
||||
# Fields
|
||||
$Option | Add-Member NoteProperty Value -value @()
|
||||
|
||||
# Methods
|
||||
|
||||
$Option | Add-Member -Force ScriptMethod Validate {
|
||||
if ($this.AllowedValues -ne $null) {
|
||||
foreach ($V in $this.Value) {
|
||||
if (-not($this.AllowedValues -contains $V)) {
|
||||
$Cts = $this.AllowedValues -join ','
|
||||
throw "Option '$($this.Name)' may have values ($Cts) but not '$V'"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$Option | Add-Member -Force ScriptMethod ToString {
|
||||
return "/$($this.Name)=$($this.Value -join ',')"
|
||||
}
|
||||
}
|
||||
|
||||
function New-OptionParser() {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creates OptionParser object.
|
||||
|
||||
.DESCRIPTION
|
||||
OptionParser object leverages Option objects capabilities and builds valid command line using specified options.
|
||||
An application may also be invoked with OptionParser.
|
||||
|
||||
#>
|
||||
|
||||
$OptionParser = New-Object -TypeName PSObject
|
||||
|
||||
# Fields
|
||||
$OptionParser | Add-Member NoteProperty Options -value @{}
|
||||
$OptionParser | Add-Member NoteProperty Defaults -value @{}
|
||||
$OptionParser | Add-Member NoteProperty RequiredOptions -value @()
|
||||
|
||||
# Methods
|
||||
|
||||
$OptionParser | Add-Member ScriptMethod AddOption {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Adds supported option into OptionParser.
|
||||
|
||||
.DESCRIPTION
|
||||
OptionParser does not allow using unrecognized options. Use this method to fill OptionParser with recognized options
|
||||
|
||||
.PARAMETER Option
|
||||
Option object
|
||||
|
||||
.PARAMETER Required
|
||||
Required option switch
|
||||
|
||||
.PARAMETER Default
|
||||
Option default value
|
||||
#>
|
||||
param($Option, [bool]$Required=$false, $Default=$null)
|
||||
$this.Options.Add($Option.Name, $Option)
|
||||
if ($Required) {
|
||||
$this.RequiredOptions = $this.RequiredOptions + $Option.Name
|
||||
if ($Option | Get-Member "Value") {
|
||||
if ($Default) {
|
||||
$this.Defaults.Add($Option.Name, $Default)
|
||||
}
|
||||
} else {
|
||||
$this.Defaults.Add($Option.Name, $null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$OptionParser | Add-Member ScriptMethod Parse {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Parses supplied options and returns command line parameters array.
|
||||
|
||||
.DESCRIPTION
|
||||
This method verifies that only supported options are provided, all mandatory options are in place,
|
||||
all option meet constraints if any. Unspecified options with default values are added to command line.
|
||||
So, mandatory option with default value never causes exception.
|
||||
|
||||
.PARAMETER Options
|
||||
A hash map of options to parse. Option names should be mapped to corresponding values.
|
||||
#>
|
||||
param([hashtable]$Options)
|
||||
|
||||
$CommandLine = @()
|
||||
foreach ($RequiredOptionName in $this.RequiredOptions) {
|
||||
if (-not $Options.ContainsKey($RequiredOptionName)) {
|
||||
$Default = $this.Defaults.Get_Item($RequiredOptionName)
|
||||
if ($this.Defaults.ContainsKey($RequiredOptionName)) {
|
||||
$Options.Add($RequiredOptionName, $this.Defaults.Get_Item($RequiredOptionName))
|
||||
} else {
|
||||
throw "Required option '$RequiredOptionName' is missing"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($OptionName in $($Options.keys)) {
|
||||
$Option = $this.Options.Get_Item($OptionName)
|
||||
if ($Option -eq $null) {
|
||||
throw "Option '$OptionName' is not allowed"
|
||||
}
|
||||
if ($Option | Get-Member "Value") {
|
||||
$Option.Value = $Options.Get_Item($OptionName)
|
||||
}
|
||||
$Option.Validate()
|
||||
$CommandLine = $CommandLine + $Option.ToString()
|
||||
}
|
||||
return $CommandLine
|
||||
}
|
||||
|
||||
$OptionParser | Add-Member ScriptMethod ExecuteBinary {
|
||||
param($Binary, [hashtable]$Options = @{}, $CommandLineSuffix = @())
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Executes binary with a command line constructed from provided options. An arbitrary suffix may be
|
||||
appended to the command line.
|
||||
|
||||
.DESCRIPTION
|
||||
This method uses OptionParser.Parse method to construct command line. If there a command line suffix
|
||||
was supplied, it is appended to the end of command line. Normally command line suffix should contain
|
||||
leading space character.
|
||||
|
||||
Method waits for executable process to complete and returns its exit code.
|
||||
|
||||
.PARAMETER Binary
|
||||
Full or relative path to the executable to run.
|
||||
|
||||
.PARAMETER Options
|
||||
A hash map of options to pass to the executable.
|
||||
|
||||
.PARAMETER CommandLineSuffix
|
||||
Arbitrary command line suffix. Normally it shoud have leading space character.
|
||||
#>
|
||||
|
||||
$Binary = Get-Item $Binary
|
||||
$CommandLine = $this.Parse($Options)
|
||||
if ($CommandLineSuffix) {
|
||||
$CommandLine = $CommandLine + $CommandLineSuffix
|
||||
}
|
||||
|
||||
Write-Log "Executing: $($Binary.FullName) $($CommandLine -join ' ')"
|
||||
$process = [System.Diagnostics.Process]::Start($Binary, $CommandLine)
|
||||
$process.WaitForExit()
|
||||
$process.Refresh()
|
||||
return $process.ExitCode
|
||||
}
|
||||
|
||||
return $OptionParser
|
||||
}
|
|
@ -1,534 +0,0 @@
|
|||
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
function Install-SqlServerPowerShellModule {
|
||||
param (
|
||||
[String] $SetupRoot = ''
|
||||
)
|
||||
begin {
|
||||
Show-InvocationInfo $MyInvocation
|
||||
}
|
||||
end {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
if ((Get-Module SQLPS -ListAvailable) -ne $null) {
|
||||
Write-Log "Module SQLSP already installed."
|
||||
return
|
||||
}
|
||||
|
||||
if ($MuranoFileShare -eq '') {
|
||||
$MuranoFileShare = [Environment]::GetEnvironmentVariable('MuranoFileShare')
|
||||
if ($MuranoFileShare -eq '') {
|
||||
throw("Unable to find MuranoFileShare path.")
|
||||
}
|
||||
}
|
||||
|
||||
if ($SetupRoot -eq '') {
|
||||
$SetupRoot = [IO.Path]::Combine($MuranoFileShare, 'Prerequisites\SQL Server\Tools')
|
||||
}
|
||||
|
||||
$FileList = @(
|
||||
'SQLSysClrTypes.msi',
|
||||
'SharedManagementObjects.msi',
|
||||
'PowerShellTools.msi'
|
||||
)
|
||||
|
||||
foreach ($MsiFile in $FileList) {
|
||||
Write-Log "Trying to install '$MsiFile' ..."
|
||||
$MsiPath = Join-Path $SetupRoot $MsiFile
|
||||
if ([IO.File]::Exists($MsiPath)) {
|
||||
Write-Log "Starting msiexe ..."
|
||||
$Result = Exec -FilePath "msiexec.exe" -ArgumentList @('/i', "`"$MsiPath`"", '/quiet') -PassThru
|
||||
if ($Result.ExitCode -ne 0) {
|
||||
throw ("Installation of MSI package '$MsiPath' failed with error code '$($Result.ExitCode)'")
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Log "File '$MsiPath' not found."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Install-SqlServerForAOAG {
|
||||
param (
|
||||
# Path to folder where msi files for additional SQL features are located
|
||||
[String] $SetupRoot = '',
|
||||
|
||||
# Path to folder where msi files for additional SQLPS module are located
|
||||
[String] $SqlpsSetupRoot = '',
|
||||
|
||||
[String] $MuranoFileShare = '',
|
||||
|
||||
# (REQUIRED) Domain name
|
||||
[String] $SQLServiceUserDomain = 'fc-acme.local',
|
||||
|
||||
# (REQUIRED) User name for the account which will be used by SQL service
|
||||
[String] $SQLServiceUserName = 'Administrator',
|
||||
|
||||
# (REQUIRED) Password for that user
|
||||
[String] $SQLServiceUserPassword = 'P@ssw0rd',
|
||||
|
||||
[Switch] $UpdateEnabled
|
||||
)
|
||||
begin {
|
||||
Show-InvocationInfo $MyInvocation
|
||||
}
|
||||
end {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
if ($MuranoFileShare -eq '') {
|
||||
$MuranoFileShare = [Environment]::GetEnvironmentVariable('MuranoFileShare')
|
||||
if ($MuranoFileShare -eq '') {
|
||||
throw("Unable to find MuranoFileShare path.")
|
||||
}
|
||||
}
|
||||
|
||||
if ($SetupRoot -eq '') {
|
||||
$SetupRoot = [IO.Path]::Combine($MuranoFileShare, 'Prerequisites\SQL Server\2012')
|
||||
}
|
||||
|
||||
$ExtraOptions = @{}
|
||||
|
||||
if ($UpdateEnabled) {
|
||||
$ExtraOptions += @{'UpdateEnabled' = $true}
|
||||
}
|
||||
else {
|
||||
$ExtraOptions += @{'UpdateEnabled' = $false}
|
||||
}
|
||||
|
||||
New-SQLServerForAOAG `
|
||||
-SetupRoot $SetupRoot `
|
||||
-SQLSvcUsrDomain $SQLServiceUserDomain `
|
||||
-SQLSvcUsrName $SQLServiceUserName `
|
||||
-SQLSvcUsrPassword $SQLServiceUserPassword `
|
||||
-ExtraOptions $ExtraOptions
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Initialize-AlwaysOnAvailabilityGroup {
|
||||
param (
|
||||
[String] $DomainName,
|
||||
[String] $DomainAdminAccountName,
|
||||
[String] $DomainAdminAccountPassword,
|
||||
[String] $SqlServiceAccountName,
|
||||
[String] $PrimaryNode,
|
||||
[String] $ShareName = 'SharedWorkDir'
|
||||
)
|
||||
begin {
|
||||
Show-InvocationInfo $MyInvocation
|
||||
}
|
||||
end {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
$ShareNetworkPath = '\\' + $PrimaryNode + '\' + $ShareName
|
||||
|
||||
$DomainAdminAccountCreds = New-Credential `
|
||||
-UserName "$DomainName\$DomainAdminAccountName" `
|
||||
-Password "$DomainAdminAccountPassword"
|
||||
|
||||
$FunctionsFile = Export-Function 'Get-NextFreePort', 'Initialize-AlwaysOn'
|
||||
|
||||
$null = Start-PowerShellProcess @"
|
||||
trap {
|
||||
`$_
|
||||
exit 1
|
||||
}
|
||||
|
||||
Import-Module CoreFunctions
|
||||
|
||||
Write-Log "Importing functions file '$FunctionsFile' ..."
|
||||
. "$FunctionsFile"
|
||||
|
||||
Write-Log "Starting 'Initialize-AlwaysOn' ..."
|
||||
`$XmlFile = [IO.Path]::Combine("$ShareNetworkPath", "`$(`$Env:ComputerName).xml")
|
||||
Write-Log "Output XML file is '`$XmlFile'"
|
||||
Initialize-AlwaysOn | Export-CliXml -Path `$XmlFile
|
||||
"@ -Credential $DomainAdminAccountCreds -NoBase64
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function New-SharedFolderForAOAG {
|
||||
param (
|
||||
# (OPTIONAL)
|
||||
[String] $SharePath = [IO.Path]::Combine($Env:SystemDrive + '\', 'SharedWorkDir'),
|
||||
|
||||
# (OPTIONAL)
|
||||
[String] $ShareName = 'SharedWorkDir',
|
||||
|
||||
[String] $PrimaryNode = ' '
|
||||
)
|
||||
begin {
|
||||
Show-InvocationInfo $MyInvocation
|
||||
}
|
||||
end {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
if ($PrimaryNode.ToLower() -ne ($Env:ComputerName).ToLower()) {
|
||||
Write-Log "This script runs on primary node only."
|
||||
Write-Log "Exiting script."
|
||||
return
|
||||
}
|
||||
|
||||
if ($ShareName -eq '') {
|
||||
$ShareName = [IO.Path]::GetFileNameWithoutExtension($SharePath)
|
||||
}
|
||||
|
||||
Write-LogDebug "SharePath = '$SharePath'"
|
||||
Write-LogDebug "ShareName = '$ShareName'"
|
||||
|
||||
try {
|
||||
Write-LogDebug "Trying to remove share '$ShareName'"
|
||||
$null = Get-SmbShare -Name $ShareName -ErrorAction 'Stop'
|
||||
$null = Remove-SmbShare -Name $ShareName -Force
|
||||
write-Log "Share '$ShareName' removed."
|
||||
}
|
||||
catch {
|
||||
Write-LogWarning "Share '$ShareName' not exists or cannot be deleted."
|
||||
}
|
||||
|
||||
try {
|
||||
Write-LogDebug "Trying to remove folder '$SharePath"
|
||||
$null = Get-Item -Path $SharePath -ErrorAction 'Stop'
|
||||
$null = Remove-Item -Path $SharePath -Recurse -Force
|
||||
Write-Log "Folder '$SharePath' removed."
|
||||
}
|
||||
catch {
|
||||
Write-LogWarning "Folder '$SharePath' not exists or cannot be deleted."
|
||||
}
|
||||
|
||||
$null = New-Item -Path $SharePath -ItemType Container -Force
|
||||
|
||||
$null = New-SmbShare -Path $SharePath `
|
||||
-Name $ShareName `
|
||||
-FullAccess "Everyone" `
|
||||
-Description "Shared folder for AlwaysOn Availability Group setup."
|
||||
|
||||
return '\\' + $Env:ComputerName + '\' + $ShareName
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function New-DatabaseForAOAG {
|
||||
param (
|
||||
[String] $DatabaseName,
|
||||
[String] $DomainName,
|
||||
[String] $UserName,
|
||||
[String] $UserPassword
|
||||
)
|
||||
|
||||
$Creds = New-Credential -UserName "$DomainName\$UserName" -Password "$UserPassword"
|
||||
|
||||
$FunctionsFile = Export-Function 'Invoke-SQLText', 'ConvertTo-SQLName', 'ConvertTo-SQLString', 'New-SQLDatabase'
|
||||
|
||||
Start-PowerShellProcess @"
|
||||
trap {
|
||||
`$_
|
||||
exit 1
|
||||
}
|
||||
|
||||
Import-Module CoreFunctions
|
||||
|
||||
Write-Log "Importing functions from file '$FunctionsFile' ..."
|
||||
. "$FunctionsFile"
|
||||
|
||||
Write-Log "Starting 'New-SQLDatabase' ..."
|
||||
New-SQLDatabase $DatabaseName
|
||||
"@ -Credential $Creds -NoBase64
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Initialize-AOAGPrimaryReplica {
|
||||
param (
|
||||
# (OPTIONAL) Name of the new Availability Group. If not specified then default name will be used.
|
||||
[String] $GroupName = 'MuranoAG',
|
||||
|
||||
# (REQUIRED) Nodes that will be configured as replica partners.
|
||||
#[Parameter(Mandatory=$true)]
|
||||
[String[]] $NodeList,
|
||||
|
||||
# (REQUIRED) Node name that will be primary for selected Availability Group
|
||||
#[Parameter(Mandatory=$true)]
|
||||
[String] $PrimaryNode,
|
||||
|
||||
# (REQUIRED) Database list that will be added to the Availability Group
|
||||
#[Parameter(Mandatory=$true)]
|
||||
[String[]] $DatabaseList,
|
||||
|
||||
# (REQUIRED) Listener name that will be used by clients to connect to databases in that AG
|
||||
#[Parameter(Mandatory=$true)]
|
||||
[String] $ListenerName = 'MuranoAG_Listener',
|
||||
|
||||
# (REQUIRED) IP address of the listener
|
||||
#[Parameter(Mandatory=$true)]
|
||||
[String] $ListenerIP,
|
||||
|
||||
[String] $ListenerIPMask = '255.255.255.0',
|
||||
|
||||
[String] $ListenerPort = '5023',
|
||||
|
||||
# Sync Mode Node List
|
||||
[String[]] $SyncModeNodeList,
|
||||
|
||||
[String] $SharedWorkDir = 'SharedWorkDir',
|
||||
|
||||
[String] $CliXmlFile = '',
|
||||
|
||||
[String] $DomainName,
|
||||
[String] $UserName,
|
||||
[String] $UserPassword
|
||||
)
|
||||
begin {
|
||||
Show-InvocationInfo $MyInvocation
|
||||
}
|
||||
end {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
Write-Log "Primary node: '$($PrimaryNode.ToLower())'"
|
||||
Write-Log "Current node: '$(($Env:ComputerName).ToLower())'"
|
||||
|
||||
if ($PrimaryNode.ToLower() -ne $($Env:ComputerName).ToLower()) {
|
||||
Write-Log "This function works on PrimaryNode only."
|
||||
Write-Log "Exiting."
|
||||
return
|
||||
}
|
||||
|
||||
if ($CliXmlFile -eq '') {
|
||||
$ReplicaDefinitionList = @()
|
||||
foreach ($Node in $NodeList) {
|
||||
try {
|
||||
$NodeEndpointPort = Import-CliXml -Path "\\$PrimaryNode\SharedWorkDir\$Node.xml"
|
||||
}
|
||||
catch {
|
||||
Write-Log "Using default endpoint port 5022"
|
||||
$NodeEndpointPort = 5022
|
||||
}
|
||||
|
||||
$ReplicaDefinition = @{
|
||||
"SERVER_INSTANCE" = "$Node";
|
||||
"ENDPOINT_URL" = "TCP://${Node}:${NodeEndpointPort}";
|
||||
"AVAILABILITY_MODE" = "ASYNCHRONOUS_COMMIT";
|
||||
"FAILOVER_MODE"="MANUAL";
|
||||
}
|
||||
|
||||
if ($SyncModeNodeList -contains $Node) {
|
||||
Write-Log "$Node is in SyncModeNodeList"
|
||||
$ReplicaDefinition['AVAILABILITY_MODE'] = "SYNCHRONOUS_COMMIT"
|
||||
$ReplicaDefinition['FAILOVER_MODE'] = "AUTOMATIC"
|
||||
}
|
||||
else {
|
||||
Write-Log "$Node is NOT in SyncModeNodeList"
|
||||
}
|
||||
|
||||
$ReplicaDefinitionList += @($ReplicaDefinition)
|
||||
}
|
||||
|
||||
$Preferences = @{}
|
||||
|
||||
$ListenerDefinition = @{
|
||||
"NAME"=$ListenerName;
|
||||
"PORT" = "$ListenerPort";
|
||||
"STATIC" = "$ListenerIP/$ListenerIPMask"
|
||||
}
|
||||
|
||||
$Parameters = @{
|
||||
'WorkDir' = "\\$PrimaryNode\$SharedWorkDir";
|
||||
'Name' = $GroupName;
|
||||
'DatabaseNames' = $DatabaseList;
|
||||
'ReplicaDefs' = $ReplicaDefinitionList;
|
||||
'Preferences' = $Preferences;
|
||||
'ListenerDef' = $ListenerDefinition;
|
||||
}
|
||||
|
||||
$null = Remove-Item -Path "\\$PrimaryNode\SharedWorkDir\*" -Force
|
||||
|
||||
$CliXmlFile = [IO.Path]::GetTempFileName()
|
||||
|
||||
Write-LogDebug "CliXml file: '$CliXmlFile'"
|
||||
|
||||
$null = Export-CliXml -Path $CliXmlFile -InputObject $Parameters -Depth 10
|
||||
|
||||
$null = Initialize-AOAGPrimaryReplica `
|
||||
-CliXmlFile $CliXmlFile `
|
||||
-DomainName $DomainName `
|
||||
-UserName $UserName `
|
||||
-UserPassword $UserPassword `
|
||||
-PrimaryNode $PrimaryNode
|
||||
|
||||
Write-LogDebug "Inner 'Initialize-AOAGPrimaryReplica' call completed."
|
||||
}
|
||||
else {
|
||||
$Creds = New-Credential -UserName "$DomainName\$UserName" -Password "$UserPassword"
|
||||
|
||||
$FunctionsFile = Export-Function -All
|
||||
|
||||
$null = Start-PowerShellProcess @"
|
||||
trap {
|
||||
`$_
|
||||
exit 1
|
||||
}
|
||||
|
||||
Import-Module CoreFunctions
|
||||
|
||||
Write-Log "Importing functions from '$FunctionsFile' ..."
|
||||
. "$FunctionsFile"
|
||||
|
||||
Write-Log "Importing CliXml parameters file ..."
|
||||
`$Parameters = Import-CliXml -Path $CliXmlFile
|
||||
|
||||
Write-Log "Starting 'New-AlwaysOnAvailabilityGroup' ..."
|
||||
New-AlwaysOnAvailabilityGroup ``
|
||||
-WorkDir `$Parameters['WorkDir'] ``
|
||||
-Name `$Parameters['Name'] ``
|
||||
-DatabaseNames `$Parameters['DatabaseNames'] ``
|
||||
-ReplicaDefs `$Parameters['ReplicaDefs'] ``
|
||||
-Preferences `$Parameters['Preferences'] ``
|
||||
-ListenerDef `$Parameters['ListenerDef']
|
||||
"@ -Credential $Creds -NoBase64
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Initialize-AOAGSecondaryReplica {
|
||||
param (
|
||||
# (REQUIRED) Nodes that will be configured as replica partners.
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String[]] $NodeList,
|
||||
|
||||
# (REQUIRED) Node name that will be primary for selected Availability Group
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String] $PrimaryNode,
|
||||
|
||||
[String] $SharedWorkDir = 'SharedWorkDir',
|
||||
|
||||
[String] $DomainName,
|
||||
[String] $UserName,
|
||||
[String] $UserPassword
|
||||
)
|
||||
begin {
|
||||
Show-InvocationInfo $MyInvocation
|
||||
}
|
||||
end {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
if ($PrimaryNode.ToLower() -eq ($Env:ComputerName).ToLower()) {
|
||||
Write-Log "This function works on any SecondaryNode only."
|
||||
Write-Log "Exiting."
|
||||
return
|
||||
}
|
||||
|
||||
$Creds = New-Credential -UserName "$DomainName\$UserName" -Password "$UserPassword"
|
||||
|
||||
$FunctionsFile = Export-Function -All
|
||||
|
||||
$null = Start-PowerShellProcess @"
|
||||
trap {
|
||||
$_
|
||||
exit 1
|
||||
}
|
||||
|
||||
Import-Module CoreFunctions
|
||||
|
||||
Write-Log "Importing functions from '$FunctionsFile' ..."
|
||||
. "$FunctionsFile"
|
||||
|
||||
Write-Log "Starting 'New-AlwaysOnAvailabilityGroupReplica' ..."
|
||||
New-AlwaysOnAvailabilityGroupReplica -WorkDir "\\$PrimaryNode\$SharedWorkDir"
|
||||
"@ -Credential $Creds -NoBase64
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Disable-Firewall {
|
||||
begin {
|
||||
Show-InvocationInfo $MyInvocation
|
||||
}
|
||||
end {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
netsh advfirewall set allprofiles state off
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Enable-Firewall {
|
||||
begin {
|
||||
Show-InvocationInfo $MyInvocation
|
||||
}
|
||||
end {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
netsh advfirewall set allprofiles state on
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Enable-TrustedHosts {
|
||||
begin {
|
||||
Show-InvocationInfo $MyInvocation
|
||||
}
|
||||
end {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
Set-Item WSMan:\localhost\Client\TrustedHosts -Value '*' -Force
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,367 +0,0 @@
|
|||
function New-OptionParserInstall {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creates an option parser for MS SQL Server 2012 setup "INSTALL" action.
|
||||
|
||||
.DESCRIPTION
|
||||
Use this cmdlet to create an option parser for MS SQL Server 2012 setup "INSTALL" action.
|
||||
All documented option are supported. See the following link for details:
|
||||
http://msdn.microsoft.com/en-us/library/ms144259.aspx
|
||||
#>
|
||||
$OptionParser = New-OptionParser
|
||||
|
||||
$IsPartOfDomain = (Get-WmiObject Win32_ComputerSystem).PartOfDomain
|
||||
|
||||
$OptionParser.AddOption((New-Option "ACTION" -String -Constraints "INSTALL"), $true, "INSTALL")
|
||||
$OptionParser.AddOption((New-Option "IACCEPTSQLSERVERLICENSETERMS" -Switch), $true)
|
||||
$OptionParser.AddOption((New-Option "ENU" -Switch))
|
||||
#$OptionParser.AddOption((New-Option "UpdateEnabled" -Switch))
|
||||
$OptionParser.AddOption((New-Option "UpdateEnabled" -Boolean))
|
||||
$OptionParser.AddOption((New-Option "UpdateSource" -String))
|
||||
$OptionParser.AddOption((New-Option "CONFIGURATIONFILE" -String))
|
||||
$OptionParser.AddOption((New-Option "ERRORREPORTING" -Boolean))
|
||||
$OptionParser.AddOption((New-Option "FEATURES" -List -Constraints ("SQL","SQLEngine","Replication","FullText","DQ","AS","RS","DQC","IS","MDS","Tools","BC","BOL","BIDS","Conn","SSMS","ADV_SSMS","DREPLAY_CTLR","DREPLAY_CLT","SNAC_SDK","SDK","LocalDB")))
|
||||
$OptionParser.AddOption((New-Option "ROLE" -String -Constraints ("SPI_AS_ExistingFarm", "SPI_AS_NewFarm", "AllFeatures_WithDefaults")))
|
||||
$OptionParser.AddOption((New-Option "INDICATEPROGRESS" -Switch))
|
||||
$OptionParser.AddOption((New-Option "INSTALLSHAREDDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "INSTALLSHAREDWOWDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "INSTANCEDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "INSTANCEID" -String))
|
||||
$OptionParser.AddOption((New-Option "INSTANCENAME" -String), $true, "MSSQLSERVER")
|
||||
$OptionParser.AddOption((New-Option "PID" -String))
|
||||
$OptionParser.AddOption((New-Option "Q" -Switch))
|
||||
$OptionParser.AddOption((New-Option "QS" -Switch))
|
||||
$OptionParser.AddOption((New-Option "UIMODE" -String -Constraints ("Normal", "AutoAdvance")))
|
||||
$OptionParser.AddOption((New-Option "SQMREPORTING" -Boolean))
|
||||
$OptionParser.AddOption((New-Option "HIDECONSOLE" -Switch))
|
||||
$OptionParser.AddOption((New-Option "AGTSVCACCOUNT" -String), $true, "NT AUTHORITY\Network Service")
|
||||
$OptionParser.AddOption((New-Option "AGTSVCPASSWORD" -String))
|
||||
$OptionParser.AddOption((New-Option "AGTSVCSTARTUPTYPE" -String -Constraints ("Manual", "Automatic", "Disabled")))
|
||||
$OptionParser.AddOption((New-Option "ASBACKUPDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "ASCOLLATION" -String))
|
||||
$OptionParser.AddOption((New-Option "ASCONFIGDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "ASDATADIR" -String))
|
||||
$OptionParser.AddOption((New-Option "ASLOGDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "ASSERVERMODE" -String -Constraints ("MULTIDIMENSIONAL", "POWERPIVOT", "TABULAR")))
|
||||
$OptionParser.AddOption((New-Option "ASSVCACCOUNT" -String), $true, "NT AUTHORITY\Network Service")
|
||||
$OptionParser.AddOption((New-Option "ASSVCPASSWORD" -String))
|
||||
$OptionParser.AddOption((New-Option "ASSVCSTARTUPTYPE" -String -Constraints ("Manual", "Automatic", "Disabled")))
|
||||
|
||||
#$OptionParser.AddOption((New-Option "ASSYSADMINACCOUNTS" -String), $true, "$ENV:USERDOMAIN\$ENV:USERNAME")
|
||||
if ($IsPartOfDomain) {
|
||||
$OptionParser.AddOption((New-Option "ASSYSADMINACCOUNTS" -String), $true, "$Env:USERDOMAIN\Administrator")
|
||||
}
|
||||
else {
|
||||
$OptionParser.AddOption((New-Option "ASSYSADMINACCOUNTS" -String), $true, "$Env:COMPUTERNAME\Administrator")
|
||||
}
|
||||
|
||||
$OptionParser.AddOption((New-Option "ASTEMPDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "ASPROVIDERMSOLAP" -Boolean))
|
||||
$OptionParser.AddOption((New-Option "FARMACCOUNT" -String))
|
||||
$OptionParser.AddOption((New-Option "FARMPASSWORD" -String))
|
||||
$OptionParser.AddOption((New-Option "PASSPHRASE" -String))
|
||||
$OptionParser.AddOption((New-Option "FARMADMINIPORT" -String))
|
||||
$OptionParser.AddOption((New-Option "BROWSERSVCSTARTUPTYPE" -String -Constraints ("Manual", "Automatic", "Disabled")))
|
||||
$OptionParser.AddOption((New-Option "ENABLERANU" -Switch))
|
||||
$OptionParser.AddOption((New-Option "INSTALLSQLDATADIR" -String))
|
||||
$OptionParser.AddOption((New-Option "SAPWD" -String))
|
||||
$OptionParser.AddOption((New-Option "SECURITYMODE" -String -Constrainrs ("SQL")))
|
||||
$OptionParser.AddOption((New-Option "SQLBACKUPDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "SQLCOLLATION" -String))
|
||||
$OptionParser.AddOption((New-Option "ADDCURRENTUSERASSQLADMIN" -Switch))
|
||||
$OptionParser.AddOption((New-Option "SQLSVCACCOUNT" -String), $true, "NT AUTHORITY\Network Service")
|
||||
$OptionParser.AddOption((New-Option "SQLSVCPASSWORD" -String))
|
||||
$OptionParser.AddOption((New-Option "SQLSVCSTARTUPTYPE" -String -Constraints ("Manual", "Automatic", "Disabled")))
|
||||
|
||||
#$OptionParser.AddOption((New-Option "SQLSYSADMINACCOUNTS" -String), $true, "$ENV:USERDOMAIN\$ENV:USERNAME")
|
||||
if ($IsPartOfDomain) {
|
||||
$OptionParser.AddOption((New-Option "SQLSYSADMINACCOUNTS" -String), $true, "$ENV:USERDOMAIN\Administrator")
|
||||
}
|
||||
else {
|
||||
$OptionParser.AddOption((New-Option "SQLSYSADMINACCOUNTS" -String), $true, "$ENV:COMPUTERNAME\Administrator")
|
||||
}
|
||||
|
||||
$OptionParser.AddOption((New-Option "SQLTEMPDBDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "SQLTEMPDBLOGDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "SQLUSERDBDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "SQLUSERDBLOGDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "FILESTREAMLEVEL" -String -Constraints ("0", "1", "2", "3")))
|
||||
$OptionParser.AddOption((New-Option "FILESTREAMSHARENAME" -String))
|
||||
$OptionParser.AddOption((New-Option "FTSVCACCOUNT" -String))
|
||||
$OptionParser.AddOption((New-Option "FTSVCPASSWORD" -String))
|
||||
$OptionParser.AddOption((New-Option "ISSVCACCOUNT" -String), $true, "NT AUTHORITY\Network Service")
|
||||
$OptionParser.AddOption((New-Option "ISSVCPASSWORD" -String))
|
||||
$OptionParser.AddOption((New-Option "ISSVCStartupType" -String -Constraints ("Manual", "Automatic", "Disabled")))
|
||||
$OptionParser.AddOption((New-Option "NPENABLED" -Boolean))
|
||||
$OptionParser.AddOption((New-Option "TCPENABLED" -Boolean))
|
||||
$OptionParser.AddOption((New-Option "RSINSTALLMODE" -String -Constraints ("SharePointFilesOnlyMode", "DefaultNativeMode", "FilesOnlyMode")))
|
||||
$OptionParser.AddOption((New-Option "RSSVCACCOUNT" -String), $true, "NT AUTHORITY\Network Service")
|
||||
$OptionParser.AddOption((New-Option "RSSVCPASSWORD" -String))
|
||||
$OptionParser.AddOption((New-Option "RSSVCStartupType" -String -Constraints ("Manual", "Automatic", "Disabled")))
|
||||
|
||||
return $OptionParser
|
||||
}
|
||||
|
||||
function New-OptionParserPrepareImage {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creates an option parser for MS SQL Server 2012 setup "PrepareImage" action.
|
||||
|
||||
.DESCRIPTION
|
||||
Use this cmdlet to create an option parser for MS SQL Server 2012 setup "PrepareImage" action.
|
||||
|
||||
Note that for installer version of MS SQL Server prior to 2012 SP1 Cumulative Update 2 only the
|
||||
following features are supported: SQLEngine, Replication, FullText, RS
|
||||
|
||||
All documented option are supported. See the following link for details:
|
||||
http://msdn.microsoft.com/en-us/library/ms144259.aspx
|
||||
#>
|
||||
$OptionParser = New-OptionParser
|
||||
|
||||
$OptionParser.AddOption((New-Option "ACTION" -String -Constraints "PrepareImage"), $true, "PrepareImage")
|
||||
$OptionParser.AddOption((New-Option "IACCEPTSQLSERVERLICENSETERMS" -Switch), $true)
|
||||
$OptionParser.AddOption((New-Option "ENU" -Switch))
|
||||
$OptionParser.AddOption((New-Option "UpdateEnabled" -Switch))
|
||||
$OptionParser.AddOption((New-Option "UpdateSource" -String))
|
||||
$OptionParser.AddOption((New-Option "CONFIGURATIONFILE" -String))
|
||||
# $OptionParser.AddOption((New-Option "FEATURES" -List -Constraints ("SQLEngine","Replication","FullText","RS")))
|
||||
$OptionParser.AddOption((New-Option "FEATURES" -List -Constraints ("SQL","SQLEngine","Replication","FullText","DQ","AS","RS","DQC","IS","MDS","Tools","BC","BOL","BIDS","Conn","SSMS","ADV_SSMS","DREPLAY_CTLR","DREPLAY_CLT","SNAC_SDK","SDK","LocalDB")))
|
||||
$OptionParser.AddOption((New-Option "HIDECONSOLE" -Switch))
|
||||
$OptionParser.AddOption((New-Option "INDICATEPROGRESS" -Switch))
|
||||
$OptionParser.AddOption((New-Option "INSTALLSHAREDDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "INSTANCEDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "INSTANCEID" -String), $true, "MSSQLSERVER")
|
||||
$OptionParser.AddOption((New-Option "Q" -Switch))
|
||||
$OptionParser.AddOption((New-Option "QS" -Switch))
|
||||
|
||||
return $OptionParser
|
||||
}
|
||||
|
||||
function New-OptionParserPrepareImageSP1U2 {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creates an option parser for MS SQL Server 2012 setup "PrepareImage" action.
|
||||
|
||||
.DESCRIPTION
|
||||
Use this cmdlet to create an option parser for MS SQL Server 2012 setup "PrepareImage" action.
|
||||
|
||||
This cmdlet should be used only for MS SQL Server 2012 SP1 Cimilative Update 2 or later.
|
||||
|
||||
Note that for installer version of MS SQL Server prior to 2012 SP1 Cimilative Update 2 only the
|
||||
following features are supported: SQLEngine, Replication, FullText, RS
|
||||
|
||||
All documented option are supported. See the following link for details:
|
||||
http://msdn.microsoft.com/en-us/library/ms144259.aspx
|
||||
#>
|
||||
$OptionParser = New-OptionParser
|
||||
|
||||
$OptionParser.AddOption((New-Option "ACTION" -String -Constraints "PrepareImage"), $true, "PrepareImage")
|
||||
$OptionParser.AddOption((New-Option "IACCEPTSQLSERVERLICENSETERMS" -Switch), $true)
|
||||
$OptionParser.AddOption((New-Option "ENU" -Switch))
|
||||
$OptionParser.AddOption((New-Option "UpdateEnabled" -Switch))
|
||||
$OptionParser.AddOption((New-Option "UpdateSource" -String))
|
||||
$OptionParser.AddOption((New-Option "CONFIGURATIONFILE" -String))
|
||||
$OptionParser.AddOption((New-Option "FEATURES" -List -Constraints ("SQL","SQLEngine","Replication","FullText","DQ","AS","RS","DQC","IS","MDS","Tools","BC","BOL","BIDS","Conn","SSMS","ADV_SSMS","SNAC_SDK","SDK","LocalDB")))
|
||||
$OptionParser.AddOption((New-Option "HIDECONSOLE" -Switch))
|
||||
$OptionParser.AddOption((New-Option "INDICATEPROGRESS" -Switch))
|
||||
$OptionParser.AddOption((New-Option "INSTALLSHAREDDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "INSTANCEDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "INSTANCEID" -String), $true, "MSSQLSERVER")
|
||||
$OptionParser.AddOption((New-Option "Q" -Switch))
|
||||
$OptionParser.AddOption((New-Option "QS" -Switch))
|
||||
|
||||
return $OptionParser
|
||||
}
|
||||
|
||||
function New-OptionParserCompleteImage {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creates an option parser for MS SQL Server 2012 setup "CompleteImage" action.
|
||||
|
||||
.DESCRIPTION
|
||||
Use this cmdlet to create an option parser for MS SQL Server 2012 setup "CompleteImage" action.
|
||||
|
||||
Note that INSTANCEID parameter value MUST be the same as specified on "PrepareImage" phase.
|
||||
|
||||
All documented option are supported. See the following link for details:
|
||||
http://msdn.microsoft.com/en-us/library/ms144259.aspx
|
||||
#>
|
||||
$OptionParser = New-OptionParser
|
||||
|
||||
$OptionParser.AddOption((New-Option "ACTION" -String -Constraints "CompleteImage"), $true, "CompleteImage")
|
||||
$OptionParser.AddOption((New-Option "IACCEPTSQLSERVERLICENSETERMS" -Switch), $true)
|
||||
$OptionParser.AddOption((New-Option "ENU" -Switch))
|
||||
$OptionParser.AddOption((New-Option "CONFIGURATIONFILE" -String))
|
||||
$OptionParser.AddOption((New-Option "ERRORREPORTING" -Boolean))
|
||||
$OptionParser.AddOption((New-Option "INDICATEPROGRESS" -Switch))
|
||||
$OptionParser.AddOption((New-Option "INSTANCEID" -String), $true, "MSSQLSERVER")
|
||||
$OptionParser.AddOption((New-Option "INSTANCENAME" -String), $true, "MSSQLSERVER")
|
||||
$OptionParser.AddOption((New-Option "PID" -String))
|
||||
$OptionParser.AddOption((New-Option "Q" -Switch))
|
||||
$OptionParser.AddOption((New-Option "QS" -Switch))
|
||||
$OptionParser.AddOption((New-Option "SQMREPORTING" -Boolean))
|
||||
$OptionParser.AddOption((New-Option "HIDECONSOLE" -Switch))
|
||||
$OptionParser.AddOption((New-Option "AGTSVCACCOUNT" -String), $true, "NT AUTHORITY\Network Service")
|
||||
$OptionParser.AddOption((New-Option "AGTSVCPASSWORD" -String))
|
||||
$OptionParser.AddOption((New-Option "AGTSVCSTARTUPTYPE" -String -Constraints ("Manual", "Automatic", "Disabled")))
|
||||
$OptionParser.AddOption((New-Option "BROWSERSVCSTARTUPTYPE" -String -Constraints ("Manual", "Automatic", "Disabled")))
|
||||
$OptionParser.AddOption((New-Option "ENABLERANU" -Switch))
|
||||
$OptionParser.AddOption((New-Option "INSTALLSQLDATADIR" -String))
|
||||
$OptionParser.AddOption((New-Option "SAPWD" -String))
|
||||
$OptionParser.AddOption((New-Option "SECURITYMODE" -String -Constrainrs ("SQL")))
|
||||
$OptionParser.AddOption((New-Option "SQLBACKUPDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "SQLCOLLATION" -String))
|
||||
$OptionParser.AddOption((New-Option "SQLSVCACCOUNT" -String), $true, "NT AUTHORITY\Network Service")
|
||||
$OptionParser.AddOption((New-Option "SQLSVCPASSWORD" -String))
|
||||
$OptionParser.AddOption((New-Option "SQLSVCSTARTUPTYPE" -String -Constraints ("Manual", "Automatic", "Disabled")))
|
||||
$OptionParser.AddOption((New-Option "SQLSYSADMINACCOUNTS" -String), $true, "$ENV:USERDOMAIN\$ENV:USERNAME")
|
||||
$OptionParser.AddOption((New-Option "SQLTEMPDBDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "SQLTEMPDBLOGDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "SQLUSERDBDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "SQLUSERDBLOGDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "FILESTREAMLEVEL" -String -Constraints ("0", "1", "2", "3")))
|
||||
$OptionParser.AddOption((New-Option "FILESTREAMSHARENAME" -String))
|
||||
$OptionParser.AddOption((New-Option "FTSVCACCOUNT" -String))
|
||||
$OptionParser.AddOption((New-Option "FTSVCPASSWORD" -String))
|
||||
$OptionParser.AddOption((New-Option "NPENABLED" -Boolean))
|
||||
$OptionParser.AddOption((New-Option "TCPENABLED" -Boolean))
|
||||
$OptionParser.AddOption((New-Option "RSINSTALLMODE" -String -Constraints ("SharePointFilesOnlyMode", "DefaultNativeMode", "FilesOnlyMode")))
|
||||
$OptionParser.AddOption((New-Option "RSSVCACCOUNT" -String), $true, "NT AUTHORITY\Network Service")
|
||||
$OptionParser.AddOption((New-Option "RSSVCPASSWORD" -String))
|
||||
$OptionParser.AddOption((New-Option "RSSVCStartupType" -String -Constraints ("Manual", "Automatic", "Disabled")))
|
||||
|
||||
return $OptionParser
|
||||
}
|
||||
|
||||
function New-OptionParserCompleteImageSP1U2 {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creates an option parser for MS SQL Server 2012 setup "CompleteImage" action.
|
||||
|
||||
.DESCRIPTION
|
||||
Use this cmdlet to create an option parser for MS SQL Server 2012 setup "CompleteImage" action.
|
||||
|
||||
This cmdlet should be used only for MS SQL Server 2012 SP1 Cimilative Update 2 or later.
|
||||
|
||||
All documented option are supported. See the following link for details:
|
||||
http://msdn.microsoft.com/en-us/library/ms144259.aspx
|
||||
#>
|
||||
$OptionParser = New-OptionParser
|
||||
|
||||
$OptionParser.AddOption((New-Option "ACTION" -String -Constraints "CompleteImage"), $true, "CompleteImage")
|
||||
$OptionParser.AddOption((New-Option "IACCEPTSQLSERVERLICENSETERMS" -Switch), $true)
|
||||
$OptionParser.AddOption((New-Option "ENU" -Switch))
|
||||
$OptionParser.AddOption((New-Option "CONFIGURATIONFILE" -String))
|
||||
$OptionParser.AddOption((New-Option "ERRORREPORTING" -Boolean))
|
||||
$OptionParser.AddOption((New-Option "INDICATEPROGRESS" -Switch))
|
||||
$OptionParser.AddOption((New-Option "INSTANCEID" -String))
|
||||
$OptionParser.AddOption((New-Option "INSTANCENAME" -String))
|
||||
$OptionParser.AddOption((New-Option "PID" -String))
|
||||
$OptionParser.AddOption((New-Option "Q" -Switch))
|
||||
$OptionParser.AddOption((New-Option "QS" -Switch))
|
||||
$OptionParser.AddOption((New-Option "SQMREPORTING" -Boolean))
|
||||
$OptionParser.AddOption((New-Option "HIDECONSOLE" -Switch))
|
||||
$OptionParser.AddOption((New-Option "AGTSVCACCOUNT" -String), $true, "NT AUTHORITY\Network Service")
|
||||
$OptionParser.AddOption((New-Option "AGTSVCPASSWORD" -String))
|
||||
$OptionParser.AddOption((New-Option "AGTSVCSTARTUPTYPE" -String -Constraints ("Manual", "Automatic", "Disabled")))
|
||||
$OptionParser.AddOption((New-Option "BROWSERSVCSTARTUPTYPE" -String -Constraints ("Manual", "Automatic", "Disabled")))
|
||||
$OptionParser.AddOption((New-Option "ENABLERANU" -Switch))
|
||||
$OptionParser.AddOption((New-Option "INSTALLSQLDATADIR" -String))
|
||||
$OptionParser.AddOption((New-Option "SAPWD" -String))
|
||||
$OptionParser.AddOption((New-Option "SECURITYMODE" -String -Constrainrs ("SQL")))
|
||||
$OptionParser.AddOption((New-Option "SQLBACKUPDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "SQLCOLLATION" -String))
|
||||
$OptionParser.AddOption((New-Option "SQLSVCACCOUNT" -String), $true, "NT AUTHORITY\Network Service")
|
||||
$OptionParser.AddOption((New-Option "SQLSVCPASSWORD" -String))
|
||||
$OptionParser.AddOption((New-Option "SQLSVCSTARTUPTYPE" -String -Constraints ("Manual", "Automatic", "Disabled")))
|
||||
$OptionParser.AddOption((New-Option "SQLSYSADMINACCOUNTS" -String), $true, "$ENV:USERDOMAIN\$ENV:USERNAME")
|
||||
$OptionParser.AddOption((New-Option "SQLTEMPDBDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "SQLTEMPDBLOGDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "SQLUSERDBDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "SQLUSERDBLOGDIR" -String))
|
||||
$OptionParser.AddOption((New-Option "FILESTREAMLEVEL" -String -Constraints ("0", "1", "2", "3")))
|
||||
$OptionParser.AddOption((New-Option "FILESTREAMSHARENAME" -String))
|
||||
$OptionParser.AddOption((New-Option "FTSVCACCOUNT" -String))
|
||||
$OptionParser.AddOption((New-Option "FTSVCPASSWORD" -String))
|
||||
$OptionParser.AddOption((New-Option "NPENABLED" -Boolean))
|
||||
$OptionParser.AddOption((New-Option "TCPENABLED" -Boolean))
|
||||
$OptionParser.AddOption((New-Option "RSINSTALLMODE" -String -Constraints ("SharePointFilesOnlyMode", "DefaultNativeMode", "FilesOnlyMode")))
|
||||
$OptionParser.AddOption((New-Option "RSSVCACCOUNT" -String), $true, "NT AUTHORITY\Network Service")
|
||||
$OptionParser.AddOption((New-Option "RSSVCPASSWORD" -String))
|
||||
$OptionParser.AddOption((New-Option "RSSVCStartupType" -String -Constraints ("Manual", "Automatic", "Disabled")))
|
||||
|
||||
return $OptionParser
|
||||
}
|
||||
|
||||
function New-OptionParserUpgrade {
|
||||
# ToDo: Implement
|
||||
throw "Not yet implemented"
|
||||
}
|
||||
|
||||
function New-OptionParserEditionUpgrade {
|
||||
# ToDo: Implement
|
||||
throw "Not yet implemented"
|
||||
}
|
||||
|
||||
function New-OptionParserRepair {
|
||||
# ToDo: Implement
|
||||
throw "Not yet implemented"
|
||||
}
|
||||
|
||||
function New-OptionParserRebuilddatabase {
|
||||
# ToDo: Implement
|
||||
throw "Not yet implemented"
|
||||
}
|
||||
|
||||
function New-OptionParserUninstall {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creates an option parser for MS SQL Server 2012 setup "INSTALL" action.
|
||||
|
||||
.DESCRIPTION
|
||||
Use this cmdlet to create an option parser for MS SQL Server 2012 setup "INSTALL" action.
|
||||
All documented option are supported. See the following link for details:
|
||||
http://msdn.microsoft.com/en-us/library/ms144259.aspx
|
||||
#>
|
||||
$OptionParser = New-OptionParser
|
||||
|
||||
$OptionParser.AddOption((New-Option "ACTION" -String -Constraints "UNINSTALL"), $true, "UNINSTALL")
|
||||
$OptionParser.AddOption((New-Option "CONFIGURATIONFILE" -String))
|
||||
$OptionParser.AddOption((New-Option "FEATURES" -List -Constraints ("SQL","SQLEngine","Replication","FullText","DQ","AS","RS","DQC","IS","MDS","Tools","BC","BOL","BIDS","Conn","SSMS","ADV_SSMS","DREPLAY_CTLR","DREPLAY_CLT","SNAC_SDK","SDK","LocalDB")), $true)
|
||||
$OptionParser.AddOption((New-Option "INDICATEPROGRESS" -Switch))
|
||||
$OptionParser.AddOption((New-Option "INSTANCENAME" -String), $true, "MSSQLSERVER")
|
||||
$OptionParser.AddOption((New-Option "Q" -Switch))
|
||||
$OptionParser.AddOption((New-Option "HIDECONSOLE" -Switch))
|
||||
|
||||
return $OptionParser
|
||||
}
|
||||
|
||||
function New-OptionParserInstallFailoverCluster {
|
||||
# ToDo: Implement
|
||||
throw "Not yet implemented"
|
||||
}
|
||||
|
||||
function New-OptionParserPrepareFailoverCluster {
|
||||
# ToDo: Implement
|
||||
throw "Not yet implemented"
|
||||
}
|
||||
|
||||
function New-OptionParserCompleteFailoverCluster {
|
||||
# ToDo: Implement
|
||||
throw "Not yet implemented"
|
||||
}
|
||||
|
||||
function New-OptionParserUpgrade {
|
||||
# ToDo: Implement
|
||||
throw "Not yet implemented"
|
||||
}
|
||||
|
||||
function New-OptionParserAddNode {
|
||||
# ToDo: Implement
|
||||
throw "Not yet implemented"
|
||||
}
|
||||
|
||||
function New-OptionParserRemoveNode {
|
||||
# ToDo: Implement
|
||||
throw "Not yet implemented"
|
||||
}
|
|
@ -1,151 +0,0 @@
|
|||
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Select-CliXmlBlock {
|
||||
param (
|
||||
[String] $Path,
|
||||
[String] $OutFile = [IO.Path]::GetTempFileName()
|
||||
)
|
||||
|
||||
$TagFound = $false
|
||||
Get-Content $Path |
|
||||
ForEach-Object {
|
||||
if ($_ -eq '#< CLIXML') {
|
||||
$TagFound = $true
|
||||
}
|
||||
if ($TagFound) {
|
||||
Add-Content -Path $OutFile -Value $_
|
||||
}
|
||||
}
|
||||
$OutFile
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Start-PowerShellProcess {
|
||||
param (
|
||||
[String] $Command,
|
||||
$Credential = $null,
|
||||
[Switch] $IgnoreStdErr,
|
||||
[Switch] $NoBase64
|
||||
)
|
||||
begin {
|
||||
Show-InvocationInfo $MyInvocation
|
||||
}
|
||||
end {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
$StdOut = [IO.Path]::GetTempFileName()
|
||||
$StdErr = [IO.Path]::GetTempFileName()
|
||||
|
||||
$ArgumentList = @('-OutputFormat', 'XML')
|
||||
|
||||
if ($NoBase64) {
|
||||
$TmpScript = [IO.Path]::GetTempFileName()
|
||||
Rename-Item -Path "$TmpScript" -NewName "$TmpScript.ps1" -Force
|
||||
$TmpScript = "$TmpScript.ps1"
|
||||
|
||||
Write-LogDebug $TmpScript
|
||||
|
||||
$Command | Out-File $TmpScript
|
||||
|
||||
$ArgumentList += @('-File', "$TmpScript")
|
||||
}
|
||||
else {
|
||||
$Bytes = [Text.Encoding]::Unicode.GetBytes($Command)
|
||||
$EncodedCommand = [Convert]::ToBase64String($Bytes)
|
||||
|
||||
Write-LogDebug $EncodedCommand
|
||||
|
||||
$ArgumentList += @('-EncodedCommand', $EncodedCommand)
|
||||
}
|
||||
|
||||
Write-LogDebug $ArgumentList
|
||||
|
||||
Write-Log "Starting external PowerShell process ..."
|
||||
|
||||
if ($Credential -eq $null) {
|
||||
$Process = Start-Process -FilePath 'powershell.exe' `
|
||||
-ArgumentList @($ArgumentList) `
|
||||
-RedirectStandardOutput $StdOut `
|
||||
-RedirectStandardError $StdErr `
|
||||
-NoNewWindow `
|
||||
-Wait `
|
||||
-PassThru
|
||||
}
|
||||
else {
|
||||
$Process = Start-Process -FilePath 'powershell.exe' `
|
||||
-ArgumentList @($ArgumentList) `
|
||||
-RedirectStandardOutput $StdOut `
|
||||
-RedirectStandardError $StdErr `
|
||||
-Credential $Credential `
|
||||
-NoNewWindow `
|
||||
-Wait `
|
||||
-PassThru
|
||||
}
|
||||
|
||||
Write-Log "External PowerShell process exited with exit code '$($Process.ExitCode)'."
|
||||
|
||||
#if ($ArgumentList -contains '-File') {
|
||||
# Remove-Item -Path $TmpScript -Force
|
||||
#}
|
||||
|
||||
$ErrorActionPreferenceSaved = $ErrorActionPreference
|
||||
$ErrorActionPreference = 'SilentlyContinue'
|
||||
|
||||
Write-LogDebug "StdOut file is '$StdOut'"
|
||||
Write-LogDebug "StdErr file is '$StdErr'"
|
||||
|
||||
if ((Get-Item $StdOut).Length -gt 0) {
|
||||
try {
|
||||
Write-LogDebug "Loading StdOut from '$StdOut'"
|
||||
$TmpFile = Select-CliXmlBlock $StdOut
|
||||
$StdOutObject = Import-Clixml $TmpFile
|
||||
Write-LogDebug "<StdOut>"
|
||||
Write-LogDebug ($StdOutObject)
|
||||
Write-LogDebug "</StdOut>"
|
||||
$StdOutObject
|
||||
#Remove-Item -Path $TmpFile -Force
|
||||
}
|
||||
catch {
|
||||
Write-LogDebug "An error occured while loading StdOut from '$TmpFile'"
|
||||
}
|
||||
}
|
||||
|
||||
if ((Get-Item $StdErr).Length -gt 0) {
|
||||
try {
|
||||
Write-LogDebug "Loading StdErr ..."
|
||||
$TmpFile = Select-CliXmlBlock $StdErr
|
||||
$StdErrObject = Import-Clixml $TmpFile
|
||||
Write-LogDebug "<StdErr>"
|
||||
Write-LogDebug ($StdErrObject)
|
||||
Write-LogDebug "</StdErr>"
|
||||
if (-not $IgnoreStdErr) {
|
||||
$StdErrObject
|
||||
}
|
||||
#Remove-Item -Path $TmpFile -Force
|
||||
}
|
||||
catch {
|
||||
Write-LogDebug "An error occured while loading StdErr from '$TmpFile'"
|
||||
}
|
||||
}
|
||||
|
||||
$ErrorActionPreference = $ErrorActionPreferenceSaved
|
||||
|
||||
if ($Process.ExitCode -ne 0) {
|
||||
throw("External PowerShell process exited with code '$($Process.ExitCode)'")
|
||||
}
|
||||
|
||||
#Remove-Item $StdOut -Force
|
||||
#Remove-Item $StdErr -Force
|
||||
}
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Update-ServiceConfig {
|
||||
param (
|
||||
[String] $Name,
|
||||
[String] $RunAsUser = '',
|
||||
[String] $DomainName = '.',
|
||||
[String] $Password = '',
|
||||
[Switch] $RunAsLocalService
|
||||
)
|
||||
begin {
|
||||
Show-InvocationInfo $MyInvocation
|
||||
}
|
||||
end {
|
||||
Show-InvocationInfo $MyInvocation -End
|
||||
}
|
||||
process {
|
||||
trap {
|
||||
&$TrapHandler
|
||||
}
|
||||
|
||||
$ArgumentList = @('config', "`"$Name`"")
|
||||
|
||||
if ($RunAsLocalService) {
|
||||
$ArgumentList += @("obj=", "`"NT AUTHORITY\LocalService`"")
|
||||
}
|
||||
elseif ($RunAsUser -ne '') {
|
||||
$ArgumentList += @("obj=", "`"$DomainName\$RunAsUser`"", "password=", "`"$Password`"")
|
||||
}
|
||||
|
||||
$Process = Exec 'sc.exe' $ArgumentList -PassThru -RedirectStreams
|
||||
|
||||
if ($Process.ExitCode -ne 0) {
|
||||
throw "Command 'sc.exe' returned exit code '$($Process.ExitCode)'"
|
||||
}
|
||||
|
||||
$NtRights = "C:\Murano\Tools\ntrights.exe"
|
||||
|
||||
if (-not ([IO.File]::Exists($NtRights))) {
|
||||
throw "File '$NtRights' not found."
|
||||
}
|
||||
|
||||
$Process = Exec $NtRights @('-u', "$DomainName\$RunAsUser", '+r', 'SeServiceLogonRight') -RedirectStreams -PassThru
|
||||
|
||||
if ($Process.ExitCode -ne 0) {
|
||||
throw "Command '$NtRights' returned exit code '$($Process.ExitCode)'"
|
||||
}
|
||||
|
||||
$Process = Exec $NtRights @('-u', "$DomainName\$RunAsUser", '+r', 'SeBatchLogonRight') -RedirectStreams -PassThru
|
||||
|
||||
if ($Process.ExitCode -ne 0) {
|
||||
throw "Command '$NtRights' returned exit code '$($Process.ExitCode)'"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
|
||||
function Write-InvocationInfo {
|
||||
param (
|
||||
$Invocation,
|
||||
[Switch] $End
|
||||
)
|
||||
|
||||
if ($End) {
|
||||
Write-LogDebug "</function name='$($Invocation.MyCommand.Name)'>"
|
||||
}
|
||||
else {
|
||||
Write-LogDebug "<function name='$($Invocation.MyCommand.Name)'>"
|
||||
Write-LogDebug "<param>"
|
||||
foreach ($Parameter in $Invocation.MyCommand.Parameters) {
|
||||
foreach ($Key in $Parameter.Keys) {
|
||||
$Type = $Parameter[$Key].ParameterType.FullName
|
||||
foreach ($Value in $Invocation.BoundParameters[$Key]) {
|
||||
Write-LogDebug "[$Type] $Key = '$Value'"
|
||||
}
|
||||
}
|
||||
}
|
||||
Write-LogDebug "</param>"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
|
||||
.PHONY : all
|
||||
.PHONY : force
|
||||
.PHONY : usage
|
||||
.PHONY : module-list
|
||||
|
||||
|
||||
module_dir := Modules
|
||||
module_list := $(shell find Modules -maxdepth 1 -type d -printf "%P ")
|
||||
module_name :=
|
||||
|
||||
|
||||
usage :
|
||||
@echo "Available targets:"
|
||||
@echo "* all - make all modules"
|
||||
@echo "* module-list - lists all modules under '${module_dir}'"
|
||||
@echo "* <module name> - build module named <module name>"
|
||||
|
||||
|
||||
module-list :
|
||||
@echo "Available modules:"
|
||||
@for name in ${module_list} ; do \
|
||||
echo "* $$name"; \
|
||||
done
|
||||
@echo ""
|
||||
|
||||
|
||||
ifndef module_name
|
||||
|
||||
all : ${module_list}
|
||||
|
||||
|
||||
${module_list} :
|
||||
@echo ''
|
||||
@echo 'Calling make recurcievely ...'
|
||||
$(MAKE) -e module_name=$@ $@
|
||||
|
||||
else
|
||||
|
||||
${module_name} : ${module_name}.zip
|
||||
|
||||
|
||||
${module_name}.zip : ${module_dir}/${module_name}.content
|
||||
@echo ''
|
||||
@echo "Zipping module '${module_name}' ..."
|
||||
-rm -f $@
|
||||
cd ${module_dir} && zip -r $@ ${module_name}
|
||||
mv ${module_dir}/$@ ${CURDIR}
|
||||
|
||||
|
||||
${module_dir}/${module_name}.content : force
|
||||
@echo ""
|
||||
@echo "Generating file list for module '${module_name}' ..."
|
||||
cd ${module_dir} && find ${module_name} > $(@F).tmp
|
||||
[ -f $@ ] || cp $@.tmp $@
|
||||
cmp -s $@ $@.tmp || cp $@.tmp $@
|
||||
rm $@.tmp
|
||||
|
||||
endif
|
||||
|
||||
|
||||
clean :
|
||||
@echo ''
|
||||
@echo 'Cleaning temporary files ...'
|
||||
rm -f ${module_dir}/*.content
|
||||
rm -f ${module_dir}/*.content.tmp
|
||||
rm -f *.zip
|
||||
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
<#
|
||||
Naming convention:
|
||||
|
||||
== Normal variables
|
||||
** Set: $NormalVar = 123
|
||||
** Get: Write-Host $NormalVar
|
||||
|
||||
== Script-scope variables
|
||||
** Set: $script:__ScriptScopeVar = 123
|
||||
** Get: Write-Host $__ScriptScopeVar
|
||||
|
||||
== Global-scope variables
|
||||
** Set: $global:__GlobalScopeVar__ = 123
|
||||
** Get: Write-Host $__GlobalScopeVar__
|
||||
#>
|
||||
|
||||
$script:__ModulePath = $PsScriptRoot
|
||||
$script:__ModuleName = $PsScriptRoot.Split("\")[-1]
|
||||
$script:__DefaultLogPath = [IO.Path]::Combine([IO.Path]::GetTempPath(), "PowerShell_$__ModuleName.log")
|
||||
|
||||
|
||||
$script:__RequiredModules = @("ServerManager", "DnsClient")
|
||||
$script:__ImportModulesExplicitely = $true
|
||||
$script:__ImportModulesErrorAction = "Stop"
|
||||
|
||||
|
||||
$global:__StopExecutionPreference__ = "Exit"
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
#
|
||||
# Module manifest for module 'ScriptingFunctions'
|
||||
#
|
||||
# Generated by: Administrator
|
||||
#
|
||||
# Generated on: 1/17/2013
|
||||
#
|
||||
|
||||
@{
|
||||
|
||||
# Script module or binary module file associated with this manifest.
|
||||
RootModule = 'CoreFunctions.psm1'
|
||||
|
||||
# Version number of this module.
|
||||
ModuleVersion = '1.0'
|
||||
|
||||
# ID used to uniquely identify this module
|
||||
GUID = '5077eaf5-69f7-4f29-96d0-b06646c112b6'
|
||||
|
||||
# Author of this module
|
||||
Author = 'Dmitry Teselkin'
|
||||
|
||||
# Company or vendor of this module
|
||||
CompanyName = 'Mirantis'
|
||||
|
||||
# Copyright statement for this module
|
||||
Copyright = '(c) 2013 Mirantis. All rights reserved.'
|
||||
|
||||
# Description of the functionality provided by this module
|
||||
# Description = ''
|
||||
|
||||
# Minimum version of the Windows PowerShell engine required by this module
|
||||
# PowerShellVersion = ''
|
||||
|
||||
# Name of the Windows PowerShell host required by this module
|
||||
# PowerShellHostName = ''
|
||||
|
||||
# Minimum version of the Windows PowerShell host required by this module
|
||||
# PowerShellHostVersion = ''
|
||||
|
||||
# Minimum version of the .NET Framework required by this module
|
||||
# DotNetFrameworkVersion = ''
|
||||
|
||||
# Minimum version of the common language runtime (CLR) required by this module
|
||||
# CLRVersion = ''
|
||||
|
||||
# Processor architecture (None, X86, Amd64) required by this module
|
||||
# ProcessorArchitecture = ''
|
||||
|
||||
# Modules that must be imported into the global environment prior to importing this module
|
||||
# RequiredModules = @()
|
||||
|
||||
# Assemblies that must be loaded prior to importing this module
|
||||
# RequiredAssemblies = @()
|
||||
|
||||
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
|
||||
# ScriptsToProcess = @()
|
||||
|
||||
# Type files (.ps1xml) to be loaded when importing this module
|
||||
# TypesToProcess = @()
|
||||
|
||||
# Format files (.ps1xml) to be loaded when importing this module
|
||||
# FormatsToProcess = @()
|
||||
|
||||
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
|
||||
# NestedModules = @()
|
||||
|
||||
# Functions to export from this module
|
||||
FunctionsToExport = '*'
|
||||
|
||||
# Cmdlets to export from this module
|
||||
CmdletsToExport = '*'
|
||||
|
||||
# Variables to export from this module
|
||||
VariablesToExport = '*'
|
||||
|
||||
# Aliases to export from this module
|
||||
AliasesToExport = '*'
|
||||
|
||||
# List of all modules packaged with this module.
|
||||
# ModuleList = @()
|
||||
|
||||
# List of all files packaged with this module
|
||||
# FileList = @()
|
||||
|
||||
# Private data to pass to the module specified in RootModule/ModuleToProcess
|
||||
# PrivateData = ''
|
||||
|
||||
# HelpInfo URI of this module
|
||||
# HelpInfoURI = ''
|
||||
|
||||
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
|
||||
# DefaultCommandPrefix = ''
|
||||
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
# Import config first
|
||||
. "$PsScriptRoot\Config.ps1"
|
||||
|
||||
# Import functions from 'Include' subfolder
|
||||
Get-ChildItem "$PsScriptRoot\Include" -Filter "*.ps1" |
|
||||
ForEach-Object {
|
||||
. "$($_.FullName)"
|
||||
}
|
||||
|
||||
trap { Stop-Execution $_ }
|
||||
|
||||
Export-ModuleMember -Function * -Alias *
|
||||
|
||||
<#
|
||||
if ($__ImportModulesExplicitely) {
|
||||
foreach ($Module in $__RequiredModules) {
|
||||
Write-Log "Importing module '$Module' ..."
|
||||
Import-Module -Name "$Module" -ErrorAction "$__ImportModulesErrorAction"
|
||||
}
|
||||
}
|
||||
#>
|
||||
|
||||
Write-Log "Module loaded from '$PsScriptRoot'"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
switch ($Args[0]) {
|
||||
'installTo' {
|
||||
Install-Module -InstallPath $args[1] -ModulePath $PsScriptRoot
|
||||
}
|
||||
'register' {
|
||||
Register-Module "$PsScriptRoot"
|
||||
}
|
||||
default {
|
||||
}
|
||||
}
|
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue