Contents

VMware Aria Automation and SaltStack Config Resource

How to start using the SaltStack Config Resource with VMware Aria Automation Cloud Templates.


Use Case

VMware Aria Automation Config has been the Configuration Management tool that I like to use with Servers, Windows and Linux. The first process to use salt with new servers is to install the salt minion, which is an agent that needs installed on the Server. There are many different ways to install the salt minion agent and what I wanted to show in this blog post is how to use the SaltStack Config Resource with the VMware Automation Cloud Template. When creating a Cloud Template in VMware Aria Automation, one of the options is to add the SaltStack Config Resource.


What the SaltStack Config Resource provides:

  • Automated Salt minion installation
  • Ability to add grains data to minion when the minion installation completes. See example yaml code.
  • The minion key is auto-accepted in SaltStack Config
  • If you delete the VM deployment in VMware Aria Automation, the minion key will be automatically removed from VMware Aria Automation Config. Built-in decommission.
  • Ability to run a state file when the minion installation completes. See example yaml code.

Requirements:

  • This blog was created using VMware Aria Automation version 8.11.0. The process may vary for different version of VMware Aria Automation.
  • TCP Port 445 needs to be open between VMware Aria Automation Config server and the new Server that the minion is being installed on.
  • Check the VMware Aria Automation Config server. The OS that you are using for the new server must have an agent file in the /etc/salt/cloud.deploy.d folder.
  • Check the VMware Aria Automation Config server. The version of the agent files in the /etc/salt/cloud.deploy.d folder must match the version of the salt master.
  • The script that creates the grains file when using the SaltStack Config Resource and VMware Aria cloud templates with Windows Servers needs to be manually replaced on the VMware Aria Automation Config Server (salt master). Future VMware Aria Automation Config installs with LCM (VMware Aria Suite LifeCycle) will include this fix. The script creates the grains file in the incorrect folder.
    • Location of script on salt master: /lib64/python3.7/site-packages/salt/utils/cloud.py
    • Make a copy of the original cloud.py before replacing with updated version.
    • Where to get new script: https://github.com/saltstack/salt/blob/master/salt/utils/cloud.py
    • The grains file will be created in “C:\ProgramData\Salt Project\Salt\conf” after the script is updated.
    • Update: When I installed VMware Aria Automation Config 8.12, 8.13 and 8.14 I still needed to update the cloud.py file for the grains to be created properly.

Current OS support:
/vmware-aria-automation-saltstack-config-resource/ssc-03.png
Click to see Larger Image of Screen Shot

Any OS not listed is currently not supported at this time.


Cloud Template | Windows 2019 Server:
/vmware-aria-automation-saltstack-config-resource/ssc-02.png
Click to see Larger Image of Screen Shot

  • Windows 2019 Server cloud template yaml code:
  • You MUST add the remoteAccess code in the Virtual_Machine section for minion installation.
  • grains data is added in the additionalMinionParams section of the yaml code.
  • When the minion agent installation is complete, you will see the new minion listed in the targets automatically. You do not need to accept the minion key.
  • click to expand yaml code
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
FEformatVersion: 1
inputs:
  CustomizationSpec:
    type: string
    description: Customization Specification
    default: W2K19
    title: CustomizationSpec
  VMName:
    type: string
    title: VM Name
    minLength: 1
    maxLength: 15
    default: DBH-194
  IP:
    type: string
    default: 192.168.110.194
  EDrive:
    type: integer
    title: E-Drive
    default: 0
    description: Enter 0 to disable the disk and not create
  FDrive:
    type: integer
    title: F-Drive
    default: 0
    description: Enter 0 to disable the disk and not create
  SQL:
    type: string
    title: SQL
    description: Selecting SQL will format all DATA drives with 64k allocation.
    default: 'False'
    enum:
      - 'True'
      - 'False'
resources:
  Network:
    type: Cloud.Network
    properties:
      networkType: existing
      constraints:
        - tag: network:VMs
  Virtual_Machine:
    type: Cloud.Machine
    properties:
      image: W2K19
      flavor: medium
      customizationSpec: ${input.CustomizationSpec}
      name: ${input.VMName}
      remoteAccess:
        authentication: usernamePassword
        username: administrator
        password: VMware1!
      networks:
        - network: ${resource.Network.id}
          assignment: static
          address: ${input.IP}
      attachedDisks: ${map_to_object(resource.Cloud_Volume_E[*].id + resource.Cloud_Volume_F[*].id , "source")}
      edrivesize: ${input.EDrive}
      fdrivesize: ${input.FDrive}
      sql: ${input.SQL}
  # - VMware Max SCSI Controllers is 4
  # - VMware Max Unit per SCSI Controllers is 15
  Cloud_Volume_E:
    type: Cloud.Volume
    properties:
      capacityGb: ${input.EDrive}
      count: '${input.EDrive == 0 ? 0 : 1 }'
      SCSIController: SCSI_Controller_1
      unitNumber: 0
      provisioningType: thin
  Cloud_Volume_F:
    type: Cloud.Volume
    properties:
      capacityGb: ${input.FDrive}
      count: '${input.FDrive == 0 ? 0 : 1 }'
      SCSIController: SCSI_Controller_1
      unitNumber: 1
      provisioningType: thin
  Cloud_SaltStack_1:
    type: Cloud.SaltStack
    properties:
      hosts:
        - ${resource.Virtual_Machine.id}
      masterId: saltstack_enterprise_installer
      stateFiles:
        - /vcrocs/windows.sls
      saltEnvironment: base
      # - This is how you add grains data to the minion
      additionalMinionParams:
        grains:
          vCROCS_Roles:
            - webserver
            - database
          vCROCS_E_Drive:
            - ${input.EDrive}
          vCROCS_F_Drive:
            - ${input.FDrive}
          vCROCS_SQL:
            - ${input.SQL}

Cloud Template | Ubuntu 20 Server:
  • Ubuntu 20 Server cloud template yaml code:
  • You MUST add the remoteAccess code in the Virtual_Machine section for minion installation.
  • grains data is added in the additionalMinionParams section of the yaml code.
  • When the minion agent installation is complete, you will see the new minion listed in the targets automatically. You do not need to accept the minion key.
  • click to expand yaml code
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
formatVersion: 1
inputs:
  CustomizationSpec:
    type: string
    description: Customization Specification
    default: ubuntu
    title: CustomizationSpec
  VMName:
    type: string
    title: VM Name
    minLength: 1
    maxLength: 12
    default: DBH-197
  IP:
    type: string
    default: 192.168.110.197
resources:
  Cloud_Network_1:
    type: Cloud.Network
    properties:
      networkType: existing
      constraints:
        - tag: network:VMs
  Cloud_Machine_1:
    type: Cloud.Machine
    properties:
      image: ubuntu-20
      flavor: small
      name: ${input.VMName}
      remoteAccess:
        authentication: usernamePassword
        username: administrator
        password: VMware1!
      customizationSpec: ${input.CustomizationSpec}
      constraints:
        - tag: env:VMs
      networks:
        - network: ${resource.Cloud_Network_1.id}
          assignment: static
          address: ${input.IP}
  Cloud_SaltStack_1:
    type: Cloud.SaltStack
    properties:
      hosts:
        - ${resource.Cloud_Machine_1.id}
      masterId: saltstack_enterprise_installer
      stateFiles: 
        - /vcrocs/ubuntu.sls
      saltEnvironment: base
      additionalMinionParams:
        grains:
          roles:
            - webserver

  • This screen shot shows how to get the “masterId” to use in the Cloud Template yaml code.
/vmware-aria-automation-saltstack-config-resource/ssc-05.png
Click to see Larger Image of Screen Shot
  • This screen shot shows how to see the SaltMaster version.
/vmware-aria-automation-saltstack-config-resource/ssc-06.png
Click to see Larger Image of Screen Shot

Completed Deployment
  • This shows what the deployment looks like after it is completed.
  • Grain data is shown within the Salt Configuration section.
/vmware-aria-automation-saltstack-config-resource/ssc-01.png
Click to see Larger Image of Screen Shot

Custom Form to create the Windows Server Deployment
  • Example of a Custom Form for Windows Server Builds
/vmware-aria-automation-saltstack-config-resource/ssc-04.png
Click to see Larger Image of Screen Shot

Lessons Learned
Lessons Learned:
  • See “Requirements” listed above
  • See “What the SaltStack Config Resource provides” above
  • If you need to update the minion agent files on the salt master server, in folder /etc/salt/cloud.deploy.d, you will have to have your VMware account team download the files for you or open an SR. The files are not public facing.


Info

When I write about VMware Aria Automation, I always say there are many ways to accomplish the same task. VMware Aria Automation Config is the same way. I am showing what I felt was important to see but every organization/environment will be different. There is no right or wrong way to use Salt. This is a GREAT Tool that is included with your VMware Aria Suite Advanced/Enterprise license. If you own the VMware Aria Suite, you own VMware Aria Automation Config.

  • VMware Aria Automation = vRealize Automation
  • VMware Aria Automation Config = SaltStack Config

  • If you like wearing Crocs and want to get a pair like I wear, follow this link to Amazon: My Favorite Crocs
  • If you found this Blog article useful and it helped you, Buy me a coffee to start my day.