有多種選項用於設定雲端範本,以支援在 vCenter 計算資源上以 Puppet 為基礎的組態管理。

vSphere 上的 Puppet,具有使用者名稱和密碼驗證

下列範例顯示了具有使用者名稱和密碼驗證的 vSphere OVA 上 Puppet 的 YAML 程式碼範例。

表 1.
範例... 範例藍圖 YAML
具有使用者名稱和密碼驗證的 vSphere OVA 上 Puppet 的 YAML 程式碼。
inputs:
  username:
    type: string
    title: Username
    default: puppet
  password:
    type: string
    title: Password
    encrypted: true
    default: VMware@123
resources:
  Puppet_Agent:
    type: Cloud.Puppet
    properties:
      provider: PEonAWS
      environment: dev
      role: 'role::linux_webserver'
      username: '${input.username}'
      password: '${input.password}'
      useSudo: true
      host: '${Webserver.*}’
      osType: linux
      agentConfiguration:
        runInterval: 15m
        certName: ‘${Machine.address}'
  Webserver:
    type: Cloud.vSphere.Machine
    properties:
      cpuCount: 1
      totalMemoryMB: 1024
      imageRef: >-
https://cloud-images.ubuntu.com/releases/16.04/release-20170307/ubuntu-16.04-server-cloudimg-amd64.ova
      cloudConfig: |
        #cloud-config
        ssh_pwauth: yes
        chpasswd:
          list: |
            ${input.username}:${input.password}
          expire: false
        users:
          - default
          - name: ${input.username}
            lock_passwd: false
            sudo: ['ALL=(ALL) NOPASSWD:ALL']
            groups: [wheel, sudo, admin]
            shell: '/bin/bash'
            ssh-authorized-keys:
              - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDytVL+Q6+vGbmkXoRpX dmettem@dmettem-m01.vmware.com
        runcmd:
          - echo "Defaults:${input.username}
vSphere OVA 上 Puppet 的 YAML 程式碼,在計算資源上具有使用者名稱和密碼驗證。
inputs:
  username:
    type: string
    title: Username
    default: puppet
  password:
    type: string
    title: Password
    encrypted: true
    default: VMware@123
resources:
  Puppet_Agent:
    type: Cloud.Puppet
    properties:
      provider: PEonAWS
      environment: dev
      role: 'role::linux_webserver'
      username: '${input.username}'
      password: '${input.password}'
      useSudo: true
      host: '${Webserver.*}’
      osType: linux
      agentConfiguration:
        runInterval: 15m
        certName: ‘${Machine.address}'
  Webserver:
    type: Cloud.vSphere.Machine
    properties:
      cpuCount: 1
      totalMemoryMB: 1024
      imageRef: >-
https://cloud-images.ubuntu.com/releases/16.04/release-20170307/ubuntu-16.04-server-cloudimg-amd64.ova
      cloudConfig: |
        #cloud-config
        ssh_pwauth: yes
        chpasswd:
          list: |
            ${input.username}:${input.password}
          expire: false
        users:
          - default
          - name: ${input.username}
            lock_passwd: false
            sudo: ['ALL=(ALL) NOPASSWD:ALL']
            groups: [wheel, sudo, admin]
            shell: '/bin/bash'
            ssh-authorized-keys:
              - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDytVL+Q6+vGbmkXoRpX dmettem@dmettem-m01.vmware.com
        runcmd:
          - echo "Defaults:${input.username}
vCenter 上 Puppet 的 YAML 程式碼,在計算資源上具有已啟用遠端存取的密碼驗證。
inputs:
  username:
    type: string
    title: Username
    description: Username to use to install Puppet agent
    default: puppet
  password:
    type: string
    title: Password
    default: VMware@123
    encrypted: true
    description: Password for the given username to install Puppet agent
resources:
  Puppet-Ubuntu:
    type: Cloud.vSphere.Machine
    properties:
      flavor: small
      imageRef: >-
        https://cloud-images.ubuntu.com/releases/16.04/release-20170307/ubuntu-16.04-server-cloudimg-amd64.ova
      remoteAccess:
        authentication: usernamePassword
        username: '${input.username}'
        password: '${input.password}'
  Puppet_Agent:
    type: Cloud.Puppet
    properties:
      provider: PEMasterOnPrem
      environment: production
      role: 'role::linux_webserver'
      username: '${input.username}'
      password: '${input.password}'
      host: '${Puppet-Ubuntu.*}'
      useSudo: true
      agentConfiguration:
        certName: '${Puppet-Ubuntu.address}'

vSphere 上的 Puppet,具有產生的 PublicPrivateKey 驗證

表 2.
範例... 範例藍圖 YAML
vSphere OVA 上 Puppet 的 YAML 代碼,在計算資源上具有產生的 PublicPrivateKey 驗證。
inputs: {}
resources:
  Machine:
    type: Cloud.vSphere.Machine
    properties:
      flavor: small
      imageRef: >-
https://cloud-images.ubuntu.com/releases/16.04/release-20170307/ubuntu-16.04-server-cloudimg-amd64.ova
      remoteAccess:
        authentication: generatedPublicPrivateKey
  Puppet_Agent:
    type: Cloud.Puppet
    properties:
      provider: puppet-BlueprintProvisioningITSuite
      environment: production
      role: 'role::linux_webserver'
      host: '${Machine.*}’
      osType: linux
      username: ubuntu
      useSudo: true
      agentConfiguration:
        runInterval: 15m
        certName: ‘${Machine.address}'
          - echo "Defaults:${input.username}