Configure Ansible as Post Provision Script Table of Contents OverviewGoalsPrerequisitesThe process to Configure Ansible as Post-Provision Script RegisterNode: Post Provisioning ScriptExecuteConfigPackages: Post Provisioning ScriptKey Values to be modified Additional Information Overview Cloud Provisioning and Governance Platform from ServiceNow is flexible to execute the Ansible playbooks post provisioning a VM, configuring the Post Provisioning Scripts for Ansible a bit different from the regular process General Reference: Create post-provision operationsExample: Post-provision cloud scriptPre and Post Provision operation with Templates Goals Step by Step configuration of Post Provisioning Scripts with Ansible Prerequisites ServiceNow Instance with below Plugins Activated DiscoveryCloud APICloud Config ManagementCloud ManagementCloud Management Core User with Cloud Admin/Discovery Admin Role.MID Server Up and Running and Validated, no Firewall blocks for Azure/AWS API/ Ansible API CommunicationCreate the Azure Credentials Reference: Store the Azure service principal credentials in the instance Create a Service Account for Azure Reference: Add an Azure service account Create a Cloud Account for Azure Reference: Set up a cloud account for Azure Discover the Azure Resource from Cloud Account Reference: Azure Cloud Discovery Discover the Ansible Tower Reference: Ansible configuration management provider and run Discovery Create a Catalog from ARM Template Reference: Creating a Catalog Item from ARM Template The process to Configure Ansible as Post-Provision Script Create a Catalog from ARM Template. Reference: Creating a Catalog Item from ARM TemplateOnce the Catalog Created and Validated Successfully, the Post Provisioning Scripts will be available. RegisterNode: Post Provisioning Script Click New under the Post Provisioning Scripts Step Type: CAPI CAPI Provider: Ansible-TowerCAPI Method: RegisterNodeCAPI Version: 1.0Order: 100Enabled: True Save the RecordAfter the Saving the Record the Display will auto-populate ConfigScriptConfigMgmtProviderInfoAdditionalParametersNodeCredentialsConfigScriptTypeNodeAddress By Default, the Key-Value Parameters are auto Populated, the user needs to change the values according to the requirement ExecuteConfigPackages: Post Provisioning Script Click New under the Post Provisioning Scripts Step Type: CAPI CAPI Provider: Ansible-TowerCAPI Method: ExecuteConfigPackagesCAPI Version: 1.0Order: 200Enabled: True Save the Record After the Saving the Record the Display will auto-populate Key Values ConfigScriptConfigMgmtProviderInfoAdditionalParametersNodeCredentialsConfigScriptTypeNodeAddress By Default, the Key-Value Parameters are auto Populated, the user needs to change the values according to the requirement Key Values to be modified ConfigMgmtProviderInfo $(Script:CfgMgmtUtils.getCfgMgmtCredentials[arg=${parameter.WorkloadConfigProvider},arg=${parameter.WorkloadConfigProviderType},arg=${parameter.ManagementAttributes}]) AdditionalParameters {"node_name":"${parameter.InstanceName}","management_attributes":[[{"name":"management_attribute","value":"Inventory"},{"name":"management_attribute_value","value":"${parameter.Inventory}"}],[{"name":"management_attribute","value":"Hostgroup"},{"name":"management_attribute_value","value":"${parameter.HostGroupPlayBoook}"}]]} NodeAddress {"private_ip":"${Host.StackOrchestrationInterface.CreateStack.Output.resp.outputs.DemoInstanceIPPrivate}","public_ip":"${Host.StackOrchestrationInterface.CreateStack.Output.resp.outputs.DemoInstanceIP}"} NodeCredentials $(capiResolver.NodeCredentialResolver#nodeCredentialId=${parameter.NodeCredentials}) ConfigScript ${parameter.ConfigScript} ConfigScriptType ${parameter.ConfigScriptType} Additional Information Create an Ansible configuration management provider and run Discovery