Skip to content

Commit

Permalink
Add examples for images and static routes(#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
alaa-bish authored Sep 18, 2022
1 parent 9b808f5 commit 62eb4f4
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 0 deletions.
84 changes: 84 additions & 0 deletions examples/images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
- name: Images playbook
hosts: localhost
gather_facts: false
collections:
- nutanix.ncp
module_defaults:
group/nutanix.ncp.ntnx:
nutanix_host: <host_ip>
nutanix_username: <user>
nutanix_password: <pass>
validate_certs: false
tasks:
- name: Setting Variables
set_fact:
image_uuid: ""
source_path: ""
source_uri: ""
clusters_name: ""

- name: create image from local workstation
ntnx_images:
state: "present"
source_path: "{{source_path}}"
clusters:
- name: "{{clusters_name}}"
categories:
AppFamily:
- Backup
checksum:
checksum_algorithm: SHA_1
checksum_value: 44610efd741a3ab4a548a81ea94869bb8b692977
name: "ansible-test-with-categories-mapping"
desc: "description"
image_type: "ISO_IMAGE"
version:
product_name: "test"
product_version: "1.2.0"
wait: true

- name: create image from with source as remote server file location
ntnx_images:
state: "present"
source_uri: "{{source_uri}}"
clusters:
- name: "{{clusters_name}}"
categories:
AppFamily:
- Backup
checksum:
checksum_algorithm: SHA_1
checksum_value: 44610efd741a3ab4a548a81ea94869bb8b692977
name: "ansible-test-with-categories-mapping"
desc: "description"
image_type: "DISK_IMAGE"
version:
product_name: "test"
product_version: "1.2.0"
wait: true

- name: override categories of existing image
ntnx_images:
state: "present"
image_uuid: "{{image-uuid}}"
categories:
AppTier:
- Default
AppFamily:
- Backup
wait: true

- name: dettach all categories from existing image
ntnx_images:
state: "present"
image_uuid: "00000000-0000-0000-0000-000000000000"
remove_categories: true
wait: true

- name: delete existing image
ntnx_images:
state: "absent"
image_uuid: "00000000-0000-0000-0000-000000000000"
wait: true

46 changes: 46 additions & 0 deletions examples/static_routes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
- name: Static Routes playbook
hosts: localhost
gather_facts: false
collections:
- nutanix.ncp
module_defaults:
group/nutanix.ncp.ntnx:
nutanix_host: <host_ip>
nutanix_username: <user>
nutanix_password: <pass>
validate_certs: false
tasks:
- name: Setting Variables
set_fact:
vpc_uuid: ""
vpn_uuid: ""
external_nat_subnet:
name: ""
uuid: ""

- name: create static routes and default static routes with external nat subnet
ntnx_static_routes:
vpc_uuid: "{{ vpc_uuid }}"
static_routes:
- destination: "0.0.0.0/0"
next_hop:
external_subnet_ref:
name: "{{ external_nat_subnet.name }}"
- destination: "10.2.2.0/24"
next_hop:
external_subnet_ref:
uuid: "{{ external_nat_subnet.uuid }}"
- destination: "10.2.3.0/24"
next_hop:
external_subnet_ref:
uuid: "{{ external_nat_subnet.uuid }}"
- destination: "10.2.4.0/24"
next_hop:
vpn_connection_ref:
uuid: "{{ vpn_uuid }}"

- name: remove all routes excluding dynamic and local routes
ntnx_static_routes:
vpc_uuid: "{{ vpc_uuid }}"
remove_all_routes: true

0 comments on commit 62eb4f4

Please sign in to comment.