Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/1.9.1 #428

Merged
merged 44 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
0bc4af7
example fix (#420)
Gevorg-Khachatryan-97 Oct 25, 2023
73e846b
Add cluster URL to response only when there is cluster creation (#402)
bhati-pradeep Oct 25, 2023
e3629ff
fiql string in filtering (#423)
Gevorg-Khachatryan-97 Oct 25, 2023
d1a0016
Bug/issue#383 (#411)
alaa-bish Oct 25, 2023
0054cc9
Fix #391 and #418 (#419)
bhati-pradeep Oct 25, 2023
8579162
functionality to update owner of vms (#412)
Gevorg-Khachatryan-97 Oct 25, 2023
b32df80
example for vms inventory (#410)
Gevorg-Khachatryan-97 Oct 25, 2023
7171027
fix for custom filter and examples (#417)
Gevorg-Khachatryan-97 Oct 30, 2023
f5e9dca
example for vms inventory (#426)
Gevorg-Khachatryan-97 Oct 30, 2023
efb51fd
Add support for PC Categories (#405)
Gianlu Oct 30, 2023
8d01d81
Bug/issue#400 (#403)
Gevorg-Khachatryan-97 Oct 30, 2023
97c2d8b
example for VMs with guest customization file which injects variables…
Gevorg-Khachatryan-97 Oct 30, 2023
5069b95
Fix: Syntax Errors in Create App Security Rule Ex (#394)
Nathaniel-Roberts Oct 30, 2023
74908fe
functionality to handle issue when size of new disk is absent (#393)
Gevorg-Khachatryan-97 Oct 30, 2023
46ca173
example fix (#392)
Gevorg-Khachatryan-97 Oct 30, 2023
5c94380
sanity fix
alaa-bish Oct 31, 2023
7a9f51a
fix for issue#360 (#408)
Gevorg-Khachatryan-97 Oct 31, 2023
54d0bef
improve clone examples (#407)
alaa-bish Oct 31, 2023
2fae70f
sanity fix
alaa-bish Oct 31, 2023
d60ffd1
disbale tests
alaa-bish Nov 1, 2023
236af45
Enhance Acp Tests
alaa-bish Nov 1, 2023
94b969c
fix disks issue when size gb is not given for clone image disks
bhati-pradeep Nov 1, 2023
78929dd
Merge pull request #429 from nutanix/bug/fix-backward-compatibility-i…
alaa-bish Nov 1, 2023
8407a3a
Set release version 1.9.1
alaa-bish Nov 2, 2023
7470a34
enable image tests
alaa-bish Nov 2, 2023
59981dc
enable foundation sanity test
alaa-bish Nov 6, 2023
fa9e332
Minor foundation test fix
bhati-pradeep Nov 6, 2023
9780a8f
Enable pc tests
bhati-pradeep Nov 6, 2023
6b5cd67
Enable karbon and foundation sanity
bhati-pradeep Nov 6, 2023
42120c3
disables tests
alaa-bish Nov 6, 2023
6b6e701
enables tests
alaa-bish Nov 6, 2023
85b4ce4
enable pc tests
alaa-bish Nov 6, 2023
7269bed
add tests for clones with latest snapshot. And enable clones and NDB …
bhati-pradeep Nov 6, 2023
4f1c197
Merge branch 'release/1.9.1' of github.com:nutanix/nutanix.ansible in…
bhati-pradeep Nov 6, 2023
4782dda
skip protection rules tests
bhati-pradeep Nov 6, 2023
1749b84
Add random naming for acp test with user reference
bhati-pradeep Nov 7, 2023
4a4a1f6
Bug/191 fix database sanity test (#430)
alaa-bish Nov 7, 2023
ec3113e
fix ntnx_database_sanity
bhati-pradeep Nov 7, 2023
9e688b1
Add Contributaiong (#431)
alaa-bish Nov 9, 2023
884064e
Release Notes and changelog changes
bhati-pradeep Nov 9, 2023
d03ceb2
Merge branch 'release/1.9.1' of github.com:nutanix/nutanix.ansible in…
bhati-pradeep Nov 9, 2023
f636c26
Minor typo fix
bhati-pradeep Nov 9, 2023
2cdba39
remove unrequired file
bhati-pradeep Nov 9, 2023
0a65a3e
Minor release bug list change due to non cherry picks
bhati-pradeep Nov 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions examples/clusters_info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,11 @@
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
9 changes: 9 additions & 0 deletions examples/fip_info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,12 @@
offset: 0
register: result
ignore_errors: True


- name: List floating_ips using filter and custom_filter
ntnx_floating_ips_info:
filter:
name: <name>
custom_filter:
private_ip: <private_ip>
register: result
8 changes: 8 additions & 0 deletions examples/hosts_info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,11 @@
sort_attribute: "name"
register: result
ignore_errors: True

- name: List hosts using filter and custom_filter
ntnx_hosts_info:
filter:
name: <name>
custom_filter:
serial_number: <serial_number>
register: result
7 changes: 7 additions & 0 deletions examples/inventory/ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[defaults]
inventory = nutanix.yaml

[inventory]
enable_plugins = nutanix.ncp.ntnx_prism_vm_inventory


13 changes: 13 additions & 0 deletions examples/inventory/nutanix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugin: nutanix.ncp.ntnx_prism_vm_inventory
nutanix_hostname: <pc_ip>
nutanix_username: <username>
nutanix_password: <password>
validate_certs: false
data: {"offset": 0, "length": 1000}
groups:
group_1: "'<name_prefix>' in name"
group_2: "'<vm_name>'==name"
keyed_groups:
- prefix: "host"
separator: ':'
key: "ansible_host"
13 changes: 13 additions & 0 deletions examples/inventory/nutanix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugin: nutanix.ncp.ntnx_prism_vm_inventory
nutanix_host: <pc_ip>
nutanix_username: <user>
nutanix_password: <pass>
validate_certs: false
data: {"offset": 0, "length": 1000}
groups:
group_1: "'<name_prefix>' in name"
group_2: "'<vm_name>'==name"
keyed_groups:
- prefix: "host"
separator: ':'
key: "ansible_host"
121 changes: 121 additions & 0 deletions examples/ndb/create_clone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
---
- name: Create clone
hosts: localhost
gather_facts: false
collections:
- nutanix.ncp
module_defaults:
group/nutanix.ncp.ntnx:
nutanix_host: <ndb-era-ip>
nutanix_username: <username>
nutanix_password: <password>
validate_certs: false

tasks:
- set_fact:
clone_db:
name: <Clone Db Name>
db_params_profile:
name: <Db Profile Name>
vm:
name: <Vm Name>
password: <Vm password>
cluster:
name: <Cluster Name>
network_profile:
name: <Network Profile Name>
compute_profile:
name: <Compute Profile Name>
public_ssh_key: <Public SSH Key>
time_machine:
name: <Time Machine Name>
snapshot:
uuid: <Snapshot UUID>

- name: create clone using snapshot
ntnx_ndb_database_clones:
name: "{{clone_db.name}}"
desc: "ansible-created-clone"

db_params_profile:
name: "{{db_params_profile.name}}"

db_vm:
create_new_server:
name: "{{ vm.name }}"
desc: "vm for db server"
password: "{{ vm.password }}"
cluster:
name: "{{cluster.name}}"
network_profile:
name: "{{ network_profile.name }}"
compute_profile:
name: "{{ compute_profile.name }}"
pub_ssh_key: "{{ public_ssh_key }}"

postgres:
db_password: "{{vm.password}}"

time_machine:
name: "{{time_machine.name}}"
snapshot_uuid: "{{snapshot.uuid}}"

removal_schedule:
days: 2
timezone: "Asia/Calcutta"
remind_before_in_days: 1
delete_database: True

refresh_schedule:
days: 2
time: "12:00:00"
timezone: "Asia/Calcutta"

register: output

- debug:
msg: "{{output}}"

- name: create clone using point in time
ntnx_ndb_database_clones:
name: "{{clone_db.name}}"
desc: "ansible-created-clone"

db_params_profile:
name: "{{db_params_profile.name}}"

db_vm:
create_new_server:
name: "{{ vm.name }}"
desc: "vm for db server"
password: "{{ vm.password }}"
cluster:
name: "{{cluster.name}}"
network_profile:
name: "{{ network_profile.name }}"
compute_profile:
name: "{{ compute_profile.name }}"
pub_ssh_key: "{{ public_ssh_key }}"

postgres:
db_password: "{{vm.password}}"

time_machine:
name: "{{time_machine.name}}"
pitr_timestamp: "2023-02-28 12:00:00"
timestamp: "Asia/Calcutta"

removal_schedule:
days: 2
timezone: "Asia/Calcutta"
remind_before_in_days: 1
delete_database: True

refresh_schedule:
days: 2
time: "12:00:00"
timezone: "Asia/Calcutta"
register: output

- debug:
msg: "{{output}}"
40 changes: 40 additions & 0 deletions examples/ndb/refresh_clone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
- name: Create Refresh clone
hosts: localhost
gather_facts: false
collections:
- nutanix.ncp
module_defaults:
group/nutanix.ncp.ntnx:
nutanix_host: <ndb-era-ip>
nutanix_username: <username>
nutanix_password: <password>
validate_certs: false

tasks:
- set_fact:
clone_db:
uuid: <Clone Db UUID>
snapshot:
uuid: <Snapshot UUID>

- name: create spec for refresh clone to a pitr timestamp
check_mode: yes
ntnx_ndb_database_clone_refresh:
uuid: "{{clone_db.uuid}}"
pitr_timestamp: "2023-02-04 07:29:36"
timezone: "UTC"
register: output


- debug:
msg: "{{output}}"

- name: refresh db clone
ntnx_ndb_database_clone_refresh:
uuid: "{{clone_db.uuid}}"
snapshot_uuid: "{{snapshot.uuid}}"
register: output

- debug:
msg: "{{output}}"
9 changes: 9 additions & 0 deletions examples/subnet_info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,12 @@
check_mode: true
register: result
ignore_errors: True

- name: List subnets filter and custom_filter
ntnx_subnets_info:
filter:
name: <name>
custom_filter:
adapter_type: <adapter_type>
vswitch_name: <vswitch_name>
register: result
15 changes: 14 additions & 1 deletion examples/vm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@
script_path: ""
subnet_name: ""
image_name: ""
password: ""
fqdn: ""

- name: Create Cloud-init Script file
copy:
dest: "cloud_init.yml"
content: |
#cloud-config
chpasswd:
list: |
root: "{{ password }}"
expire: False
fqdn: "{{ fqdn }}"

- name: create Vm
ntnx_vms:
Expand Down Expand Up @@ -47,7 +60,7 @@
memory_gb: 1
guest_customization:
type: "cloud_init"
script_path: "{{ script_path }}"
script_path: "./cloud_init.yml"
is_overridable: True
register: output

Expand Down
17 changes: 16 additions & 1 deletion examples/vm_info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@
kind: vm
register: result
ignore_errors: True


- name: List vms using FIQL filter string
ntnx_vms_info:
filter_string: "vm_name=={{vm.name}};power_state==off"
register: result
ignore_errors: True

- name: List vms using length, offset and ascending vm_name sorting
ntnx_vms_info:
length: 10
Expand All @@ -31,3 +37,12 @@
sort_attribute: "vm_name"
register: result
ignore_errors: True

- name: List vms using filter and custom_filter
ntnx_vms_info:
filter:
vm_name: <name>
custom_filter:
num_sockets: <num_sockets>

register: result
3 changes: 1 addition & 2 deletions examples/vm_operations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@

- name: hard power off the vm
ntnx_vms:
state: present
state: hard_poweroff
vm_uuid: "{{ vm_uuid }}"
operation: hard_poweroff
register: result
ignore_errors: true

Expand Down
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace: "nutanix"
name: "ncp"
version: "1.9.0"
version: "1.9.1"
readme: "README.md"
authors:
- "Abhishek Chaudhary (@abhimutant)"
Expand Down
8 changes: 6 additions & 2 deletions plugins/doc_fragments/ntnx_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ class ModuleDocFragment(object):
type: int
filter:
description:
- The filter in FIQL syntax used for the results
- The filter in key-value syntax used for the results
type: dict
custom_filter:
description:
- The filter in FIQL syntax used for the results
- The filter in key-value syntax used for the results
type: dict
filter_string:
description:
- The filter in FIQL syntax used for the results
type: str
"""
15 changes: 15 additions & 0 deletions plugins/doc_fragments/ntnx_vms_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,19 @@ class ModuleDocFragment(object):
- CDROM
- DISK
- NETWORK
owner:
description: Name or UUID of the owner
required: false
type: dict
suboptions:
name:
description:
- Owner Name
- Mutually exclusive with C(uuid)
type: str
uuid:
description:
- Owner UUID
- Mutually exclusive with C(name)
type: str
"""
5 changes: 5 additions & 0 deletions plugins/inventory/ntnx_prism_vm_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ def parse(self, inventory, loader, path, cache=True):
for key, value in entity["status"]["resources"].items():
self.inventory.set_variable(vm_name, key, value)

if "metadata" in entity and "categories" in entity["metadata"]:
self.inventory.set_variable(
vm_name, "ntnx_categories", entity["metadata"]["categories"]
)

# Add variables created by the user's Jinja2 expressions to the host
self._set_composite_vars(
self.get_option("compose"),
Expand Down
9 changes: 9 additions & 0 deletions plugins/module_utils/base_info_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,21 @@ class BaseInfoModule(BaseModule):
length=dict(type="int"),
filter=dict(type="dict"),
custom_filter=dict(type="dict"),
filter_string=dict(type="str"),
)

info_args_mutually_exclusive = [
("filter", "filter_string"),
]

def __init__(self, skip_info_args=False, **kwargs):
self.argument_spec = deepcopy(BaseModule.argument_spec)
self.argument_spec.pop("state")
self.argument_spec.pop("wait")
if not skip_info_args:
self.argument_spec.update(self.info_argument_spec)
info_args_mutually_exclusive = deepcopy(self.info_args_mutually_exclusive)
if kwargs.get("mutually_exclusive"):
info_args_mutually_exclusive.extend(kwargs["mutually_exclusive"])
kwargs["mutually_exclusive"] = info_args_mutually_exclusive
super(BaseInfoModule, self).__init__(**kwargs)
Loading
Loading