-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Azure stateful node support in Ansible (#8)
* Draft * Draft * updated version * Fixing documentation * Documentation Fixes * Fix type of preferred_zone parameter * debugging * reverting the MI changes made for debugging * Minor changes * Minor changes * updated version * Deletion Config Fixed * Fixing Tests * Fixing some of the lint Issues reported by sanity test run * Updating broken links in the README.md * Fixing module_utils location * Documentation Fixes * Updating python version in workflows * Correcting Image field dicts * Fixing the list parameters. * Changing HAS_ANSIBLE_MODULE to use global scope * Minor Fixes in data-types * Static Analysis Fixes * Update changelog.rst * review comments fixed * Resolved the module import error --------- Co-authored-by: John Samuel <john.samuel@netapp.com>
- Loading branch information
1 parent
c0814c9
commit 6c28347
Showing
17 changed files
with
1,916 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
@SHxKM | ||
@zivmessing | ||
@zivmessing | ||
@anuragsharma-123 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## Azure Stateful Node | ||
<!--ts--> | ||
* [Create a Stateful Node](azure-stateful-node-detailed.yaml) | ||
* [Perform an action on a Stateful Node](azure-stateful-node-with-action.yaml) | ||
* [Delete a Stateful Node](azure-stateful-node-delete.yaml) | ||
<!--te--> |
79 changes: 79 additions & 0 deletions
79
docs/examples/stateful_node/azure-stateful-node-delete.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
- hosts: localhost | ||
tasks: | ||
- name: stateful_node | ||
spot.cloud_modules.azure_stateful_node: | ||
state: absent # absent = delete, present = create/update | ||
uniqueness_by: "id" | ||
id: "ssn-648a40b1" | ||
do_not_update: | ||
- region | ||
- resource_group_name | ||
stateful_node_config: | ||
deletion_config: | ||
deallocation_config: | ||
disk_deallocation_config: | ||
should_deallocate: true | ||
ttl_in_hours: 0 | ||
network_deallocation_config: | ||
should_deallocate: true | ||
ttl_in_hours: 0 | ||
public_ip_deallocation_config: | ||
should_deallocate: true | ||
ttl_in_hours: 0 | ||
snapshot_deallocation_config: | ||
should_deallocate: true | ||
ttl_in_hours: 0 | ||
should_terminate_vm: true | ||
stateful_node: | ||
name: "ansible-stateful-node-example-with-action" | ||
description: "a sample Stateful Node created via Ansible" | ||
region: "eastus" | ||
resource_group_name: "AutomationResourceGroup" | ||
persistence: | ||
data_disks_persistence_mode: "reattach" | ||
os_disk_persistence_mode: "reattach" | ||
should_persist_data_disks: true | ||
should_persist_network: true | ||
should_persist_os_disk: true | ||
health: | ||
health_check_types: ["vmState"] | ||
auto_healing: true | ||
grace_period: 300 | ||
unhealthy_duration: 120 | ||
scheduling: | ||
tasks: | ||
- is_enabled: false | ||
cron_expression: "* * * 1 *" | ||
type: "pause" | ||
- is_enabled: true | ||
cron_expression: "* * * 2 *" | ||
type: "resume" | ||
strategy: | ||
draining_timeout: 300 | ||
fallback_to_od: true | ||
preferred_lifecycle: "spot" | ||
revert_to_spot: | ||
perform_at: "always" | ||
signals: | ||
- timeout: 180 | ||
type: "vmReady" | ||
- timeout: 210 | ||
type: "vmReadyToShutdown" | ||
compute: | ||
zones: ["1", "2"] | ||
preferred_zone: "2" | ||
vm_sizes: | ||
od_sizes: ["standard_a1_v2", "standard_a2_v2"] | ||
spot_sizes: ["standard_a1_v2", "standard_a2_v2"] | ||
preferred_spot_sizes: ["standard_a1_v2"] | ||
launch_specification: | ||
boot_diagnostics: | ||
is_enabled: true | ||
type: "managed" | ||
tags: | ||
- tag_key: "Creator" | ||
tag_value: "Ansible Test" | ||
- tag_key: "Name" | ||
tag_value: "Ansible Detailed Example With Action" | ||
register: result | ||
- debug: var=result |
93 changes: 93 additions & 0 deletions
93
docs/examples/stateful_node/azure-stateful-node-detailed.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
- hosts: localhost | ||
tasks: | ||
- name: stateful_node | ||
spot.cloud_modules.azure_stateful_node: | ||
state: present # absent = delete, present = create/update | ||
uniqueness_by: "id" | ||
do_not_update: | ||
- region | ||
- resource_group_name | ||
stateful_node: | ||
name: "ansible-stateful-node-example" | ||
description: "a sample Stateful Node created via Ansible" | ||
region: "eastus" | ||
resource_group_name: "AutomationResourceGroup" | ||
persistence: | ||
data_disks_persistence_mode: "reattach" | ||
os_disk_persistence_mode: "reattach" | ||
should_persist_data_disks: true | ||
should_persist_network: true | ||
should_persist_os_disk: true | ||
health: | ||
health_check_types: ["vmState"] | ||
auto_healing: true | ||
grace_period: 300 | ||
unhealthy_duration: 120 | ||
scheduling: | ||
tasks: | ||
- is_enabled: true | ||
cron_expression: "* * * 1 *" | ||
type: "pause" | ||
- is_enabled: false | ||
cron_expression: "* * * 2 *" | ||
type: "resume" | ||
strategy: | ||
draining_timeout: 300 | ||
fallback_to_od: true | ||
preferred_lifecycle: "spot" | ||
revert_to_spot: | ||
perform_at: "always" | ||
signals: | ||
- timeout: 180 | ||
type: "vmReady" | ||
- timeout: 210 | ||
type: "vmReadyToShutdown" | ||
compute: | ||
os: "Linux" | ||
zones: ["1", "2"] | ||
preferred_zone: "2" | ||
vm_sizes: | ||
od_sizes: ["standard_a1_v2", "standard_a2_v2"] | ||
spot_sizes: ["standard_a1_v2", "standard_a2_v2"] | ||
preferred_spot_sizes: ["standard_a1_v2"] | ||
launch_specification: | ||
boot_diagnostics: | ||
is_enabled: true | ||
type: "managed" | ||
custom_data: "VGhpcyBpcyBjdXN0b20gZGF0YSBmaWVsZA==" | ||
data_disks: | ||
- lun: 0 | ||
size_g_b: 30 | ||
type: "Standard_LRS" | ||
- lun: 1 | ||
size_g_b: 32 | ||
type: "StandardSSD_LRS" | ||
image: | ||
marketplace: | ||
publisher: "Canonical" | ||
version: "latest" | ||
sku: "18.04-LTS" | ||
offer: "UbuntuServer" | ||
login: | ||
user_name: "ubuntu" | ||
ssh_public_key: <provide-your-ssh-key-here> | ||
network: | ||
resource_group_name: "AutomationResourceGroup" | ||
virtual_network_name: "Automation-VirtualNetwork" | ||
network_interfaces: | ||
- is_primary: true | ||
assign_public_ip: true | ||
public_ip_sku: "Standard" | ||
subnet_name: "Automation-PrivateSubnet" | ||
enable_ip_forwarding: true | ||
os_disk: | ||
size_g_b: 30 | ||
type: "Standard_LRS" | ||
shutdown_script: "VGhpcyBpcyBzaHV0ZG93biBzY3JpcHQ=" | ||
tags: | ||
- tag_key: "Creator" | ||
tag_value: "Ansible Test" | ||
- tag_key: "Name" | ||
tag_value: "Ansible Detailed Example" | ||
register: result | ||
- debug: var=result |
64 changes: 64 additions & 0 deletions
64
docs/examples/stateful_node/azure-stateful-node-with-action.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
- hosts: localhost | ||
tasks: | ||
- name: stateful_node | ||
spot.cloud_modules.azure_stateful_node: | ||
state: present # absent = delete, present = create/update | ||
uniqueness_by: "id" | ||
id: "ssn-648a40b1" | ||
do_not_update: | ||
- region | ||
- resource_group_name | ||
action: "pause" # resume, recycle <------ if you would just like to perform an action, leave all other fields as is and include this line. | ||
stateful_node: | ||
name: "ansible-stateful-node-example-with-action" | ||
description: "a sample Stateful Node created via Ansible" | ||
region: "eastus" | ||
resource_group_name: "AutomationResourceGroup" | ||
persistence: | ||
data_disks_persistence_mode: "reattach" | ||
os_disk_persistence_mode: "reattach" | ||
should_persist_data_disks: true | ||
should_persist_network: true | ||
should_persist_os_disk: true | ||
health: | ||
health_check_types: ["vmState"] | ||
auto_healing: true | ||
grace_period: 300 | ||
unhealthy_duration: 120 | ||
scheduling: | ||
tasks: | ||
- is_enabled: false | ||
cron_expression: "* * * 1 *" | ||
type: "pause" | ||
- is_enabled: true | ||
cron_expression: "* * * 2 *" | ||
type: "resume" | ||
strategy: | ||
draining_timeout: 300 | ||
fallback_to_od: true | ||
preferred_lifecycle: "spot" | ||
revert_to_spot: | ||
perform_at: "always" | ||
signals: | ||
- timeout: 180 | ||
type: "vmReady" | ||
- timeout: 210 | ||
type: "vmReadyToShutdown" | ||
compute: | ||
zones: ["1", "2"] | ||
preferred_zone: "2" | ||
vm_sizes: | ||
od_sizes: ["standard_a1_v2", "standard_a2_v2"] | ||
spot_sizes: ["standard_a1_v2", "standard_a2_v2"] | ||
preferred_spot_sizes: ["standard_a1_v2"] | ||
launch_specification: | ||
boot_diagnostics: | ||
is_enabled: true | ||
type: "managed" | ||
tags: | ||
- tag_key: "Creator" | ||
tag_value: "Ansible Test" | ||
- tag_key: "Name" | ||
tag_value: "Ansible Detailed Example With Action" | ||
register: result | ||
- debug: var=result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.