Skip to content

Commit

Permalink
Merge pull request #502 from nutanix/imprv/lint-fixes-examples
Browse files Browse the repository at this point in the history
Adding ansible lint fixes for examples directory
  • Loading branch information
george-ghawali authored Oct 8, 2024
2 parents 2457d0f + 5360e2b commit db7120a
Show file tree
Hide file tree
Showing 84 changed files with 1,922 additions and 1,936 deletions.
9 changes: 3 additions & 6 deletions examples/acp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
- name: ACP playbook
hosts: localhost
gather_facts: false
collections:
- nutanix.ncp
module_defaults:
group/nutanix.ncp.ntnx:
nutanix_host: <pc_ip>
Expand All @@ -12,10 +10,9 @@
validate_certs: false

tasks:

- name: Create ACP with all specfactions
ntnx_acps:
validate_certs: False
nutanix.ncp.ntnx_acps:
validate_certs: false
state: present
nutanix_host: "{{ IP }}"
nutanix_username: "{{ username }}"
Expand All @@ -41,7 +38,7 @@
collection: ALL

- name: Delete ACP
ntnx_acps:
nutanix.ncp.ntnx_acps:
state: absent
acp_uuid: "{{ acp_uuid }}"
register: result
11 changes: 4 additions & 7 deletions examples/acp_info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
- name: ACP_Info playbook
hosts: localhost
gather_facts: false
collections:
- nutanix.ncp
module_defaults:
group/nutanix.ncp.ntnx:
nutanix_host: <pc_ip>
Expand All @@ -12,20 +10,19 @@
validate_certs: false

tasks:

- name: List ACPs using ascending, sorting and name filter
ntnx_floating_ips_info:
nutanix.ncp.ntnx_acps_info:
filter:
name: "{{ acp_name }}"
kind: access_control_policy
sort_order: "ASCENDING"
sort_attribute: "name"
register: result
ignore_errors: True
ignore_errors: true

- name: List ACPs using length and offset
ntnx_floating_ips_info:
nutanix.ncp.ntnx_acps_info:
length: 3
offset: 0
register: result
ignore_errors: True
ignore_errors: true
14 changes: 6 additions & 8 deletions examples/address_groups_crud.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
- name: Address group crud playbook. Here we will create, update, read and delete the address group.
hosts: localhost
gather_facts: false
collections:
- nutanix.ncp
module_defaults:
group/nutanix.ncp.ntnx:
nutanix_host: <pc_ip>
Expand All @@ -11,7 +9,7 @@
validate_certs: false
tasks:
- name: Create a address group
ntnx_address_groups:
nutanix.ncp.ntnx_address_groups:
state: present
name: test-ansible-group-1
desc: test-ansible-group-1-desc
Expand All @@ -22,8 +20,8 @@
network_prefix: 32
register: ag

- name: update address group
ntnx_address_groups:
- name: Update address group
nutanix.ncp.ntnx_address_groups:
state: present
address_group_uuid: "{{ ag.address_group_uuid }}"
name: test-ansible-group-1-updated
Expand All @@ -34,16 +32,16 @@
register: updated_ag

- name: Read the updated address group
ntnx_address_groups_info:
nutanix.ncp.ntnx_address_groups_info:
address_group_uuid: "{{ updated_ag.address_group_uuid }}"
register: ag_info

- name: Print the address group details
debug:
ansible.builtin.debug:
msg: "{{ ag_info }}"

- name: Delete the address group.
ntnx_address_groups:
nutanix.ncp.ntnx_address_groups:
state: absent
address_group_uuid: "{{ updated_ag.address_group_uuid }}"
register: op
24 changes: 11 additions & 13 deletions examples/category_crud.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
- name: categories crud playbook. Here we will create, update, read and delete the category key values.
- name: Categories crud playbook. Here we will create, update, read and delete the category key values.
hosts: localhost
gather_facts: false
collections:
- nutanix.ncp
module_defaults:
group/nutanix.ncp.ntnx:
nutanix_host: <pc-ip>
Expand All @@ -11,22 +9,22 @@
validate_certs: false
tasks:
- name: Create only category key with description
ntnx_categories:
nutanix.ncp.ntnx_categories:
state: "present"
name: "test-cat-1"
desc: "test-cat-1-desc"
register: cat1

- name: Add category values to test-cat-1
ntnx_categories:
nutanix.ncp.ntnx_categories:
state: "present"
name: "test-cat-1"
values:
- "val1"
- "val2"

- name: Create category key with values
ntnx_categories:
nutanix.ncp.ntnx_categories:
state: "present"
name: "test-cat-2"
desc: "test-cat-2-desc"
Expand All @@ -36,33 +34,33 @@
register: cat2

- name: Add more category values to test-cat-2
ntnx_categories:
nutanix.ncp.ntnx_categories:
state: "present"
name: "test-cat-2"
values:
- "val5"
- "val6"

- name: Get categories info
ntnx_categories_info:
nutanix.ncp.ntnx_categories_info:
name: "test-cat-1"
register: cat1_info

- name: Delete val1 category value from test-cat-1
ntnx_categories:
nutanix.ncp.ntnx_categories:
state: absent
name: "test-cat-1"
values:
- val1

- name: delete all category values from test-cat-1
ntnx_categories:
- name: Delete all category values from test-cat-1
nutanix.ncp.ntnx_categories:
state: absent
name: "test-cat-1"
remove_values: true

- name: delete category key test-cat-2 including its all values
ntnx_categories:
- name: Delete category key test-cat-2 including its all values
nutanix.ncp.ntnx_categories:
state: absent
name: "test-cat-2"
remove_values: true
44 changes: 21 additions & 23 deletions examples/clusters_info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
- name: Clusters_Info playbook
hosts: localhost
gather_facts: false
collections:
- nutanix.ncp
module_defaults:
group/nutanix.ncp.ntnx:
nutanix_host: <pc_ip>
Expand All @@ -12,27 +10,27 @@
validate_certs: false

tasks:
- name: test getting all clusters
ntnx_clusters_info:
register: clusters
- name: Test getting all clusters
nutanix.ncp.ntnx_clusters_info:
register: clusters

- name: test getting particular cluster using uuid
ntnx_clusters_info:
cluster_uuid: '{{ clusters.response.entities[0].metadata.uuid }}'
register: result
- name: Test getting particular cluster using uuid
nutanix.ncp.ntnx_clusters_info:
cluster_uuid: "{{ clusters.response.entities[0].metadata.uuid }}"
register: result

- name: List clusters using length, offset, sort order and priority sort attribute
ntnx_clusters_info:
length: 2
offset: 0
sort_order: "ASCENDING"
sort_attribute: "name"
register: result
- name: List clusters using length, offset, sort order and priority sort attribute
nutanix.ncp.ntnx_clusters_info:
length: 2
offset: 0
sort_order: "ASCENDING"
sort_attribute: "name"
register: result

- name: List clusters using filter and custom_filter
ntnx_clusters_info:
filter:
name: <name>
custom_filter:
external_ip: <external_ip>
register: result
- name: List clusters using filter and custom_filter
nutanix.ncp.ntnx_clusters_info:
filter:
name: <name>
custom_filter:
external_ip: <external_ip>
register: result
Loading

0 comments on commit db7120a

Please sign in to comment.