È possibile utilizzare le risorse e le impostazioni di rete, sicurezza e bilanciamento del carico nei progetti di modelli cloud e nelle distribuzioni.
Per un riepilogo delle opzioni del codice di progettazione del modello cloud, vedere Schema dei tipi di risorse di vRealize Automation.
Questi esempi illustrano risorse di rete, sicurezza e bilanciamento del carico in progettazioni di modelli cloud di base.
Reti
| Scenario risorsa | Esempio di codice di progettazione del modello di cloud |
|---|---|
| Macchina vSphere con più NIC connesse a reti vSphere e NSX con assegnazione IP DHCP | resources:
demo-machine:
type: Cloud.vSphere.Machine
properties:
image: ubuntu
flavor: small
networks:
- network: ${resource["demo-vSphere-Network"].id}
deviceIndex: 0
- network: ${resource["demo-NSX-Network"].id}
deviceIndex: 1
demo-vSphere-Network:
type: Cloud.vSphere.Network
properties:
networkType: existing
demo-NSX-Network:
type: Cloud.NSX.Network
properties:
networkType: outbound
|
Rete privata NSX che utilizza la proprietà vlanIds per specificare un array di 3 VLAN: 123, 456 e 7 |
formatVersion: 1
inputs: {}
resources:
Cloud_Machine_1:
type: Cloud.Machine
properties:
image: test
flavor: test
networks:
- network: '${resource.Cloud_NSX_Network_1.id}'
Cloud_NSX_Network_1:
type: Cloud.NSX.Network
properties:
networkType: private
vlanIds:
- 123
- 456
- 7
|
| Aggiunta di una rete privata con un indirizzo IP statico per una distribuzione di macchine virtuali Azure | formatVersion: 1
inputs: {}
resources:
Cloud_Azure_Machine_1:
type: Cloud.Machine
properties:
image: photon
flavor: Standard_B1ls
networks:
- network: '${resource.Cloud_Network_1.id}'
assignment: static
address: 10.0.0.45
assignPublicIpAddress: false
Cloud_Network_1:
type: Cloud.Network
properties:
networkType: existing
|
| È possibile utilizzare l'assegnazione di un IP statico con l'IPAM di vRealize Automation (interno fornito con vRealize Automation o esterno basato sull'SDK dell'IPAM di vRealize Automation come per uno dei plug-in Infoblox disponibili in VMware Marketplace). Non sono supportati altri utilizzi di |
resources:
demo_vm:
type: Cloud.vSphere.Machine
properties:
image: 'photon'
cpuCount: 1
totalMemoryMB: 1024
networks:
- network: ${resource.demo_nw.id}
assignment: static
demo_nw:
type: Cloud.vSphere.Network
properties:
networkType: existing |
Aggiungere o modificare le regole di inoltro delle porte NAT e DNAT in una risorsa Cloud.NSX.NAT per una distribuzione esistente. |
resources:
gw:
type: Cloud.NSX.Gateway
properties:
networks:
- ${resource.akout.id}
nat:
type: Cloud.NSX.Nat
properties:
networks:
- ${resource.akout.id}
natRules:
- translatedInstance: ${resource.centos.networks[0].id}
index: 0
protocol: TCP
kind: NAT44
type: DNAT
sourceIPs: any
sourcePorts: 80
translatedPorts: 8080
destinationPorts: 8080
description: edit
- translatedInstance: ${resource.centos.networks[0].id}
index: 1
protocol: TCP
kind: NAT44
type: DNAT
sourceIPs: any
sourcePorts: 90
translatedPorts: 9090
destinationPorts: 9090
description: add
gateway: ${resource.gw.id}
centos:
type: Cloud.vSphere.Machine
properties:
image: WebTinyCentOS65x86
flavor: small
customizationSpec: Linux
networks:
- network: ${resource.akout.id}
assignment: static
akout:
type: Cloud.NSX.Network
properties:
networkType: outbound
constraints:
- tag: nsxt-nat-1-M2
|
| Una macchina cloud pubblica per l'utilizzo di un IP interno anziché un IP pubblico. Questo esempio utilizza un ID di rete specifico. Nota: l'opzione |
resources:
wf_proxy:
type: Cloud.Machine
properties:
image: ubuntu 16.04
flavor: small
constraints:
- tag: 'platform:vsphere'
networks:
- network: '${resource.wf_net.id}'
assignPublicIpAddress: false |
| Rete instradata utilizzando il tipo di risorsa di rete di NSX. |
Cloud_NSX_Network_1:
type: Cloud.NSX.Network
properties:
networkType: routed |
| Aggiungere un tag a una risorsa NIC della macchina nel modello cloud. | formatVersion: 1
inputs: {}
resources:
Cloud_Machine_1:
type: Cloud.vSphere.Machine
properties:
flavor: small
image: ubuntu
networks:
- name: '${resource.Cloud_Network_1.name}'
deviceIndex: 0
tags:
- key: 'nic0'
value: null
- key: internal
value: true
- name: '${resource.Cloud_Network_2.name}'
deviceIndex: 1
tags:
- key: 'nic1'
value: null
- key: internal
value: false |
| Contrassegnare con tag i commutatori logici NSX-T per una rete in uscita. I tag sono supportati per NSX-T e VMware Cloud on AWS. Per ulteriori informazioni su questo scenario, vedere il post del blog della community Creating Tags in NSX with Cloud Assembly. |
Cloud_NSX_Network_1:
type: Cloud.NSX.Network
properties:
networkType: outbound
tags:
- key: app
value: opencart
|
Gruppi di sicurezza
| Scenario risorsa | Esempio di codice di progettazione del modello di cloud |
|---|---|
| Gruppo di sicurezza esistente con un tag di vincolo applicato a una scheda NIC di una macchina. Per utilizzare un gruppo di sicurezza esistente, immettere existing per la proprietà securityGroupType . È possibile assegnare tag a una risorsa Cloud.SecurityGroup per allocare i gruppi di sicurezza esistenti utilizzando vincoli di tag. I gruppi di sicurezza che non contengono tag non possono essere utilizzati nella progettazione del modello cloud. I tag di vincolo devono essere impostati per le risorse del gruppo di sicurezza |
formatVersion: 1
inputs: {}
resources:
allowSsh_sg:
type: Cloud.SecurityGroup
properties:
securityGroupType: existing
constraints:
- tag: allowSsh
compute:
type: Cloud.Machine
properties:
image: centos
flavor: small
networks:
- network: '${resource.prod-net.id}'
securityGroups:
- '${resource.allowSsh_sg.id}'
prod-net:
type: Cloud.Network
properties:
networkType: existing |
| Gruppo di sicurezza su richiesta con due regole del firewall che illustrano le opzioni di accesso |
resources:
Cloud_SecurityGroup_1:
type: Cloud.SecurityGroup
properties:
securityGroupType: new
rules:
- ports: 5000
source: 'fc00:10:000:000:000:56ff:fe89:48b4'
access: Allow
direction: inbound
name: allow_5000
protocol: TCP
- ports: 7000
source: 'fc00:10:000:000:000:56ff:fe89:48b4'
access: Deny
direction: inbound
name: deny_7000
protocol: TCP
Cloud_vSphere_Machine_1:
type: Cloud.vSphere.Machine
properties:
image: photon
cpuCount: 1
totalMemoryMB: 256
networks:
- network: '${resource.Cloud_Network_1.id}'
assignIPv6Address: true
assignment: static
securityGroups:
- '${resource.Cloud_SecurityGroup_1.id}'
Cloud_Network_1:
type: Cloud.Network
properties:
networkType: existing
|
|
Modello cloud complesso con 2 gruppi di sicurezza, tra cui:
Questo esempio illustra diverse combinazioni di protocolli e porte, servizi, CIDR IP come source e destination, intervallo IP come source o destination e opzioni per any, IPv6 e (::/0). Per le schede NIC delle macchine, è possibile specificare la rete connessa e i gruppi di sicurezza. È possibile specificare anche l'indice della NIC o un indirizzo IP. |
formatVersion: 1
inputs: {}
resources:
DEMO_ESG : existing security group - security group 1)
type: Cloud.SecurityGroup
properties:
constraints:
- tag: BlockAll
securityGroupType: existing (designation of existing for security group 1)
DEMO_ODSG: (on-demand security group - security group 2))
type: Cloud.SecurityGroup
properties:
rules: (multiple firewall rules in this section)
- name: IN-ANY (rule 1)
source: any
service: any
direction: inbound
access: Deny
- name: IN-SSH (rule 2)
source: any
service: SSH
direction: inbound
access: Allow
- name: IN-SSH-IP (rule 3)
source: 33.33.33.1-33.33.33.250
protocol: TCP
ports: 223
direction: inbound
access: Allow
- name: IPv-6-ANY-SOURCE (rule 4)
source: '::/0'
protocol: TCP
ports: 223
direction: inbound
access: Allow
- name: IN-SSH-IP (rule 5)
source: 44.44.44.1/24
protocol: UDP
ports: 22-25
direction: inbound
access: Allow
- name: IN-EXISTING-SG (rule 6)
source: '${resource["DEMO_ESG"].id}'
protocol: ICMPv6
direction: inbound
access: Allow
- name: OUT-ANY (rule 7)
destination: any
service: any
direction: outbound
access: Deny
- name: OUT-TCP-IPv6 (rule 8)
destination: '2001:0db8:85a3::8a2e:0370:7334/64'
protocol: TCP
ports: 22
direction: outbound
access: Allow
- name: IPv6-ANY-DESTINATION (rule 9)
destination: '::/0'
protocol: UDP
ports: 23
direction: outbound
access: Allow
- name: OUT-UDP-SERVICE (rule 10)
destination: any
service: NTP
direction: outbound
access: Allow
securityGroupType: new (designation of on-demand for security group 2)
DEMO_VC_MACHINE: (machine resource)
type: Cloud.vSphere.Machine
properties:
image: PHOTON
cpuCount: 1
totalMemoryMB: 1024
networks: (Machine network NICs)
- network: '${resource.DEMO_NW.id}'
securityGroups:
- '${resource.DEMO_ODSG.id}'
- '${resource.DEMO_ESG.id}'
DEMO_NETWORK: (network resource)
type: Cloud.vSphere.Network
properties:
networkType: existing
constraints:
- tag: nsx62 |
Bilanciamenti del carico
| Scenario risorsa | Esempio di codice di progettazione del modello di cloud |
|---|---|
| Specificare un livello di registrazione, un algoritmo e una dimensione del bilanciamento del carico. |
Esempio di bilanciamento del carico NSX che mostra l'utilizzo del livello di registrazione, dell'algoritmo e della dimensione: resources:
Cloud_LoadBalancer_1:
type: Cloud.NSX.LoadBalancer
properties:
name: myapp-lb
network: '${appnet-public.name}'
instances: '${wordpress.id}'
routes:
- protocol: HTTP port: '80'
loggingLevel: CRITICAL
algorithm: LEAST_CONNECTION
type: MEDIUM
|
| Associare un bilanciamento del carico a una macchina denominata o a una scheda NIC di una macchina denominata. È possibile specificare Nel primo esempio, la distribuzione utilizza l'impostazione Nel secondo esempio, la distribuzione utilizza l'impostazione Il terzo esempio mostra entrambe le impostazioni utilizzate nella stessa opzione |
È possibile utilizzare la proprietà
instances per definire un ID macchina o un ID di rete della macchina:
|
Aggiungere le impostazioni di controllo dello stato a un bilanciamento del carico di NSX. Le opzioni aggiuntive includono httpMethod, requestBody e responseBody. |
myapp-lb: type: Cloud.NSX.LoadBalancer properties: name: myapp-lb network: '${appnet-public.name}' instances: '${wordpress.id}' routes: - protocol: HTTP port: '80' algorithm: ROUND_ROBIN instanceProtocol: HTTP instancePort: '80' healthCheckConfiguration: protocol: HTTP port: '80' urlPath: /mywordpresssite/wp-admin/install.php intervalSeconds: 60 timeoutSeconds: 10 unhealthyThreshold: 10 healthyThreshold: 2 connectionLimit: '50' connectionRateLimit: '50' maxConnections: '500' minConnections: '' internetFacing: true{code} |
| Rete su richiesta con un bilanciamento del carico a un solo braccio. |
inputs: {}
resources:
mp-existing:
type: Cloud.Network
properties:
name: mp-existing
networkType: existing
mp-wordpress:
type: Cloud.vSphere.Machine
properties:
name: wordpress
count: 2
flavor: small
image: tiny
customizationSpec: Linux
networks:
- network: '${resource["mp-private"].id}'
mp-private:
type: Cloud.NSX.Network
properties:
name: mp-private
networkType: private
constraints:
- tag: nsxt
mp-wordpress-lb:
type: Cloud.LoadBalancer
properties:
name: wordpress-lb
internetFacing: false
network: '${resource.mp-existing.id}'
instances: '${resource["mp-wordpress"].id}'
routes:
- protocol: HTTP
port: '80'
instanceProtocol: HTTP
instancePort: '80'
healthCheckConfiguration:
protocol: HTTP
port: '80'
urlPath: /index.pl
intervalSeconds: 60
timeoutSeconds: 30
unhealthyThreshold: 5
healthyThreshold: 2
|
| Rete esistente con un bilanciamento del carico. |
formatVersion: 1
inputs:
count:
type: integer
default: 1
resources:
ubuntu-vm:
type: Cloud.Machine
properties:
name: ubuntu
flavor: small
image: tiny
count: '${input.count}'
networks:
- network: '${resource.Cloud_NSX_Network_1.id}'
Provider_LoadBalancer_1:
type: Cloud.LoadBalancer
properties:
name: OC-LB
routes:
- protocol: HTTP
port: '80'
instanceProtocol: HTTP
instancePort: '80'
healthCheckConfiguration:
protocol: HTTP
port: '80'
urlPath: /index.html
intervalSeconds: 60
timeoutSeconds: 5
unhealthyThreshold: 5
healthyThreshold: 2
network: '${resource.Cloud_NSX_Network_1.id}'
internetFacing: false
instances: '${resource["ubuntu-vm"].id}'
Cloud_NSX_Network_1:
type: Cloud.NSX.Network
properties:
networkType: existing
constraints:
- tag: nsxt24prod |
Ulteriori informazioni
- vRealize Automation Cloud Assembly Load Balancer with NSX-T Deep Dive
- Network Automation with Cloud Assembly and NSX – Part 1 (include l'uso degli account cloud di NSX-T e vCenter e del CIDR della rete)
- Network Automation with Cloud Assembly and NSX – Part 2 (include l'utilizzo dei tipi di rete esistenti e in uscita)
- Network Automation with Cloud Assembly and NSX – Part 3 (include l'uso di gruppi di sicurezza esistenti e su richiesta)
- Network Automation with Cloud Assembly and NSX – Part 4 (include l'utilizzo di bilanciamenti del carico esistenti e su richiesta)