source: | cloud/oracle/oci_vnic_attachment.py |
---|---|
orphan: |
oci_vnic_attachment -- Create a secondary VNIC and attach it to a compute instance, detach or delete VNIC attachments from a compute instance
.. versionadded:: 2.5
- This module allows the user to create a secondary VNIC and attach it to a compute instance, detach a secondary VNIC attachment from a compute instance, and delete the secondary VNIC.
The below requirements are needed on the host that executes this module.
- python >= 2.7
- Python SDK for Oracle Cloud Infrastructure https://oracle-cloud-infrastructure-python-sdk.readthedocs.io
Parameter | Choices/Defaults | Comments | |
---|---|---|---|
api_user
string
|
The OCID of the user, on whose behalf, OCI APIs are invoked. If not set, then the value of the OCI_USER_ID environment variable, if any, is used. This option is required if the user is not specified through a configuration file (See
config_file_location ). To get the user's OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm. |
||
api_user_fingerprint
string
|
Fingerprint for the key pair being used. If not set, then the value of the OCI_USER_FINGERPRINT environment variable, if any, is used. This option is required if the key fingerprint is not specified through a configuration file (See
config_file_location ). To get the key pair's fingerprint value please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm. |
||
api_user_key_file
string
|
Full path and filename of the private key (in PEM format). If not set, then the value of the OCI_USER_KEY_FILE variable, if any, is used. This option is required if the private key is not specified through a configuration file (See
config_file_location ). If the key is encrypted with a pass-phrase, the api_user_key_pass_phrase option must also be provided. |
||
api_user_key_pass_phrase
string
|
Passphrase used by the key referenced in
api_user_key_file , if it is encrypted. If not set, then the value of the OCI_USER_KEY_PASS_PHRASE variable, if any, is used. This option is required if the key passphrase is not specified through a configuration file (See config_file_location ). |
||
auth_type
string
|
|
The type of authentication to use for making API requests. By default
auth_type="api_key" based authentication is performed and the API key (see api_user_key_file) in your config file will be used. If this 'auth_type' module option is not specified, the value of the OCI_ANSIBLE_AUTH_TYPE, if any, is used. Use auth_type="instance_principal" to use instance principal based authentication when running ansible` playbooks within an OCI compute instance. |
|
config_file_location
string
|
Path to configuration file. If not set then the value of the OCI_CONFIG_FILE environment variable, if any, is used. Otherwise, defaults to ~/.oci/config.
|
||
config_profile_name
string
|
The profile to load from the config file referenced by
config_file_location . If not set, then the value of the OCI_CONFIG_PROFILE environment variable, if any, is used. Otherwise, defaults to the "DEFAULT" profile in config_file_location . |
||
display_name
-
|
A user-friendly name to be associated with the VNIC attachment. This does not have to be unique, and can be changed later.
aliases: name |
||
instance_id
-
|
The OCID of the instance to which the secondary VNIC must be attached. Required when a secondary VNIC needs to be created and attached to an instance with state=present.
|
||
nic_index
-
|
Specifies the physical network interface card (NIC) the VNIC will use. Defaults to 0. Certain bare metal instance shapes have two active physical NICs (0 and 1). When a secondary VNIC is added to one of these instances, the NIC that the VNIC will use can be specified using
nic_index . This option may be specified while creating a VNIC and attaching to an instance using state=present. |
||
region
string
|
The Oracle Cloud Infrastructure region to use for all OCI API requests. If not set, then the value of the OCI_REGION variable, if any, is used. This option is required if the region is not specified through a configuration file (See
config_file_location ). Please refer to https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm for more information on OCI regions. |
||
state
-
|
|
The state of the VNIC attachment that must be asserted to. When state=present, and the VNIC attachment doesn't exist, the secondary VNIC is created with the specified details, and is attached to the specified compute instance. When state=absent, the secondary VNIC is detached from the compute instance and deleted.
|
|
tenancy
string
|
OCID of your tenancy. If not set, then the value of the OCI_TENANCY variable, if any, is used. This option is required if the tenancy OCID is not specified through a configuration file (See
config_file_location ). To get the tenancy OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm |
||
vnic
-
|
Details for creating a new secondary VNIC. This option must be specified when a secondary VNIC needs to be created and associated with an instance using state=present.
aliases: create_vnic_details |
||
assign_public_ip
-
|
Determines whether the secondary VNIC should be assigned a public IP address. If not set and the VNIC is being created in a private subnet (that is, where prohibitPublicIpOnVnic = true in the Subnet), then no public IP address is assigned. If not set and the subnet is public prohibitPublicIpOnVnic = false, then a public IP address is assigned. If set to true and prohibitPublicIpOnVnic = true, an error is returned.
|
||
defined_tags
-
|
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm.
|
||
display_name
-
|
A user-friendly name for the VNIC. Does not have to be unique.
|
||
freeform_tags
-
|
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm.
|
||
hostname_label
-
|
The hostname for the VNIC's primary private IP. Used for DNS. The value is the hostname portion of the primary private IP's fully qualified domain name (FQDN) (for example, bminstance-1 in FQDN bminstance-1.subnet123.vcn1.oraclevcn.com). Must be unique across all VNICs in the subnet and comply with RFC 952 and RFC 1123.
|
||
nsg_ids
-
|
A list of the OCIDs of the network security groups (NSGs) to add the VNIC to. For more information about NSGs, see NetworkSecurityGroup NetworkSecurityGroup.
|
||
private_ip
-
|
The private IP to assign to the VNIC. Must be an available IP address within the subnet's CIDR. If you don't specify a value, Oracle automatically assigns a private IP address from the subnet. This is the VNIC's primary private IP address.
|
||
skip_source_dest_check
-
|
Default: "no"
|
Determines whether the source/destination check is disabled on the VNIC. Defaults to false, which means the check is performed.
|
|
subnet_id
-
/ required
|
The OCID of the subnet to create the VNIC in.
|
||
vnic_attachment_id
-
|
The OCID of the VNIC attachment. Required when a secondary VNIC needs to be detached from a compute instance and deleted using state=absent.
aliases: id |
||
wait
boolean
|
|
Whether to wait for create or delete operation to complete.
|
|
wait_timeout
integer
|
Default: 2000
|
Time, in seconds, to wait when wait=yes.
|
|
wait_until
string
|
The lifecycle state to wait for the resource to transition into when wait=yes. By default, when wait=yes, we wait for the resource to get into ACTIVE/ATTACHED/AVAILABLE/PROVISIONED/ RUNNING applicable lifecycle state during create operation & to get into DELETED/DETACHED/ TERMINATED lifecycle state during delete operation.
|
Note
- For OCI python sdk configuration, please refer to https://oracle-cloud-infrastructure-python-sdk.readthedocs.io/en/latest/configuration.html
- name: Create a new secondary VNIC and attach it to the specified compute instance
oci_vnic_attachment:
name: sec-vnic1-to-instance1
instance_id: "ocid1.instance.oc1.phx.xxxxxEXAMPLExxxxx....dszaitd3da"
nicindex: 1
vnic:
hostname_label: "myinstance1_1"
private_ip: "10.0.0.6"
subnet_id: "ocid1.subnet.oc1.phx.xxxxxEXAMPLExxxxx...5iddusmpqpaoa"
- name: Detach a secondary VNIC from an instance and delete the VNIC
oci_vnic_attachment:
id: "ocid1.vnic.oc1.phx.xxxxxEXAMPLExxxxx...lxasdsadgdq"
state: "absent"
Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module:
Key | Returned | Description | |
---|---|---|---|
vnic_attachment
complex
|
On success |
Details of the VNIC attachment
Sample:
{'compartment_id': 'ocid1.compartment.oc1..xxxxxEXAMPLExxxxx...m62xq', 'id': 'ocid1.vnicattachment.oc1.phx.xxxxxEXAMPLExxxxx...3momq', 'availability_domain': 'BnQb:PHX-AD-1', 'subnet_id': 'ocid1.subnet.oc1.phx.xxxxxEXAMPLExxxxx...mpqpaoa', 'instance_id': 'ocid1.instance.oc1.phx.xxxxxEXAMPLExxxxx...qkwr6q', 'display_name': 'sec_vnic_1_for_my_instance', 'vlan_tag': 41, 'vnic_id': 'ocid1.vnic.oc1.phx.xxxxxEXAMPLExxxxx...mv2beqa', 'lifecycle_state': 'DETACHED', 'time_created': '2017-11-26T16:24:35.487000+00:00'}
|
|
availability_domain
string
|
always |
The Availability Domain of the instance.
Sample:
Uocm:PHX-AD-1
|
|
compartment_id
string
|
always |
The OCID of the compartment the VNIC attachment is in, which is the same compartment the instance is in.
Sample:
ocid1.compartment.oc1..xxxxxEXAMPLExxxxx...m62xq
|
|
display_name
string
|
always |
A user-friendly name. Does not have to be unique.
Sample:
sec_vnic1_for_my_instance
|
|
id
string
|
always |
The OCID of the VNIC attachment.
Sample:
ocid1.vnicattachment.oc1.phx.xxxxxEXAMPLExxxxx...3momq
|
|
instance_id
string
|
always |
The OCID of the instance.
Sample:
ocid1.instance.oc1.phx.xxxxxEXAMPLExxxxx...qkwr6q
|
|
lifecycle_state
string
|
always |
The current state of the VNIC attachment.
Sample:
DETACHED
|
|
subnet_id
string
|
always |
The OCID of the VNIC's subnet.
Sample:
ocid1.subnet.oc1.phx.xxxxxEXAMPLExxxxx...mpqpaoa
|
|
time_created
string
|
always |
The date and time the VNIC attachment was created, in the format defined by RFC3339.
Sample:
2017-11-26 16:24:35.487000+00:00
|
|
vlan_tag
string
|
always |
The Oracle-assigned VLAN tag of the attached VNIC. Available after the attachment process is complete.
Sample:
41
|
|
vnic_id
string
|
always |
The OCID of the VNIC. Available after the attachment process is complete.
Sample:
ocid1.vnic.oc1.phx.xxxxxEXAMPLExxxxx...mv2beqa
|
- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is :ref:`maintained by the Ansible Community <modules_support>`. [community]
- Sivakumar Thyagarajan (@sivakumart)
Hint
If you notice any issues in this documentation you can edit this document to improve it.