Ansible Role exoscale_vm
This role creates and manages instances (virtual machines) on Exoscale. It also allows creating other compontents for the instance, such as networks and firewall rules.
Runs on
Fedora 35
Fedora 38
Known Limitations
Resizing / scaling of instances is currently not supported
Mandatory Requirements
Install the exo command line tool and configure your Exoscale account using
exo config
on the Ansible control node.Install the
python3-cs
library on the Ansible control node.Import your public SSH-key into Exoscale (here). Ideally, set the key name to your local username, then you can use the default value for
exoscale_vm__ssh_key
.
Mandatory Role Variables
Variable |
Description |
---|---|
|
The name of the Exoscale account name as configured during |
|
Set the Exoscale API key. API keys can be managed here. We recommend creating a unrestricted key, because else some operations fail. |
|
Set the Exoscale secret corresponding to the API key. |
|
The Exoscale service offering. This defines the amount of CPU cores, RAM and disk space. The possible options can be obtained using |
|
The Exoscale template for the instance. The possible options can be obtained using |
|
The Exoscale zone the instance should be in. The possible options can be obtained using |
Example:
# mandatory
exoscale_vm__account: 'example'
exoscale_vm__api_key: 'EXOtn4Rg5ooosUALc1uNTqVTyTd'
exoscale_vm__api_secret: '4Is7jmDfzCONfJtEfxqX1VePSK9p7iZLafJy9ItC'
exoscale_vm__service_offering: 'standard.tiny'
exoscale_vm__template: 'Rocky Linux 8 (Green Obsidian) 64-bit'
exoscale_vm__zone: 'ch-dk-2'
Optional Role Variables
Variable |
Description |
Default Value |
---|---|---|
|
The disk size in GBs. Has to be higher than 10. Note that adjusting the disk size currently is currently not supported. |
|
|
The name of the instance. By default, the Ansible inventory name prefixed with |
|
|
Boolean to choose if the instance should be „private“ without a public IP, or not. |
|
|
A list of dictionaries defining which networks should be attached to this instance. It also allows the creation of new internal networks, or setting a fixed IP for the instance. Subkeys:
|
unset |
|
A list of dictionaries containing rules for the security group (basically Exoscale firewall rules). Subkeys:
|
unset |
|
The name of the SSH-key depoited in Exoscale here. Defaults to using the local username of the Ansible control node. |
|
|
The state of the instance. Possible options:
|
|
Example:
# optional
exoscale_vm__disk_size: 10
exoscale_vm__name: '{{ inventory_hostname }}'
exoscale_vm__private_instance: false
exoscale_vm__private_networks:
- name: 'net-prod01'
cidr: '192.0.2.0/24'
fixed_ip: '192.0.2.1'
exoscale_vm__security_group_rules:
- type: 'ingress'
protocol: 'tcp'
start_port: 22
end_port: 22
exoscale_vm__ssh_key: '{{ lookup("env", "USER") }}'
exoscale_vm__state: 'started'