├── .gitignore ├── README.md ├── bin └── run.ps1 ├── build_golden.yml ├── create_vm.yml ├── delete_vm.yml ├── files ├── App_Data │ ├── Logs │ │ ├── orchard-debug-2017.12.15.log │ │ ├── orchard-error-2017.12.15.log │ │ └── orchard-recipes-2017.12.15.log │ ├── Sites │ │ └── Default │ │ │ ├── Settings.txt.orig │ │ │ └── mappings.bin │ ├── cache.dat │ └── hrestart.txt └── db.bak ├── group_vars ├── all.yml ├── db.yml └── web.yml ├── hosts ├── library ├── win_hyperv_guest.ps1 ├── win_hyperv_guest.py ├── win_hyperv_guest_config_net.ps1 ├── win_hyperv_guest_config_net.py └── win_mssql_database.ps1 ├── prov_web_db.yml ├── roles ├── mssqlexpress │ ├── defaults │ │ └── main.yml │ ├── tasks │ │ └── main.yml │ └── templates │ │ └── install_mssql.ps1.j2 └── orchard_cms │ ├── defaults │ └── main.yml │ ├── meta │ └── main.yml │ └── tasks │ ├── main.yml │ ├── orchard-install.yml │ ├── orchard-upgrade.yml │ └── preflight.yml ├── tasks └── prov_vm.yml ├── templates ├── Settings.txt.j2 ├── create_mssql_user.j2 └── restore_db.j2 ├── test_vault.yml ├── vars ├── gold.yml ├── sample-vault.yml ├── sit1.yml ├── test-clean.yml └── test.yml └── win_ping.yml /.gitignore: -------------------------------------------------------------------------------- 1 | *.exe 2 | *.retry 3 | *.log 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | This is heavily inspired by [glenndehaan](https://github.com/glenndehaan/ansible-win_hyperv_guest)'s original code to provision a vm on HyperV. 4 | 5 | The code has been modified to provision VMs by: 6 | * Cloning a disk 7 | * Setting up the IP 8 | * Powering on the VM 9 | * Wait for WinRM port to be available 10 | 11 | The configuration is stored as an environment yaml file, such as `vars/sit.yml`. This is meant to allow the user to define the environments such as DEV/UAT/SIT and its associated network information for each vm. 12 | 13 | # Requirements 14 | 15 | * Win2012R2 vhd image with WinRM enabled. You can use Ansible's [ConfigureRemotingForAnsible.ps1](https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1) 16 | * MS SQL 2014 Express installer. 17 | * .Net Framework >= 4.0, if you want to run OrchardCMS, inclduding the setup.exe 18 | * OrchardCMS is downloaded from github releases 19 | 20 | # Playbooks 21 | 22 | ## Creation of VM 23 | There is a sample `create_vm.yml` playbook: 24 | * Provision a sit environment with 2 VMS and create the necessary groups: web and db 25 | * Configure static ips 26 | * `wait_for` WinRM is up before exiting 27 | 28 | ## Building Golden Template 29 | 30 | The playbook `build_golden.yml` is use to install the necessary software using roles. After building the image, you can then use the vhd in your environment yaml file. 31 | 32 | ## Deploying Application 33 | 34 | `prov_web_db.yml` is to provision the sample `App_Data` and restore a database from a backup from templates. The roles to install the IIS and MS-SQL have been disabled by default. 35 | 36 | ## Deleting the VMs 37 | 38 | Use `delete_vm.yml` to delete the vms and clean out the disk. 39 | 40 | # Running the playbook 41 | 42 | You can change enviornment by either editing the `var/` yaml files or using `-e` option in the command line. 43 | 44 | Ansible Tower can also be used by using a survey form. 45 | 46 | # Script 47 | 48 | There is a `bin/run.ps1` sample script that calls Ansible Tower API to launch the Job Teamplate and monitor the job till it exits. 49 | 50 | # Credits 51 | 52 | The various roles and PowerShell scripts are adopted from: 53 | 54 | * https://github.com/bennojoy/ansible-win-sql2014-express 55 | * https://github.com/glenndehaan/ansible-win_hyperv_guest 56 | * https://github.com/nitzmahone/orchard_cms 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /bin/run.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | 3 | $hostname="192.168.0.208" 4 | $user = "admin" 5 | $pass= "system" 6 | 7 | function Launch-JobTemplate([string]$env) { 8 | 9 | $url="https://$hostname/api/v2/job_templates/$template_id/launch/" 10 | 11 | $pair = "$($user):$($pass)" 12 | $encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair)) 13 | $basicAuthValue = "Basic $encodedCreds" 14 | $headers = @{ Authorization = $basicAuthValue } 15 | 16 | $extra_vars = @{ 17 | extra_vars = (ConvertTo-Json(@{env=$env})) 18 | } 19 | 20 | $responseData = Invoke-WebRequest -Uri $url -Method Post -Headers $headers -Body (ConvertTo-Json $extra_vars) -ContentType "application/json" -SkipCertificateCheck #-UseBasicParsing 21 | $data = $responseData | ConvertFrom-Json 22 | 23 | $job_url = $data.url 24 | $poll_url = "https://$hostname$job_url" 25 | $status = $data.status 26 | $name = $data.name 27 | Write-Host "JOB NAME=$name JOB URL=$poll_url" 28 | 29 | # new: New 30 | # pending: Pending 31 | # waiting: Waiting 32 | # running: Running 33 | # successful: Successful 34 | # failed: Failed 35 | # error: Error 36 | # canceled: Canceled 37 | 38 | $exit_states = "new", "pending", "waiting", "running" 39 | 40 | while ($exit_states -contains $status) { 41 | $responseData = Invoke-WebRequest -Uri $poll_url -Method Get -Headers $headers -SkipCertificateCheck #-UseBasicParsing 42 | $status = ($responseData | ConvertFrom-Json).status 43 | Write-Host "Job Status = $status" 44 | Start-Sleep -s 1 45 | } 46 | } 47 | 48 | $template_id = Read-Host -Prompt 'Enter template id (7=create_vm, 9=prov_web_db, 10=win_ping)' 49 | Launch-JobTemplate -env "test" 50 | 51 | -------------------------------------------------------------------------------- /build_golden.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Provision VM 3 | hosts: b07.lab.ltsai.com 4 | gather_facts: no 5 | 6 | tasks: 7 | - import_tasks: tasks/prov_vm.yml 8 | 9 | - name: Setup MS SQL 2014 Express 10 | hosts: db 11 | 12 | roles: 13 | - mssqlexpress 14 | 15 | - name: Install OrchardCMS 16 | hosts: web 17 | 18 | roles: 19 | - orchard_cms 20 | 21 | - name: Poweroff VM 22 | hosts: b07.lab.ltsai.com 23 | gather_facts: no 24 | 25 | tasks: 26 | - name: Poweroff VMs 27 | win_hyperv_guest: 28 | name: "{{item.name}}" 29 | state: stopped 30 | with_items: "{{ vms }}" 31 | 32 | -------------------------------------------------------------------------------- /create_vm.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Provision VM 3 | hosts: b07.lab.ltsai.com 4 | gather_facts: no 5 | 6 | tasks: 7 | - import_tasks: tasks/prov_vm.yml 8 | -------------------------------------------------------------------------------- /delete_vm.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Delete VM 3 | hosts: b07.lab.ltsai.com 4 | gather_facts: no 5 | 6 | tasks: 7 | - name: Include vm env var 8 | include_vars: 9 | file: "{{env}}.yml" 10 | 11 | - name: Poweroff VMs 12 | win_hyperv_guest: 13 | name: "{{item.name}}" 14 | state: poweroff 15 | with_items: "{{ vms }}" 16 | 17 | - name: Delete VMs 18 | win_hyperv_guest: 19 | name: "{{item.name}}" 20 | state: absent 21 | with_items: "{{ vms }}" 22 | 23 | - name: Remove vhd 24 | win_file: 25 | path: "{{item.dest_vhd}}" 26 | state: absent 27 | with_items: "{{ vms }}" 28 | -------------------------------------------------------------------------------- /files/App_Data/Logs/orchard-debug-2017.12.15.log: -------------------------------------------------------------------------------- 1 | 2017-12-15 11:02:18,898 [1] NHibernate.Transaction.AdoTransaction - (null) - ERROR Begin transaction failed 2 | System.Data.SqlClient.SqlException (0x80131904): Login failed for user 'NewAdminName'. 3 | at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) 4 | at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) 5 | at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) 6 | at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) 7 | at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) 8 | at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) 9 | at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) 10 | at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) 11 | at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData) 12 | at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) 13 | at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) 14 | at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) 15 | at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) 16 | at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) 17 | at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) 18 | at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) 19 | at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) 20 | at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) 21 | at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) 22 | at System.Data.SqlClient.SqlConnection.Open() 23 | at NHibernate.Connection.DriverConnectionProvider.GetConnection() 24 | at NHibernate.AdoNet.ConnectionManager.GetConnection() 25 | at NHibernate.Transaction.AdoTransaction.Begin(IsolationLevel isolationLevel) 26 | ClientConnectionId:061f9510-637b-4237-bcf7-4d4f458239d4 27 | Error Number:18456,State:1,Class:14 28 | 2017-12-15 11:02:19,117 [1] NHibernate.Transaction.AdoTransaction - (null) - ERROR Begin transaction failed 29 | System.Data.SqlClient.SqlException (0x80131904): Login failed for user 'NewAdminName'. 30 | at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) 31 | at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) 32 | at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) 33 | at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) 34 | at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) 35 | at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) 36 | at System.Data.SqlClient.SqlConnection.Open() 37 | at NHibernate.Connection.DriverConnectionProvider.GetConnection() 38 | at NHibernate.AdoNet.ConnectionManager.GetConnection() 39 | at NHibernate.Transaction.AdoTransaction.Begin(IsolationLevel isolationLevel) 40 | ClientConnectionId:061f9510-637b-4237-bcf7-4d4f458239d4 41 | Error Number:18456,State:1,Class:14 42 | 2017-12-15 11:03:02,599 [1] Orchard.Recipes.Services.RecipeManager - (null) - INFO Executing recipe 'Default'. 43 | 2017-12-15 11:03:02,615 [1] Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Enqueuing recipe step 'Feature'. 44 | 2017-12-15 11:03:02,646 [1] Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Enqueuing recipe step 'ContentDefinition'. 45 | 2017-12-15 11:03:02,646 [1] Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Enqueuing recipe step 'Settings'. 46 | 2017-12-15 11:03:02,646 [1] Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Enqueuing recipe step 'Migration'. 47 | 2017-12-15 11:03:02,646 [1] Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Enqueuing recipe step 'Command'. 48 | 2017-12-15 11:03:02,678 [1] Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Enqueuing recipe step 'ActivateShell'. 49 | 2017-12-15 11:03:02,974 [1] Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe steps. 50 | 2017-12-15 11:03:02,990 [1] Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe step 'Feature'. 51 | 2017-12-15 11:03:02,990 [1] Orchard.Recipes.Services.RecipeStepExecutor - (null) - INFO Executing recipe step 'Feature'. 52 | 2017-12-15 11:03:03,006 [1] Orchard.Recipes.Providers.RecipeHandlers.RecipeExecutionStepHandler - (null) - INFO Executing recipe step 'Feature'. 53 | 2017-12-15 11:03:03,021 [1] Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO FeatureStep: Enabling features: Orchard.Blogs;Orchard.Comments;Orchard.Tags;Orchard.Alias;Orchard.Autoroute;TinyMce;Orchard.MediaLibrary;Orchard.ContentPicker;Orchard.PublishLater;Orchard.Resources;Orchard.Widgets;Orchard.ContentTypes;Orchard.Scripting;Orchard.Scripting.Lightweight;PackagingServices;Orchard.Packaging;Orchard.Projections;Orchard.Fields;Orchard.OutputCache;Orchard.Taxonomies;Orchard.Workflows;Orchard.Layouts;Orchard.Layouts.Tokens;TheThemeMachine 54 | 2017-12-15 11:03:03,381 [1] Orchard.Recipes.Providers.RecipeHandlers.RecipeExecutionStepHandler - (null) - INFO Finished executing recipe step 'Feature'. 55 | 2017-12-15 11:03:03,506 [1] Orchard.Recipes.Services.RecipeScheduler - (null) - INFO Scheduling next step of recipe. 56 | 2017-12-15 11:03:09,990 [1] Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe steps. 57 | 2017-12-15 11:03:09,990 [1] Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe step 'ContentDefinition'. 58 | 2017-12-15 11:03:09,990 [1] Orchard.Recipes.Services.RecipeStepExecutor - (null) - INFO Executing recipe step 'ContentDefinition'. 59 | 2017-12-15 11:03:09,990 [1] Orchard.Recipes.Providers.RecipeHandlers.RecipeExecutionStepHandler - (null) - INFO Executing recipe step 'ContentDefinition'. 60 | 2017-12-15 11:03:10,006 [1] Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO ContentDefinitionStep: Importing content type 'Page'. 61 | 2017-12-15 11:03:10,365 [1] Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO ContentDefinitionStep: Importing content type 'BlogPost'. 62 | 2017-12-15 11:03:10,443 [1] Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO ContentDefinitionStep: Importing content part 'BodyPart'. 63 | 2017-12-15 11:03:10,474 [1] Orchard.Recipes.Providers.RecipeHandlers.RecipeExecutionStepHandler - (null) - INFO Finished executing recipe step 'ContentDefinition'. 64 | 2017-12-15 11:03:10,506 [1] Orchard.Recipes.Services.RecipeScheduler - (null) - INFO Scheduling next step of recipe. 65 | 2017-12-15 11:03:10,803 [1] Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe steps. 66 | 2017-12-15 11:03:10,803 [1] Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe step 'Settings'. 67 | 2017-12-15 11:03:10,803 [1] Orchard.Recipes.Services.RecipeStepExecutor - (null) - INFO Executing recipe step 'Settings'. 68 | 2017-12-15 11:03:10,803 [1] Orchard.Recipes.Providers.RecipeHandlers.RecipeExecutionStepHandler - (null) - INFO Executing recipe step 'Settings'. 69 | 2017-12-15 11:03:11,162 [1] Orchard.Recipes.Providers.RecipeHandlers.RecipeExecutionStepHandler - (null) - INFO Finished executing recipe step 'Settings'. 70 | 2017-12-15 11:03:11,178 [1] Orchard.Recipes.Services.RecipeScheduler - (null) - INFO Scheduling next step of recipe. 71 | 2017-12-15 11:03:11,553 [1] Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe steps. 72 | 2017-12-15 11:03:11,553 [1] Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe step 'Migration'. 73 | 2017-12-15 11:03:11,553 [1] Orchard.Recipes.Services.RecipeStepExecutor - (null) - INFO Executing recipe step 'Migration'. 74 | 2017-12-15 11:03:11,553 [1] Orchard.Recipes.Providers.RecipeHandlers.RecipeExecutionStepHandler - (null) - INFO Executing recipe step 'Migration'. 75 | 2017-12-15 11:03:11,803 [1] Orchard.Recipes.Providers.RecipeHandlers.RecipeExecutionStepHandler - (null) - INFO Finished executing recipe step 'Migration'. 76 | 2017-12-15 11:03:11,818 [1] Orchard.Recipes.Services.RecipeScheduler - (null) - INFO Scheduling next step of recipe. 77 | 2017-12-15 11:03:12,115 [1] Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe steps. 78 | 2017-12-15 11:03:12,115 [1] Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe step 'Command'. 79 | 2017-12-15 11:03:12,115 [1] Orchard.Recipes.Services.RecipeStepExecutor - (null) - INFO Executing recipe step 'Command'. 80 | 2017-12-15 11:03:12,115 [1] Orchard.Recipes.Providers.RecipeHandlers.RecipeExecutionStepHandler - (null) - INFO Executing recipe step 'Command'. 81 | 2017-12-15 11:03:12,115 [1] Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO CommandStep: Executing command: layer create Default /LayerRule:"true" /Description:"The widgets in this layer are displayed on all pages" 82 | 2017-12-15 11:03:12,803 [1] Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO CommandStep: Executing command: layer create Authenticated /LayerRule:"authenticated" /Description:"The widgets in this layer are displayed when the user is authenticated" 83 | 2017-12-15 11:03:12,881 [1] Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO CommandStep: Executing command: layer create Anonymous /LayerRule:"not authenticated" /Description:"The widgets in this layer are displayed when the user is anonymous" 84 | 2017-12-15 11:03:12,943 [1] Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO CommandStep: Executing command: layer create Disabled /LayerRule:"false" /Description:"The widgets in this layer are never displayed" 85 | 2017-12-15 11:03:13,006 [1] Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO CommandStep: Executing command: layer create TheHomepage /LayerRule:"url '~/'" /Description:"The widgets in this layer are displayed on the home page" 86 | 2017-12-15 11:03:13,053 [1] Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO CommandStep: Executing command: site setting set baseurl 87 | 2017-12-15 11:03:13,068 [1] Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO CommandStep: Executing command: menu create /MenuName:"Main Menu" 88 | 2017-12-15 11:03:13,115 [1] Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO CommandStep: Executing command: page create /Slug:"welcome-to-orchard" /Title:"Welcome to Orchard!" /Path:"welcome-to-orchard" /Homepage:true /Publish:true /UseWelcomeText:true 89 | 2017-12-15 11:03:16,599 [1] Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO CommandStep: Executing command: menuitem create /MenuPosition:"0" /MenuText:"Home" /Url:"~/" /MenuName:"Main Menu" 90 | 2017-12-15 11:03:16,740 [1] Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO CommandStep: Executing command: widget create MenuWidget /Title:"Main Menu" /RenderTitle:false /Zone:"Navigation" /Position:"1" /Layer:"Default" /Identity:"MenuWidget1" /MenuName:"Main Menu" 91 | 2017-12-15 11:03:16,928 [1] Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO CommandStep: Executing command: theme activate "The Theme Machine" 92 | 2017-12-15 11:03:16,959 [1] Orchard.Recipes.Providers.RecipeHandlers.RecipeExecutionStepHandler - (null) - INFO Finished executing recipe step 'Command'. 93 | 2017-12-15 11:03:16,990 [1] Orchard.Recipes.Services.RecipeScheduler - Default - INFO Scheduling next step of recipe. 94 | 2017-12-15 11:03:17,271 [1] Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe steps. 95 | 2017-12-15 11:03:17,287 [1] Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe step 'ActivateShell'. 96 | 2017-12-15 11:03:17,287 [1] Orchard.Recipes.Services.RecipeStepExecutor - (null) - INFO Executing recipe step 'ActivateShell'. 97 | 2017-12-15 11:03:17,287 [1] Orchard.Recipes.Providers.RecipeHandlers.RecipeExecutionStepHandler - (null) - INFO Executing recipe step 'ActivateShell'. 98 | 2017-12-15 11:03:17,287 [1] Orchard.Recipes.Providers.RecipeHandlers.RecipeExecutionStepHandler - (null) - INFO Finished executing recipe step 'ActivateShell'. 99 | 2017-12-15 11:03:17,568 [1] Orchard.Recipes.Services.RecipeScheduler - (null) - INFO Scheduling next step of recipe. 100 | 2017-12-15 11:03:17,896 [1] Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe steps. 101 | 2017-12-15 11:03:17,896 [1] Orchard.Recipes.Services.RecipeStepExecutor - (null) - INFO No more recipe steps left to execute. 102 | 2017-12-15 11:03:17,912 [1] Orchard.Recipes.Services.RecipeScheduler - (null) - INFO All recipe steps executed; restarting shell. 103 | -------------------------------------------------------------------------------- /files/App_Data/Logs/orchard-error-2017.12.15.log: -------------------------------------------------------------------------------- 1 | 2017-12-15 11:02:18,898 [1] NHibernate.Transaction.AdoTransaction - (null) - Begin transaction failed [(null)] 2 | System.Data.SqlClient.SqlException (0x80131904): Login failed for user 'NewAdminName'. 3 | at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) 4 | at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) 5 | at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) 6 | at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) 7 | at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) 8 | at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) 9 | at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) 10 | at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) 11 | at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData) 12 | at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) 13 | at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) 14 | at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) 15 | at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) 16 | at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) 17 | at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) 18 | at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) 19 | at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) 20 | at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) 21 | at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) 22 | at System.Data.SqlClient.SqlConnection.Open() 23 | at NHibernate.Connection.DriverConnectionProvider.GetConnection() 24 | at NHibernate.AdoNet.ConnectionManager.GetConnection() 25 | at NHibernate.Transaction.AdoTransaction.Begin(IsolationLevel isolationLevel) 26 | ClientConnectionId:061f9510-637b-4237-bcf7-4d4f458239d4 27 | Error Number:18456,State:1,Class:14 28 | 2017-12-15 11:02:19,117 [1] NHibernate.Transaction.AdoTransaction - (null) - Begin transaction failed [(null)] 29 | System.Data.SqlClient.SqlException (0x80131904): Login failed for user 'NewAdminName'. 30 | at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) 31 | at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) 32 | at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) 33 | at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) 34 | at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) 35 | at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) 36 | at System.Data.SqlClient.SqlConnection.Open() 37 | at NHibernate.Connection.DriverConnectionProvider.GetConnection() 38 | at NHibernate.AdoNet.ConnectionManager.GetConnection() 39 | at NHibernate.Transaction.AdoTransaction.Begin(IsolationLevel isolationLevel) 40 | ClientConnectionId:061f9510-637b-4237-bcf7-4d4f458239d4 41 | Error Number:18456,State:1,Class:14 42 | -------------------------------------------------------------------------------- /files/App_Data/Logs/orchard-recipes-2017.12.15.log: -------------------------------------------------------------------------------- 1 | 2017-12-15 11:03:02,599 Orchard.Recipes.Services.RecipeManager - (null) - INFO Executing recipe 'Default'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 2 | 2017-12-15 11:03:02,615 Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Enqueuing recipe step 'Feature'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 3 | 2017-12-15 11:03:02,646 Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Enqueuing recipe step 'ContentDefinition'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 4 | 2017-12-15 11:03:02,646 Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Enqueuing recipe step 'Settings'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 5 | 2017-12-15 11:03:02,646 Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Enqueuing recipe step 'Migration'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 6 | 2017-12-15 11:03:02,646 Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Enqueuing recipe step 'Command'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 7 | 2017-12-15 11:03:02,678 Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Enqueuing recipe step 'ActivateShell'. [ExecutionId=(null)] 8 | 2017-12-15 11:03:02,974 Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe steps. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 9 | 2017-12-15 11:03:02,990 Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe step 'Feature'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 10 | 2017-12-15 11:03:02,990 Orchard.Recipes.Services.RecipeStepExecutor - (null) - INFO Executing recipe step 'Feature'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 11 | 2017-12-15 11:03:03,006 Orchard.Recipes.Providers.RecipeHandlers.RecipeExecutionStepHandler - (null) - INFO Executing recipe step 'Feature'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 12 | 2017-12-15 11:03:03,021 Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO FeatureStep: Enabling features: Orchard.Blogs;Orchard.Comments;Orchard.Tags;Orchard.Alias;Orchard.Autoroute;TinyMce;Orchard.MediaLibrary;Orchard.ContentPicker;Orchard.PublishLater;Orchard.Resources;Orchard.Widgets;Orchard.ContentTypes;Orchard.Scripting;Orchard.Scripting.Lightweight;PackagingServices;Orchard.Packaging;Orchard.Projections;Orchard.Fields;Orchard.OutputCache;Orchard.Taxonomies;Orchard.Workflows;Orchard.Layouts;Orchard.Layouts.Tokens;TheThemeMachine [ExecutionId=3d71c82146cf4376adce65282114ecfd] 13 | 2017-12-15 11:03:03,381 Orchard.Recipes.Providers.RecipeHandlers.RecipeExecutionStepHandler - (null) - INFO Finished executing recipe step 'Feature'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 14 | 2017-12-15 11:03:03,506 Orchard.Recipes.Services.RecipeScheduler - (null) - INFO Scheduling next step of recipe. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 15 | 2017-12-15 11:03:09,990 Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe steps. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 16 | 2017-12-15 11:03:09,990 Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe step 'ContentDefinition'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 17 | 2017-12-15 11:03:09,990 Orchard.Recipes.Services.RecipeStepExecutor - (null) - INFO Executing recipe step 'ContentDefinition'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 18 | 2017-12-15 11:03:09,990 Orchard.Recipes.Providers.RecipeHandlers.RecipeExecutionStepHandler - (null) - INFO Executing recipe step 'ContentDefinition'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 19 | 2017-12-15 11:03:10,006 Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO ContentDefinitionStep: Importing content type 'Page'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 20 | 2017-12-15 11:03:10,365 Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO ContentDefinitionStep: Importing content type 'BlogPost'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 21 | 2017-12-15 11:03:10,443 Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO ContentDefinitionStep: Importing content part 'BodyPart'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 22 | 2017-12-15 11:03:10,474 Orchard.Recipes.Providers.RecipeHandlers.RecipeExecutionStepHandler - (null) - INFO Finished executing recipe step 'ContentDefinition'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 23 | 2017-12-15 11:03:10,506 Orchard.Recipes.Services.RecipeScheduler - (null) - INFO Scheduling next step of recipe. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 24 | 2017-12-15 11:03:10,803 Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe steps. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 25 | 2017-12-15 11:03:10,803 Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe step 'Settings'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 26 | 2017-12-15 11:03:10,803 Orchard.Recipes.Services.RecipeStepExecutor - (null) - INFO Executing recipe step 'Settings'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 27 | 2017-12-15 11:03:10,803 Orchard.Recipes.Providers.RecipeHandlers.RecipeExecutionStepHandler - (null) - INFO Executing recipe step 'Settings'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 28 | 2017-12-15 11:03:11,162 Orchard.Recipes.Providers.RecipeHandlers.RecipeExecutionStepHandler - (null) - INFO Finished executing recipe step 'Settings'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 29 | 2017-12-15 11:03:11,178 Orchard.Recipes.Services.RecipeScheduler - (null) - INFO Scheduling next step of recipe. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 30 | 2017-12-15 11:03:11,553 Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe steps. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 31 | 2017-12-15 11:03:11,553 Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe step 'Migration'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 32 | 2017-12-15 11:03:11,553 Orchard.Recipes.Services.RecipeStepExecutor - (null) - INFO Executing recipe step 'Migration'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 33 | 2017-12-15 11:03:11,553 Orchard.Recipes.Providers.RecipeHandlers.RecipeExecutionStepHandler - (null) - INFO Executing recipe step 'Migration'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 34 | 2017-12-15 11:03:11,803 Orchard.Recipes.Providers.RecipeHandlers.RecipeExecutionStepHandler - (null) - INFO Finished executing recipe step 'Migration'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 35 | 2017-12-15 11:03:11,818 Orchard.Recipes.Services.RecipeScheduler - (null) - INFO Scheduling next step of recipe. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 36 | 2017-12-15 11:03:12,115 Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe steps. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 37 | 2017-12-15 11:03:12,115 Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe step 'Command'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 38 | 2017-12-15 11:03:12,115 Orchard.Recipes.Services.RecipeStepExecutor - (null) - INFO Executing recipe step 'Command'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 39 | 2017-12-15 11:03:12,115 Orchard.Recipes.Providers.RecipeHandlers.RecipeExecutionStepHandler - (null) - INFO Executing recipe step 'Command'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 40 | 2017-12-15 11:03:12,115 Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO CommandStep: Executing command: layer create Default /LayerRule:"true" /Description:"The widgets in this layer are displayed on all pages" [ExecutionId=3d71c82146cf4376adce65282114ecfd] 41 | 2017-12-15 11:03:12,803 Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO CommandStep: Executing command: layer create Authenticated /LayerRule:"authenticated" /Description:"The widgets in this layer are displayed when the user is authenticated" [ExecutionId=3d71c82146cf4376adce65282114ecfd] 42 | 2017-12-15 11:03:12,881 Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO CommandStep: Executing command: layer create Anonymous /LayerRule:"not authenticated" /Description:"The widgets in this layer are displayed when the user is anonymous" [ExecutionId=3d71c82146cf4376adce65282114ecfd] 43 | 2017-12-15 11:03:12,943 Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO CommandStep: Executing command: layer create Disabled /LayerRule:"false" /Description:"The widgets in this layer are never displayed" [ExecutionId=3d71c82146cf4376adce65282114ecfd] 44 | 2017-12-15 11:03:13,006 Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO CommandStep: Executing command: layer create TheHomepage /LayerRule:"url '~/'" /Description:"The widgets in this layer are displayed on the home page" [ExecutionId=3d71c82146cf4376adce65282114ecfd] 45 | 2017-12-15 11:03:13,053 Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO CommandStep: Executing command: site setting set baseurl [ExecutionId=3d71c82146cf4376adce65282114ecfd] 46 | 2017-12-15 11:03:13,068 Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO CommandStep: Executing command: menu create /MenuName:"Main Menu" [ExecutionId=3d71c82146cf4376adce65282114ecfd] 47 | 2017-12-15 11:03:13,115 Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO CommandStep: Executing command: page create /Slug:"welcome-to-orchard" /Title:"Welcome to Orchard!" /Path:"welcome-to-orchard" /Homepage:true /Publish:true /UseWelcomeText:true [ExecutionId=3d71c82146cf4376adce65282114ecfd] 48 | 2017-12-15 11:03:16,599 Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO CommandStep: Executing command: menuitem create /MenuPosition:"0" /MenuText:"Home" /Url:"~/" /MenuName:"Main Menu" [ExecutionId=3d71c82146cf4376adce65282114ecfd] 49 | 2017-12-15 11:03:16,740 Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO CommandStep: Executing command: widget create MenuWidget /Title:"Main Menu" /RenderTitle:false /Zone:"Navigation" /Position:"1" /Layer:"Default" /Identity:"MenuWidget1" /MenuName:"Main Menu" [ExecutionId=3d71c82146cf4376adce65282114ecfd] 50 | 2017-12-15 11:03:16,928 Orchard.Recipes.Services.RecipeExecutionLogger - (null) - INFO CommandStep: Executing command: theme activate "The Theme Machine" [ExecutionId=3d71c82146cf4376adce65282114ecfd] 51 | 2017-12-15 11:03:16,959 Orchard.Recipes.Providers.RecipeHandlers.RecipeExecutionStepHandler - (null) - INFO Finished executing recipe step 'Command'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 52 | 2017-12-15 11:03:16,990 Orchard.Recipes.Services.RecipeScheduler - Default - INFO Scheduling next step of recipe. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 53 | 2017-12-15 11:03:17,271 Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe steps. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 54 | 2017-12-15 11:03:17,287 Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe step 'ActivateShell'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 55 | 2017-12-15 11:03:17,287 Orchard.Recipes.Services.RecipeStepExecutor - (null) - INFO Executing recipe step 'ActivateShell'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 56 | 2017-12-15 11:03:17,287 Orchard.Recipes.Providers.RecipeHandlers.RecipeExecutionStepHandler - (null) - INFO Executing recipe step 'ActivateShell'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 57 | 2017-12-15 11:03:17,287 Orchard.Recipes.Providers.RecipeHandlers.RecipeExecutionStepHandler - (null) - INFO Finished executing recipe step 'ActivateShell'. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 58 | 2017-12-15 11:03:17,568 Orchard.Recipes.Services.RecipeScheduler - (null) - INFO Scheduling next step of recipe. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 59 | 2017-12-15 11:03:17,896 Orchard.Recipes.Services.RecipeStepQueue - (null) - INFO Dequeuing recipe steps. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 60 | 2017-12-15 11:03:17,896 Orchard.Recipes.Services.RecipeStepExecutor - (null) - INFO No more recipe steps left to execute. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 61 | 2017-12-15 11:03:17,912 Orchard.Recipes.Services.RecipeScheduler - (null) - INFO All recipe steps executed; restarting shell. [ExecutionId=3d71c82146cf4376adce65282114ecfd] 62 | -------------------------------------------------------------------------------- /files/App_Data/Sites/Default/Settings.txt.orig: -------------------------------------------------------------------------------- 1 | State: Running 2 | Themes: 3 | Modules: 4 | Name: Default 5 | DataProvider: SQLServer 6 | DataConnectionString: Data Source=192.168.0.231;Initial Catalog=OrchardDemo;User Id=NewAdminName;Password=system123.;Integrated Security=False; 7 | DataTablePrefix: null 8 | RequestUrlHost: null 9 | RequestUrlPrefix: null 10 | EncryptionAlgorithm: AES 11 | EncryptionKey: 667659D796700CB3153A74A46BACFC07B8AF0A3328162371CDA9254C34FA0FE5 12 | HashAlgorithm: HMACSHA256 13 | HashKey: 6BB5548F19B0D641D64E8EC0BE22E39DDE1738EF5BF6EBA84144E51B71CFAE1411A19122999480E80D6A583E7DD3A7FF99C8EF2485FFF2D1196541649AE7E7F8 14 | -------------------------------------------------------------------------------- /files/App_Data/Sites/Default/mappings.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsailiming/ansible-hyperv/d84fb65762a5753ab44bf48459d51755fd4551f1/files/App_Data/Sites/Default/mappings.bin -------------------------------------------------------------------------------- /files/App_Data/cache.dat: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2|Orchard.Framework;Common;Containers;Contents;Dashboard;Feeds;Navigation;Scheduling;Settings;Shapes;Title;Orchard.Pages;Orchard.ContentPicker;Orchard.Themes;Orchard.Users;Orchard.Roles;Orchard.Modules;PackagingServices;Orchard.Packaging;Gallery;Orchard.Recipes;Orchard.Alias;Orchard.Tokens;Orchard.Autoroute;Orchard.Resources;Orchard.Blogs;Orchard.Widgets;Orchard.PublishLater;Orchard.Conditions;Orchard.Scripting;Orchard.Comments;Orchard.Tags;Orchard.Alias;Orchard.Autoroute;TinyMce;Orchard.MediaLibrary;Orchard.MediaProcessing;Orchard.Forms;Orchard.ContentPicker;Orchard.Resources;Orchard.ContentTypes;Orchard.Scripting.Lightweight;PackagingServices;Orchard.Packaging;Orchard.Projections;Orchard.Fields;Orchard.OutputCache;Orchard.Taxonomies;Orchard.Workflows;Orchard.Layouts;Orchard.Layouts.Tokens;TheThemeMachine;| 4 | -------------------------------------------------------------------------------- /files/App_Data/hrestart.txt: -------------------------------------------------------------------------------- 1 | Host Restart -------------------------------------------------------------------------------- /files/db.bak: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsailiming/ansible-hyperv/d84fb65762a5753ab44bf48459d51755fd4551f1/files/db.bak -------------------------------------------------------------------------------- /group_vars/all.yml: -------------------------------------------------------------------------------- 1 | defaut_generation: 1 2 | 3 | ansible_user: Administrator 4 | ansible_password: system123. 5 | ansible_port: 5986 6 | ansible_connection: winrm 7 | ansible_winrm_server_cert_validation: ignore 8 | 9 | orchard_install_path: c:\inetpub\wwwroot\orchardcms 10 | orchard_db_user: orchard 11 | orchard_db_password: system123. 12 | orchard_db_name: OrchardDemo 13 | 14 | env: test # Default vm env 15 | 16 | 17 | -------------------------------------------------------------------------------- /group_vars/db.yml: -------------------------------------------------------------------------------- 1 | sql_installer_file: SQLEXPRWT_x64_ENU.exe -------------------------------------------------------------------------------- /group_vars/web.yml: -------------------------------------------------------------------------------- 1 | #config_file: "c:\\somehwere" 2 | 3 | # orchard_action: none 4 | # orchard_cms_version: 1.10.1 5 | # orchard_install_path: c:\inetpub\wwwroot\orchardcms 6 | 7 | 8 | orchard_cms_apppool_name: OrchardAppPool 9 | # orchard_db_name: OrchardDemo 10 | # orchard_db_connection_string: 'Server=(local); Database={{ orchard_db_name }}; Integrated Security=SSPI' 11 | 12 | # orchard_site_name: DemoSite 13 | # orchard_admin_user: admin 14 | # orchard_admin_password: password 15 | 16 | -------------------------------------------------------------------------------- /hosts: -------------------------------------------------------------------------------- 1 | [web] 2 | 192.168.0.232 3 | 4 | [db] 5 | 192.168.0.233 6 | 7 | -------------------------------------------------------------------------------- /library/win_hyperv_guest.ps1: -------------------------------------------------------------------------------- 1 | #!powershell 2 | # This file is part of Ansible 3 | # 4 | # Ansible is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # Ansible is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with Ansible. If not, see . 16 | 17 | # WANT_JSON 18 | # POWERSHELL_COMMON 19 | 20 | #Requires -Module Ansible.ModuleUtils.Legacy 21 | 22 | $params = Parse-Args $args; 23 | $result = @{}; 24 | Set-Attr $result "changed" $false; 25 | 26 | $name = Get-Attr -obj $params -name name -failifempty $true -emptyattributefailmessage "missing required argument: name" 27 | $cpu = Get-Attr -obj $params -name cpu -default '1' 28 | $memory = Get-Attr -obj $params -name memory -default '512MB' 29 | $hostserver = Get-Attr -obj $params -name hostserver 30 | $generation = Get-Attr -obj $params -name generation -default 2 31 | $network_switch = Get-Attr -obj $params -name network_switch -default $null 32 | 33 | $diskpath = Get-Attr -obj $params -name diskpath -default $null 34 | 35 | $showlog = Get-Attr -obj $params -name showlog -default "false" | ConvertTo-Bool 36 | $state = Get-Attr -obj $params -name state -default "present" 37 | 38 | if ("poweroff", "present","absent","started","stopped" -notcontains $state) { 39 | Fail-Json $result "The state: $state doesn't exist; State can only be: present, absent, started or stopped" 40 | } 41 | 42 | Function VM-Create { 43 | #Check If the VM already exists 44 | $CheckVM = Get-VM -name $name -ErrorAction SilentlyContinue 45 | 46 | if (!$CheckVM) { 47 | $cmd = "New-VM -Name $name" 48 | 49 | if ($memory) { 50 | $cmd += " -MemoryStartupBytes $memory" 51 | } 52 | 53 | if ($hostserver) { 54 | $cmd += " -ComputerName $hostserver" 55 | } 56 | 57 | if ($generation) { 58 | $cmd += " -Generation $generation" 59 | } 60 | 61 | if ($network_switch) { 62 | $cmd += " -SwitchName '$network_switch'" 63 | } 64 | 65 | if ($diskpath) { 66 | #If VHD already exists then attach it, if not create it 67 | if (Test-Path $diskpath) { 68 | $cmd += " -VHDPath '$diskpath'" 69 | } else { 70 | $cmd += " -NewVHDPath '$diskpath'" 71 | } 72 | } 73 | 74 | # Need to chain these 75 | $results = invoke-expression $cmd 76 | $results = invoke-expression "Set-VMProcessor $name -Count $cpu" 77 | 78 | $result.changed = $true 79 | } else { 80 | $result.changed = $false 81 | } 82 | } 83 | 84 | Function VM-Delete { 85 | $CheckVM = Get-VM -name $name -ErrorAction SilentlyContinue 86 | 87 | if ($CheckVM) { 88 | $cmd="Remove-VM -Name $name -Force" 89 | $results = invoke-expression $cmd 90 | $result.changed = $true 91 | } else { 92 | $result.changed = $false 93 | } 94 | } 95 | 96 | Function VM-Start { 97 | $CheckVM = Get-VM -name $name -ErrorAction SilentlyContinue 98 | 99 | if ($CheckVM) { 100 | $cmd="Start-VM -Name $name" 101 | $results = invoke-expression $cmd 102 | $result.changed = $true 103 | } else { 104 | Fail-Json $result "The VM: $name; Doesn't exists please create the VM first" 105 | } 106 | } 107 | 108 | Function VM-Poweroff { 109 | $CheckVM = Get-VM -name $name -ErrorAction SilentlyContinue 110 | 111 | if ($CheckVM) { 112 | $cmd="Stop-VM -Name $name -TurnOff" 113 | $results = invoke-expression $cmd 114 | $result.changed = $true 115 | } else { 116 | Fail-Json $result "The VM: $name; Doesn't exists please create the VM first" 117 | } 118 | } 119 | 120 | Function VM-Shutdown { 121 | $CheckVM = Get-VM -name $name -ErrorAction SilentlyContinue 122 | 123 | if ($CheckVM) { 124 | $cmd="Stop-VM -Name $name" 125 | $results = invoke-expression $cmd 126 | $result.changed = $true 127 | } else { 128 | Fail-Json $result "The VM: $name; Doesn't exists please create the VM first" 129 | } 130 | } 131 | 132 | Try { 133 | switch ($state) { 134 | "present" {VM-Create} 135 | "absent" {VM-Delete} 136 | "started" {VM-Start} 137 | "stopped" {VM-Shutdown} 138 | "poweroff" {VM-Poweroff} 139 | } 140 | 141 | Exit-Json $result; 142 | } Catch { 143 | Fail-Json $result $_.Exception.Message 144 | } 145 | -------------------------------------------------------------------------------- /library/win_hyperv_guest.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | # This file is part of Ansible 5 | # 6 | # Ansible is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Ansible is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with Ansible. If not, see . 18 | 19 | # this is a windows documentation stub. actual code lives in the .ps1 20 | # file of the same name 21 | 22 | DOCUMENTATION = ''' 23 | --- 24 | module: win_hyperv_guest 25 | version_added: "2.4" 26 | short_description: Adds, deletes and performs power functions on Hyper-V VM's. 27 | description: 28 | - Adds, deletes and performs power functions on Hyper-V VM's. 29 | options: 30 | name: 31 | description: 32 | - Name of VM 33 | required: true 34 | state: 35 | description: 36 | - State of VM 37 | required: false 38 | choices: 39 | - present 40 | - absent 41 | - started 42 | - stopped 43 | default: present 44 | memory: 45 | description: 46 | - Sets the amount of memory for the VM. 47 | required: false 48 | default: 512MB 49 | hostserver: 50 | description: 51 | - Server to host VM 52 | required: false 53 | default: null 54 | generation: 55 | description: 56 | - Specifies the generation of the VM 57 | required: false 58 | default: 2 59 | network_switch: 60 | description: 61 | - Specifies a network adapter for the VM 62 | required: false 63 | default: null 64 | diskpath: 65 | description: 66 | - Specify path of VHD/VHDX file for VM 67 | - If the file exists it will be attached, if not then a new one will be created 68 | require: false 69 | default: null 70 | ''' 71 | 72 | EXAMPLES = ''' 73 | # Create VM 74 | win_hyperv_guest: 75 | name: Test 76 | 77 | # Delete a VM 78 | win_hyperv_guest: 79 | name: Test 80 | state: absent 81 | 82 | # Create VM with 256MB memory 83 | win_hyperv_guest: 84 | name: Test 85 | memory: 256MB 86 | 87 | # Create generation 1 VM with 256MB memory and a network adapter 88 | win_hyperv_guest: 89 | name: Test 90 | generation: 1 91 | memory: 256MB 92 | network_switch: WAN1 93 | ''' 94 | 95 | ANSIBLE_METADATA = { 96 | 'status': ['preview'], 97 | 'supported_by': 'community', 98 | 'metadata_version': '1.1' 99 | } 100 | -------------------------------------------------------------------------------- /library/win_hyperv_guest_config_net.ps1: -------------------------------------------------------------------------------- 1 | #!powershell 2 | # This file is part of Ansible 3 | # 4 | # Ansible is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # Ansible is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with Ansible. If not, see . 16 | 17 | # WANT_JSON 18 | # POWERSHELL_COMMON 19 | 20 | #Requires -Module Ansible.ModuleUtils.Legacy 21 | 22 | $params = Parse-Args $args; 23 | $result = @{}; 24 | Set-Attr $result "changed" $false; 25 | 26 | $name = Get-Attr -obj $params -name name -failifempty $true -emptyattributefailmessage "missing required argument: name" 27 | $ip = Get-Attr -obj $params -name ip 28 | $netmask = Get-Attr -obj $params -name netmask 29 | $gateway = Get-Attr -obj $params -name gateway 30 | $dns = Get-Attr -obj $params -name dns 31 | $type = Get-Attr -obj $params -name type -default 'dhcp' 32 | 33 | if ("static", "dhcp" -notcontains $type) { 34 | Fail-Json $result "The type: $type doesn't exist; Type can only be: static, dhcp" 35 | } 36 | 37 | # http://www.ravichaganti.com/blog/set-or-inject-guest-network-configuration-from-hyper-v-host-windows-server-2012/ 38 | Function Set-VMNetworkConfiguration { 39 | [CmdletBinding()] 40 | Param ( 41 | [Parameter(Mandatory=$true, 42 | Position=1, 43 | ParameterSetName='DHCP', 44 | ValueFromPipeline=$true)] 45 | [Parameter(Mandatory=$true, 46 | Position=0, 47 | ParameterSetName='Static', 48 | ValueFromPipeline=$true)] 49 | [Microsoft.HyperV.PowerShell.VMNetworkAdapter]$NetworkAdapter, 50 | 51 | [Parameter(Mandatory=$true, 52 | Position=1, 53 | ParameterSetName='Static')] 54 | [String[]]$IPAddress=@(), 55 | 56 | [Parameter(Mandatory=$false, 57 | Position=2, 58 | ParameterSetName='Static')] 59 | [String[]]$Subnet=@(), 60 | 61 | [Parameter(Mandatory=$false, 62 | Position=3, 63 | ParameterSetName='Static')] 64 | [String[]]$DefaultGateway = @(), 65 | 66 | [Parameter(Mandatory=$false, 67 | Position=4, 68 | ParameterSetName='Static')] 69 | [String[]]$DNSServer = @(), 70 | 71 | [Parameter(Mandatory=$false, 72 | Position=0, 73 | ParameterSetName='DHCP')] 74 | [Switch]$Dhcp 75 | ) 76 | 77 | $VM = Get-WmiObject -Namespace 'root\virtualization\v2' -Class 'Msvm_ComputerSystem' | Where-Object { $_.ElementName -eq $NetworkAdapter.VMName } 78 | $VMSettings = $vm.GetRelated('Msvm_VirtualSystemSettingData') | Where-Object { $_.VirtualSystemType -eq 'Microsoft:Hyper-V:System:Realized' } 79 | $VMNetAdapters = $VMSettings.GetRelated('Msvm_SyntheticEthernetPortSettingData') 80 | 81 | $NetworkSettings = @() 82 | foreach ($NetAdapter in $VMNetAdapters) { 83 | if ($NetAdapter.Address -eq $NetworkAdapter.MacAddress) { 84 | $NetworkSettings = $NetworkSettings + $NetAdapter.GetRelated("Msvm_GuestNetworkAdapterConfiguration") 85 | } 86 | } 87 | 88 | $NetworkSettings[0].IPAddresses = $IPAddress 89 | $NetworkSettings[0].Subnets = $Subnet 90 | $NetworkSettings[0].DefaultGateways = $DefaultGateway 91 | $NetworkSettings[0].DNSServers = $DNSServer 92 | $NetworkSettings[0].ProtocolIFType = 4096 93 | 94 | if ($dhcp) { 95 | $NetworkSettings[0].DHCPEnabled = $true 96 | } else { 97 | $NetworkSettings[0].DHCPEnabled = $false 98 | } 99 | 100 | $Service = Get-WmiObject -Class "Msvm_VirtualSystemManagementService" -Namespace "root\virtualization\v2" 101 | $setIP = $Service.SetGuestNetworkAdapterConfiguration($VM, $NetworkSettings[0].GetText(1)) 102 | 103 | if ($setip.ReturnValue -eq 4096) { 104 | $job=[WMI]$setip.job 105 | 106 | while ($job.JobState -eq 3 -or $job.JobState -eq 4) { 107 | start-sleep 1 108 | $job=[WMI]$setip.job 109 | } 110 | 111 | if ($job.JobState -eq 7) { 112 | write-host "Success" 113 | } 114 | else { 115 | $job.GetError() 116 | } 117 | } elseif($setip.ReturnValue -eq 0) { 118 | Write-Host "Success" 119 | } 120 | } 121 | 122 | Try { 123 | $CheckVM = Get-VM -name $name -ErrorAction SilentlyContinue 124 | 125 | if ($CheckVM) { 126 | $cmd = "Get-VMNetworkAdapter -VMName $name | " 127 | 128 | if ($type -eq 'dhcp' ) { 129 | $cmd += "Set-VMNetworkConfiguration -DHCP" 130 | } 131 | 132 | else { 133 | $cmd += "Set-VMNetworkConfiguration -IPAddress $ip -Subnet $netmask -DNSServer $dns -DefaultGateway $gateway" 134 | } 135 | 136 | invoke-expression $cmd 137 | $result.new = $cmd 138 | $result.changed = $true 139 | } else { 140 | $result.changed = $false 141 | } 142 | Exit-Json $result; 143 | 144 | } Catch { 145 | Fail-Json $result $_.Exception.Message 146 | } 147 | -------------------------------------------------------------------------------- /library/win_hyperv_guest_config_net.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | # This file is part of Ansible 5 | # 6 | # Ansible is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Ansible is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with Ansible. If not, see . 18 | 19 | # this is a windows documentation stub. actual code lives in the .ps1 20 | # file of the same name 21 | 22 | DOCUMENTATION = ''' 23 | --- 24 | module: win_hyperv_config_net 25 | version_added: "2.4" 26 | short_description: Configure Hyper-V VM's network. 27 | description: 28 | - Configure Hyper-V VM's network. 29 | options: 30 | name: 31 | description: 32 | - Name of VM 33 | required: true 34 | ip: 35 | description: 36 | - IP Address 37 | required: false 38 | default: null 39 | netmask: 40 | description: 41 | - Netmask 42 | required: false 43 | default: null 44 | gateway: 45 | description: 46 | - Gateway 47 | required: false 48 | default: null 49 | dns: 50 | description: 51 | - DNS 52 | required: false 53 | default: null 54 | type: 55 | description: 56 | - Whether is static or dhcp 57 | required: true 58 | default: dhcp 59 | 60 | ''' 61 | 62 | EXAMPLES = ''' 63 | 64 | ''' 65 | 66 | ANSIBLE_METADATA = { 67 | 'status': ['preview'], 68 | 'supported_by': 'community', 69 | 'metadata_version': '1.1' 70 | } 71 | -------------------------------------------------------------------------------- /library/win_mssql_database.ps1: -------------------------------------------------------------------------------- 1 | #!powershell 2 | 3 | # WANT_JSON 4 | # POWERSHELL_COMMON 5 | 6 | #Requires -Module Ansible.ModuleUtils.Legacy 7 | 8 | Set-StrictMode -Version 2 9 | $ErrorActionPreference = "Stop" 10 | 11 | $parsed_args = Parse-Args $args $true 12 | 13 | $result = @{changed=$false} 14 | 15 | $server_name = Get-AnsibleParam $parsed_args "server_name" -default "(local)" 16 | $db_name = Get-AnsibleParam $parsed_args "db_name" -failifempty $result 17 | $state = Get-AnsibleParam $parsed_args "state" -default "present" -ValidateSet @("present","absent") 18 | $check_mode = Get-AnsibleParam $parsed_args "_ansible_check_mode" -default $false 19 | 20 | [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null 21 | 22 | $server = New-Object Microsoft.SqlServer.Management.Smo.Server $server_name 23 | 24 | $db = $server.Databases[$db_name] 25 | 26 | If(-not $db -and $state -eq "present") { 27 | $result.changed = $true 28 | 29 | If(-not $check_mode) { 30 | # DB doesn't exist, create it 31 | $db = New-Object Microsoft.SqlServer.Management.Smo.Database @($server, $db_name) 32 | $db.Create() 33 | } 34 | } 35 | ElseIf($db -and $state -eq "absent") { 36 | $result.changed = $true 37 | 38 | If(-not $check_mode) { 39 | $db.Drop() 40 | } 41 | } 42 | 43 | return $result | ConvertTo-Json -Depth 99 44 | 45 | -------------------------------------------------------------------------------- /prov_web_db.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Provision VM 3 | hosts: b07.lab.ltsai.com 4 | gather_facts: no 5 | 6 | tasks: 7 | - import_tasks: tasks/prov_vm.yml 8 | 9 | - name: Setup MS SQL 2014 Express 10 | hosts: db 11 | 12 | vars: 13 | install_mssql: False 14 | 15 | roles: 16 | - { role: mssqlexpress, when: install_mssql == True } 17 | 18 | post_tasks: 19 | - name: Copy DB backup 20 | win_copy: 21 | src: db.bak 22 | dest: C:\{{orchard_db_name}}.BAK 23 | 24 | - name: Create db restoration sql file 25 | win_template: 26 | src: restore_db.j2 27 | dest: c:\restore_db.sql 28 | 29 | - name: Create DB before restoration 30 | win_mssql_database: 31 | db_name: "{{orchard_db_name}}" 32 | state: present 33 | 34 | - name: Restore db backup 35 | raw: Invoke-Sqlcmd -InputFile c:\restore_db.sql 36 | 37 | - name: Create user creation sql file 38 | win_template: 39 | src: create_mssql_user.j2 40 | dest: c:\user.sql 41 | 42 | - name: Create db User 43 | raw: Invoke-Sqlcmd -InputFile c:\user.sql 44 | 45 | - name: Enable mixed mode authentication 46 | win_regedit: 47 | path: HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL12.{{sql_instance_name}}\MSSQLServer 48 | name: LoginMode 49 | data: 2 50 | type: DWORD 51 | #register: win_reg 52 | 53 | - name: Restart mssql service 54 | win_service: 55 | name: 'MSSQL${{sql_instance_name}}' 56 | force_dependent_services: yes 57 | state: restarted 58 | 59 | - name: Install OrchardCMS 60 | hosts: web 61 | 62 | vars: 63 | install_orchardcms: False 64 | 65 | roles: 66 | - { role: orchard_cms, when: install_orchardcms == True } 67 | 68 | post_tasks: 69 | - name: Restore App Data 70 | win_copy: 71 | src: App_Data 72 | dest: "{{orchard_install_path}}" 73 | 74 | #- debug: var=hostvars[groups['db'][0]]['ansible_ip_addresses'][0] 75 | 76 | - name: Write out settings.txt 77 | win_template: 78 | src: Settings.txt.j2 79 | dest: "{{orchard_install_path}}\\App_Data\\Sites\\Default\\Settings.txt" 80 | 81 | - name: restart IIS AppPool 82 | win_iis_webapppool: 83 | name: '{{ orchard_cms_apppool_name }}' 84 | state: restarted 85 | 86 | -------------------------------------------------------------------------------- /roles/mssqlexpress/defaults/main.yml: -------------------------------------------------------------------------------- 1 | sql_instance_name: SQLEXPRESS 2 | sql_installer_file: SQLEXPRADV_x64_ENU.exe -------------------------------------------------------------------------------- /roles/mssqlexpress/tasks/main.yml: -------------------------------------------------------------------------------- 1 | #- debug: var=hostvars[inventory_hostname] 2 | - name: a pre requisite of sql net-framework 3 | win_feature: 4 | name: "{{item}}" 5 | state: present 6 | with_items: 7 | - NET-Framework-Core 8 | - NET-Framework-Features 9 | - NET-Framework-45-Features 10 | - NET-Framework-45-Core 11 | - NET-Framework-45-ASPNET 12 | 13 | - name: create a directory for installer download 14 | win_file: 15 | path: c:\sql 16 | state: directory 17 | 18 | - name: create a directory for installer extraction 19 | win_file: 20 | path: c:\sql\installer 21 | state: directory 22 | 23 | - name: check downloaded file exists 24 | win_stat: 25 | path: c:\sql\sql_installer.exe 26 | register: installer_file 27 | 28 | - name: Copy the installer 29 | win_copy: 30 | src: "{{sql_installer_file}}" 31 | dest: c:\sql\sql_installer.exe 32 | when: not installer_file.stat.exists 33 | 34 | - name: extract the installer 35 | win_command: c:\sql\sql_installer.exe /q /x:c:\sql\installer 36 | args: 37 | chdir: c:\sql 38 | creates: c:\sql\installer\setup.exe 39 | 40 | - win_reg_stat: 41 | path: HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL 42 | register: sql_key 43 | 44 | #- debug: var=sql_key.exists 45 | 46 | # https://github.com/ansible/ansible/issues/22660 47 | # https://stackoverflow.com/questions/38009588/ansible-with-windows-server-2012-and-sql-server-2014 48 | - name: Write out sql installer ps1 file 49 | win_template: 50 | src: install_mssql.ps1.j2 51 | dest: c:\sql\install_mssql.ps1 52 | when: not sql_key.exists 53 | 54 | - name: Run installer 55 | win_shell: c:\sql\install_mssql.ps1 56 | when: not sql_key.exists 57 | 58 | # - name: Install the database 59 | # win_command: setup.exe /q /ACTION=Install /INSTANCENAME={{sql_instance_name}} /FEATURES=SQLEngine /UPDATEENABLED=0 /SQLSVCACCOUNT="NT AUTHORITY\System" /SQLSYSADMINACCOUNTS="BUILTIN\ADMINISTRATORS" /TCPENABLED=1 /NPENABLED=0 /IACCEPTSQLSERVERLICENSETERMS 60 | # args: 61 | # chdir: c:\sql\installer 62 | # # # #setup.exe /q /ACTION=Install /INSTANCENAME=SQLEXPRESS /FEATURES=SQLEngine /UPDATEENABLED=0 /SQLSVCACCOUNT="NT AUTHORITY\System" /SQLSYSADMINACCOUNTS="BUILTIN\ADMINISTRATORS" /TCPENABLED=1 /NPENABLED=0 /IACCEPTSQLSERVERLICENSETERMS 63 | 64 | #https://support.microsoft.com/en-sg/help/823938/how-to-configure-sql-server-to-listen-on-a-specific-port 65 | - name: Add or update registry for ip port 66 | win_regedit: 67 | path: HKLM:\Software\Microsoft\Microsoft SQL Server\MSSQL12.{{sql_instance_name}}\MSSQLServer\SuperSocketNetLib\Tcp\IPAll 68 | name: TcpPort 69 | data: 1433 70 | register: win_reg 71 | 72 | - name: Enable mixed mode authentication 73 | win_regedit: 74 | path: HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL12.{{sql_instance_name}}\MSSQLServer 75 | name: LoginMode 76 | data: 2 77 | type: DWORD 78 | register: win_reg 79 | 80 | - name: Restart a service 81 | win_service: 82 | name: 'MSSQL${{sql_instance_name}}' 83 | force_dependent_services: yes 84 | state: restarted 85 | #when: win_reg.changed 86 | 87 | -------------------------------------------------------------------------------- /roles/mssqlexpress/templates/install_mssql.ps1.j2: -------------------------------------------------------------------------------- 1 | # Credit: https://github.com/ansible/ansible-modules-extras/issues/275#issuecomment-76054045 2 | 3 | $jobName = "Invoke-InstallMSSQL" ; 4 | $doneFile = "C:\Invoke-InstallMSSQL.DONE" ; 5 | $sleepInterval = 5 ; 6 | 7 | function Invoke-InstallMSSQL { 8 | 9 | $invokeScript = { 10 | try { 11 | c:\sql\installer\setup.exe /q /ACTION=Install /INSTANCENAME={{sql_instance_name}} /FEATURES=SQLEngine /UPDATEENABLED=0 /SQLSVCACCOUNT="NT AUTHORITY\System" /SQLSYSADMINACCOUNTS="BUILTIN\ADMINISTRATORS" /TCPENABLED=1 /NPENABLED=0 /IACCEPTSQLSERVERLICENSETERMS 12 | } catch {} 13 | 14 | New-Item -ItemType "file" "C:\Invoke-InstallMSSQL.DONE" 15 | } ; 16 | 17 | Remove-Item $doneFile; 18 | 19 | # remove the job (if exists), create a new one. 20 | # NOTE: this will clobber any previous job 21 | $result = Get-ScheduledJob | Where { $_.Name -eq "$jobName" } ; 22 | if ($result) { 23 | Unregister-ScheduledJob -Name "$jobName" -Force; 24 | } 25 | Register-ScheduledJob -Name "$jobName" -RunNow -ScriptBlock $invokeScript ; 26 | } 27 | 28 | Invoke-InstallMSSQL ; 29 | 30 | # monitor for DONE file and report 31 | Start-Sleep -s $sleepInterval ; 32 | while(!(Test-Path $doneFile)) { 33 | Start-Sleep -s $sleepInterval ; 34 | # 35 | } 36 | 37 | Remove-Item $doneFile 38 | Unregister-ScheduledJob -Name "$jobName" -Force; 39 | -------------------------------------------------------------------------------- /roles/orchard_cms/defaults/main.yml: -------------------------------------------------------------------------------- 1 | dotnetframework: NDP452-KB2901907-x86-x64-AllOS-ENU.exe 2 | 3 | orchard_action: none 4 | orchard_cms_version: 1.10.1 5 | orchard_install_path: c:\inetpub\wwwroot\orchardcms 6 | orchard_db_user: orchard 7 | orchard_db_password: system 8 | orchard_db_name: OrchardDemo 9 | orchard_cms_apppool_name: OrchardAppPool 10 | 11 | orchard_site_name: DemoSite 12 | orchard_admin_user: admin 13 | orchard_admin_password: password -------------------------------------------------------------------------------- /roles/orchard_cms/meta/main.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsailiming/ansible-hyperv/d84fb65762a5753ab44bf48459d51755fd4551f1/roles/orchard_cms/meta/main.yml -------------------------------------------------------------------------------- /roles/orchard_cms/tasks/main.yml: -------------------------------------------------------------------------------- 1 | - include: preflight.yml 2 | 3 | - include: orchard-{{ orchard_action }}.yml 4 | static: no 5 | when: orchard_action in ["install", "upgrade"] 6 | 7 | - name: ensure IIS is started and configured to auto-start 8 | win_service: 9 | name: w3svc 10 | state: started 11 | start_mode: auto 12 | 13 | - name: Configure IIS AppPool 14 | win_iis_webapppool: 15 | name: '{{ orchard_cms_apppool_name }}' 16 | state: started 17 | 18 | - name: Configure IIS application 19 | win_iis_webapplication: 20 | site: Default Web Site 21 | name: Orchard 22 | application_pool: '{{ orchard_cms_apppool_name }}' 23 | physical_path: '{{ orchard_install_path }}' 24 | 25 | # - name: ensure orchard SQL Server database exists 26 | # win_mssql_database: 27 | # db_name: '{{ orchard_db_name }}' 28 | # state: present 29 | 30 | # - name: ensure SQL Server login exists for AppPool identity 31 | # win_mssql_server_login: 32 | # name: 'IIS APPPOOL\{{ orchard_cms_apppool_name }}' 33 | # login_type: windows 34 | # state: present 35 | 36 | # - name: ensure orchard database user/roles exist 37 | # win_mssql_db_user: 38 | # db_name: '{{ orchard_db_name }}' 39 | # name: '{{ orchard_cms_apppool_name }}' 40 | # server_login_name: 'IIS APPPOOL\{{ orchard_cms_apppool_name }}' 41 | # roles: db_owner 42 | # state: present 43 | 44 | # - name: query orchard setup state 45 | # raw: '{{ orchard_install_path }}\bin\orchard.exe help setup' 46 | # changed_when: false 47 | # register: orchsetup_out 48 | 49 | # - name: run orchard site setup 50 | # raw: '{{ orchard_install_path }}\bin\orchard.exe setup "/SiteName:{{ orchard_site_name }}" "/AdminUsername:{{ orchard_admin_user }}" "/AdminPassword:{{ orchard_admin_password }}" /DatabaseProvider:SQLServer "/DatabaseConnectionString:{{ orchard_db_connection_string }}" /Recipe:Default' 51 | # when: orchsetup_out.stdout is not search("Command setup doesn't exist") 52 | 53 | # TODO: fetch orchard site setup result 54 | -------------------------------------------------------------------------------- /roles/orchard_cms/tasks/orchard-install.yml: -------------------------------------------------------------------------------- 1 | 2 | # Not needed unless running setup.exe 3 | # - name: create a directory for .Net Framework download 4 | # win_file: 5 | # path: c:\dotnet 6 | # state: directory 7 | 8 | # - name: check .Net Framework installer exists 9 | # win_stat: 10 | # path: c:\dotnet\installer.exe 11 | # register: installer_file 12 | 13 | # - name: Copy .Net Framework 14 | # win_copy: 15 | # src: "{{dotnetframework}}" 16 | # dest: c:\dotnet\installer.exe 17 | # when: not installer_file.stat.exists 18 | 19 | # - name: Install Dot Net Framework 20 | # win_command: c:\dotnet\installer.exe /passive /norestart /SkipMSUInstall /log "C:\results.log" 21 | 22 | - name: ensure IIS and ASP.NET are installed 23 | win_feature: 24 | name: Web-Asp-Net45,Web-Static-Content,Web-Security,Web-Scripting-Tools,Web-Mgmt-Console,Web-WMI 25 | register: wfout 26 | 27 | - name: reboot if necessary 28 | win_reboot: 29 | when: wfout.restart_needed 30 | 31 | - name: set tempdir location 32 | set_fact: 33 | orchard_cms_tempdir: '{{ ansible_env.TEMP }}\ansible_orchard_cms' 34 | 35 | - name: ensure tempdir exists 36 | win_file: 37 | path: "{{ orchard_cms_tempdir }}" 38 | state: directory 39 | 40 | - name: download OrchardCMS {{ orchard_cms_version }} 41 | win_get_url: 42 | url: https://github.com/OrchardCMS/Orchard/releases/download/{{ orchard_cms_version }}/Orchard.Web.zip 43 | dest: '{{ orchard_cms_tempdir }}\Orchard.Web.zip' 44 | 45 | - name: extract archive to tempdir 46 | win_unzip: 47 | src: '{{ orchard_cms_tempdir }}\Orchard.Web.zip' 48 | dest: "{{ orchard_cms_tempdir }}" 49 | 50 | - name: ensure install directory exists 51 | win_file: 52 | path: "{{ orchard_install_path }}" 53 | state: directory 54 | 55 | - name: ensure install directory permissions 56 | win_acl: 57 | path: "{{ orchard_install_path }}" 58 | type: allow 59 | user: IIS_IUSRS 60 | rights: FullControl 61 | 62 | - name: copy Orchard subdir to install directory 63 | win_robocopy: 64 | src: '{{ orchard_cms_tempdir }}\Orchard' 65 | dest: '{{ orchard_install_path }}' 66 | recurse: yes 67 | 68 | # TODO: recursively set dir ACL for target service account 69 | # TODO: configure webapp + service account 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /roles/orchard_cms/tasks/orchard-upgrade.yml: -------------------------------------------------------------------------------- 1 | - include: download.yml 2 | 3 | - debug: msg="do upgrade-specific tasks" -------------------------------------------------------------------------------- /roles/orchard_cms/tasks/preflight.yml: -------------------------------------------------------------------------------- 1 | - name: check for existing Orchard installation 2 | win_stat: 3 | path: '{{ orchard_install_path }}\bin\Orchard.Core.dll' 4 | register: orch_core_dll_stat 5 | 6 | - name: determine if Orchard install necessary 7 | set_fact: 8 | orchard_action: install 9 | when: not orch_core_dll_stat.stat.exists 10 | 11 | - name: get existing Orchard version 12 | win_file_version: 13 | path: '{{ orchard_install_path }}\bin\Orchard.Core.dll' 14 | register: orch_existing_version 15 | when: orch_core_dll_stat.stat.exists 16 | 17 | - name: determine if Orchard upgrade necessary 18 | set_fact: 19 | orchard_action: upgrade 20 | when: orch_core_dll_stat.stat.exists and orchard_cms_version | version_compare(orch_existing_version.win_file_version.product_version, "<") 21 | -------------------------------------------------------------------------------- /tasks/prov_vm.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include vm env var 3 | include_vars: 4 | file: "{{env}}.yml" 5 | 6 | - name: Check whether vhdx already exists 7 | win_stat: 8 | path: "{{item.dest_vhd}}" 9 | get_checksum: false 10 | get_md5: false 11 | with_items: "{{ vms }}" 12 | register: file_info 13 | 14 | #- debug: var=file_info.results 15 | 16 | - name: Clone vhdx 17 | win_copy: 18 | src: "{{item.item.src_vhd}}" 19 | dest: "{{item.item.dest_vhd}}" 20 | remote_src: True 21 | with_items: "{{ file_info.results }}" 22 | when: item.stat.exists == false 23 | 24 | - name: Create VMs 25 | win_hyperv_guest: 26 | name: "{{item.name}}" 27 | generation: "{{defaut_generation}}" 28 | cpu: "{{item.cpu}}" 29 | memory: "{{item.memory}}" 30 | network_switch: "{{item.network_switch}}" 31 | diskpath: "{{item.dest_vhd}}" 32 | state: present 33 | with_items: "{{ vms }}" 34 | register: new_vms 35 | 36 | - name: Configure VMs IP 37 | win_hyperv_guest_config_net: 38 | name: "{{item.name}}" 39 | ip: "{{item.network.ip}}" 40 | netmask: "{{item.network.netmask}}" 41 | gateway: "{{item.network.gateway}}" 42 | dns: "{{item.network.dns}}" 43 | type: static 44 | with_items: "{{ vms }}" 45 | 46 | #- debug: var=new_vms.results 47 | 48 | - add_host: 49 | name: "{{ item.item.network.ip }}" 50 | ansible_connection: winrm 51 | ansible_host: "{{ item.item.network.ip }}" 52 | groups: "{{item.item.type}}" 53 | with_items: "{{ new_vms.results }}" 54 | 55 | #- debug: var=groups 56 | #- debug: var=play_hosts 57 | 58 | - name: Poweron VMs 59 | win_hyperv_guest: 60 | name: "{{item.name}}" 61 | state: started 62 | with_items: "{{ vms }}" 63 | 64 | # wait_for_connection, needs to be in another play because 65 | # it uses the current inventory in this play 66 | - name: Wait for VM to be running 67 | win_wait_for: 68 | host: "{{ item.network.ip }}" 69 | port: "{{ ansible_port }}" 70 | timeout: 300 71 | with_items: "{{ vms }}" 72 | 73 | -------------------------------------------------------------------------------- /templates/Settings.txt.j2: -------------------------------------------------------------------------------- 1 | State: Running 2 | Themes: 3 | Modules: 4 | Name: Default 5 | DataProvider: SQLServer 6 | DataConnectionString: Data Source={{hostvars[groups['db'][0]]['ansible_ip_addresses'][0]}};Initial Catalog={{orchard_db_name}};User Id={{orchard_db_user}};Password={{orchard_db_password}};Integrated Security=False; 7 | DataTablePrefix: null 8 | RequestUrlHost: null 9 | RequestUrlPrefix: null 10 | EncryptionAlgorithm: AES 11 | EncryptionKey: 667659D796700CB3153A74A46BACFC07B8AF0A3328162371CDA9254C34FA0FE5 12 | HashAlgorithm: HMACSHA256 13 | HashKey: 6BB5548F19B0D641D64E8EC0BE22E39DDE1738EF5BF6EBA84144E51B71CFAE1411A19122999480E80D6A583E7DD3A7FF99C8EF2485FFF2D1196541649AE7E7F8 14 | -------------------------------------------------------------------------------- /templates/create_mssql_user.j2: -------------------------------------------------------------------------------- 1 | 2 | IF NOT EXISTS 3 | (SELECT name 4 | FROM master.sys.server_principals 5 | WHERE name = '{{orchard_db_user}}') 6 | BEGIN 7 | CREATE LOGIN {{orchard_db_user}} WITH PASSWORD = N'{{orchard_db_password}}' 8 | END; 9 | GO 10 | 11 | Use {{orchard_db_name}}; 12 | GO 13 | 14 | IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'{{orchard_db_user}}') 15 | BEGIN 16 | CREATE USER [{{orchard_db_user}}] FOR LOGIN [{{orchard_db_user}}] 17 | EXEC sp_addrolemember N'db_owner', N'{{orchard_db_user}}' 18 | END; 19 | GO -------------------------------------------------------------------------------- /templates/restore_db.j2: -------------------------------------------------------------------------------- 1 | -- Close all connections and rollback all transaction 2 | ALTER DATABASE {{orchard_db_name}} SET SINGLE_USER WITH ROLLBACK IMMEDIATE; 3 | GO 4 | 5 | RESTORE DATABASE {{ orchard_db_name }} FROM DISK = 'C:\{{orchard_db_name}}.BAK' WITH REPLACE; 6 | GO 7 | 8 | ALTER DATABASE {{orchard_db_name}} SET MULTI_USER; 9 | GO -------------------------------------------------------------------------------- /test_vault.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Test Ansible Vault 3 | hosts: localhost 4 | gather_facts: no 5 | 6 | 7 | tasks: 8 | - include_vars: vars/sample-vault.yml 9 | 10 | - debug: msg="This is var1={{var1}} var2={{var2}}" 11 | -------------------------------------------------------------------------------- /vars/gold.yml: -------------------------------------------------------------------------------- 1 | # Use to build golden image 2 | 3 | vms: 4 | - type: web 5 | name: "web-{{env}}" 6 | 7 | cpu: 2 8 | memory: 4096MB 9 | 10 | network: 11 | ip: 192.168.0.232 12 | netmask: 255.255.255.0 13 | gateway: 192.168.0.1 14 | dns: 192.168.0.212 15 | 16 | network_switch: 'External Virtual Switch' 17 | 18 | src_vhd: "C:\\win2012r2-gold.vhdx" 19 | dest_vhd: "C:\\Users\\Public\\Documents\\Hyper-V\\Virtual hard disks\\web-{{env}}.vhdx" 20 | 21 | - type: db 22 | name: "db-{{env}}" 23 | 24 | cpu: 2 25 | memory: 4096MB 26 | 27 | network: 28 | ip: 192.168.0.233 29 | netmask: 255.255.255.0 30 | gateway: 192.168.0.1 31 | dns: 192.168.0.212 32 | 33 | network_switch: 'External Virtual Switch' 34 | 35 | src_vhd: "C:\\win2012r2-gold.vhdx" 36 | dest_vhd: "C:\\Users\\Public\\Documents\\Hyper-V\\Virtual hard disks\\db-{{env}}.vhdx" 37 | -------------------------------------------------------------------------------- /vars/sample-vault.yml: -------------------------------------------------------------------------------- 1 | $ANSIBLE_VAULT;1.1;AES256 2 | 36383333323964616532336362356362363437326462636466633538663735373837613061643530 3 | 3131366432636230346432306466643263623463656230620a656461663437323531376234383938 4 | 66383363396637346530646539353333376162306232383365343063636532323133646563333065 5 | 3837333166313932300a346330663237353465366362363838336230376463363837353534323434 6 | 61393133636432343135663262656538643661366166323132643232653764613434 7 | -------------------------------------------------------------------------------- /vars/sit1.yml: -------------------------------------------------------------------------------- 1 | vms: 2 | - type: web 3 | name: "web-{{env}}" 4 | 5 | cpu: 2 6 | memory: 4096MB 7 | 8 | network: 9 | ip: 192.168.0.230 10 | netmask: 255.255.255.0 11 | gateway: 192.168.0.1 12 | dns: 192.168.0.212 13 | 14 | network_switch: 'External Virtual Switch' 15 | 16 | src_vhd: "C:\\win2012r2-gold.vhdx" 17 | dest_vhd: "C:\\Users\\Public\\Documents\\Hyper-V\\Virtual hard disks\\web-{{env}}.vhdx" 18 | 19 | - type: db 20 | name: "db-{{env}}" 21 | 22 | cpu: 2 23 | memory: 4096MB 24 | 25 | network: 26 | ip: 192.168.0.231 27 | netmask: 255.255.255.0 28 | gateway: 192.168.0.1 29 | dns: 192.168.0.212 30 | 31 | network_switch: 'External Virtual Switch' 32 | 33 | src_vhd: "C:\\win2012r2-gold.vhdx" 34 | dest_vhd: "C:\\Users\\Public\\Documents\\Hyper-V\\Virtual hard disks\\db-{{env}}.vhdx" 35 | -------------------------------------------------------------------------------- /vars/test-clean.yml: -------------------------------------------------------------------------------- 1 | vms: 2 | - type: web 3 | name: "webtest-{{env}}" 4 | 5 | cpu: 2 6 | memory: 4096MB 7 | 8 | network: 9 | ip: 192.168.0.232 10 | netmask: 255.255.255.0 11 | gateway: 192.168.0.1 12 | dns: 192.168.0.212 13 | 14 | network_switch: 'External Virtual Switch' 15 | 16 | src_vhd: "C:\\win2012r2-gold.vhdx" 17 | dest_vhd: "C:\\Users\\Public\\Documents\\Hyper-V\\Virtual hard disks\\web-{{env}}.vhdx" 18 | 19 | - type: db 20 | name: "dbtest-{{env}}" 21 | 22 | cpu: 2 23 | memory: 4096MB 24 | 25 | network: 26 | ip: 192.168.0.233 27 | netmask: 255.255.255.0 28 | gateway: 192.168.0.1 29 | dns: 192.168.0.212 30 | 31 | network_switch: 'External Virtual Switch' 32 | 33 | src_vhd: "C:\\win2012r2-iis-gold.vhdx" 34 | dest_vhd: "C:\\Users\\Public\\Documents\\Hyper-V\\Virtual hard disks\\db-{{env}}.vhdx" 35 | -------------------------------------------------------------------------------- /vars/test.yml: -------------------------------------------------------------------------------- 1 | vms: 2 | - type: web 3 | name: "webtest-{{env}}" 4 | 5 | cpu: 2 6 | memory: 4096MB 7 | 8 | network: 9 | ip: 192.168.0.232 10 | netmask: 255.255.255.0 11 | gateway: 192.168.0.1 12 | dns: 192.168.0.212 13 | 14 | network_switch: 'External Virtual Switch' 15 | 16 | src_vhd: "C:\\win2012r2-iis-gold.vhdx" 17 | dest_vhd: "C:\\Users\\Public\\Documents\\Hyper-V\\Virtual hard disks\\web-{{env}}.vhdx" 18 | 19 | - type: db 20 | name: "dbtest-{{env}}" 21 | 22 | cpu: 2 23 | memory: 4096MB 24 | 25 | network: 26 | ip: 192.168.0.233 27 | netmask: 255.255.255.0 28 | gateway: 192.168.0.1 29 | dns: 192.168.0.212 30 | 31 | network_switch: 'External Virtual Switch' 32 | 33 | src_vhd: "C:\\win2012r2-mssql-gold.vhdx" 34 | dest_vhd: "C:\\Users\\Public\\Documents\\Hyper-V\\Virtual hard disks\\db-{{env}}.vhdx" 35 | -------------------------------------------------------------------------------- /win_ping.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Win ping 3 | hosts: b07.lab.ltsai.com 4 | gather_facts: no 5 | 6 | tasks: 7 | - win_ping: 8 | --------------------------------------------------------------------------------