community.general.one_service module – Deploy and manage OpenNebula services
Note
This module is part of the community.general collection (version 9.4.0).
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.one_service
.
Synopsis
Manage OpenNebula services
Parameters
Parameter |
Comments |
---|---|
Password of the user to login into OpenNebula OneFlow API server. If not set then the value of the |
|
URL of the OpenNebula OneFlow API server. It is recommended to use HTTPS so that the username/password are not transferred over the network unencrypted. If not set then the value of the |
|
Name of the user to login into the OpenNebula OneFlow API server. If not set then the value of the |
|
Number of VMs for the specified role. |
|
Dictionary of key/value custom attributes which will be used when instantiating a new service. Default: |
|
Force the new cardinality even if it is outside the limits. Choices:
|
|
ID of the group which will be set as the group of the service. |
|
Set permission mode of a service instance in octet format, for example |
|
ID of the user which will be set as the owner of the service. |
|
Name of the role whose cardinality should be changed. |
|
ID of a service instance that you would like to manage. |
|
Name of a service instance that you would like to manage. |
|
Choices:
|
|
ID of a service template to use to create a new instance of a service. |
|
Name of service template to use to create a new instance of a service. |
|
Setting Choices:
|
|
Wait for the instance to reach RUNNING state after DEPLOYING or COOLDOWN state after SCALING. Choices:
|
|
How long before wait gives up, in seconds. Default: |
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full |
Can run in |
|
Support: none |
Will return details on what has changed (or possibly needs changing in |
Examples
- name: Instantiate a new service
community.general.one_service:
template_id: 90
register: result
- name: Print service properties
ansible.builtin.debug:
msg: result
- name: Instantiate a new service with specified service_name, service group and mode
community.general.one_service:
template_name: 'app1_template'
service_name: 'app1'
group_id: 1
mode: '660'
- name: Instantiate a new service with template_id and pass custom_attrs dict
community.general.one_service:
template_id: 90
custom_attrs:
public_network_id: 21
private_network_id: 26
- name: Instantiate a new service 'foo' if the service doesn't already exist, otherwise do nothing
community.general.one_service:
template_id: 53
service_name: 'foo'
unique: true
- name: Delete a service by ID
community.general.one_service:
service_id: 153
state: absent
- name: Get service info
community.general.one_service:
service_id: 153
register: service_info
- name: Change service owner, group and mode
community.general.one_service:
service_name: 'app2'
owner_id: 34
group_id: 113
mode: '600'
- name: Instantiate service and wait for it to become RUNNING
community.general.one_service:
template_id: 43
service_name: 'foo1'
- name: Wait service to become RUNNING
community.general.one_service:
service_id: 112
wait: true
- name: Change role cardinality
community.general.one_service:
service_id: 153
role: bar
cardinality: 5
- name: Change role cardinality and wait for it to be applied
community.general.one_service:
service_id: 112
role: foo
cardinality: 7
wait: true
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
service’s group id Returned: success Sample: |
|
service’s group name Returned: success Sample: |
|
service’s mode Returned: success Sample: |
|
service’s owner id Returned: success Sample: |
|
service’s owner name Returned: success Sample: |
|
list of dictionaries of roles, each role is described by name, cardinality, state and nodes ids Returned: success Sample: |
|
service id Returned: success Sample: |
|
service name Returned: success Sample: |
|
state of service instance Returned: success Sample: |