Ansible is an open-source provisioning and configuration tool that supports infrastructure as code. Spot integration with Ansible allows you to use Ansible modules for creating, updating, and deleting Spot resources. This article explains how to roll an Elastigroup using Ansible instead of the Spot UI, using the Spot Ansible Cloud Modules collection.
Prerequisites and Setup
-
Install Ansible, Python, and the Python SDK on your local system.
-
Ensure you have the Spot modules installed from Ansible Galaxy:
ansible-galaxy collection install spot.cloud_modules -
Verify the modules installation with:
ansible-galaxy collection list -
Optionally, include the Spot collection in a
requirements.ymlfile and install:--- collections: - name: spot.cloud_modules ansible-galaxy collection install -r requirements.yml -
Ensure your credentials file (
creds.yaml) contains a valid Spot token and account ID.
Performing the Roll
-
Prepare the playbook by defining a task using the
spot.cloud_modules.aws_elastigroupmodule. -
Update a property, such as
image_id, and set the state topresent. Changing the image ID typically triggers a roll.
Example playbook structure:
- hosts: localhost
tasks: - name: Update and Roll Elastigroup
spot.cloud_modules.aws_elastigroup:
credentials_path: /path/to/creds.yaml
id: sig-12345678 # The Elastigroup ID to roll
state: present
image_id: ami-new-image-id # Changing this triggers the roll
# Include additional required configurations here
register: result
- debug: var=result
-
Execute the playbook:
ansible-playbook your-playbook-name.yaml
Roll Configuration Options
If you need advanced roll configurations, you can add the roll_config object in the Ansible configuration:
roll_config:
description:
- (Object) Roll configuration; used to roll the group after updating.
Accepts:
batch_size_percentage (Integer, Required)
grace_period (Integer, Required)
health_check_type (String, Optional)
Key Considerations
-
Health Signals: Some Ansible module versions may not wait for "green instances" before proceeding. Implement a
waitForCompletionlogic or add a delay if needed. -
Roll Behavior: Elastigroup roll is usually controlled by updating parameters like
image_idor using deployment strategies. -
Credentials: Ensure your credentials file is correctly configured with Spot token and account ID.
Related Articles
Configure an Elastigroup roll in Ansible 4Number of Views Fix the “Spotinst SDK library is required” error when using Ansible 5Number of Views Fix the “group is in error state” message when deleting an Elastigroup linked to Beanstalk 10Number of Views Utilising the DB to roll out an agent preference to all devices within a Target, or all devices in an OS family 12Number of Views How the Azure Elastigroup VM State health check works 6Number of Views
Hi, I am Reva - Ask me anything.
No new updates
Thanks for the feedback!
Your feedback has been saved.Rate this response:
Add Additional feedback ( Optional )
Are you sure you want to cancel
the case creation?
Are you sure you want to cancel the case creation?
Are you sure you want to close this case
| Products | Region | Phone Numbers |
|---|---|---|
| FlexNet Operations FlexNet Embedded FlexNet Publisher FlexNet Connect FlexNet Code Insight InstallAnywhere InstallShield |
North America * |
+1 630-332-2513 (toll) +1 877-279-2853 (toll-free in North America) |
| Europe * |
+44 1925 944367 (toll) +44 800 047 8642 (toll-free in Europe) |
|
| Japan * | +81 3-4540-5335 (select option 2) | |
| Australia * |
+61 3 9895 2177 +61 1800 560 603 (toll-free in Australia) |
|
|
Usage Intelligence (formerly
Revulytics) Compliance Intelligence |
Please use the Case Portal to submit your support ticket or reach out to your Revenera contact. | |
Revenera Assistant
Case id: 00001065
Activity: Status change: 2 hours ago