Playbook file
(instance_mgmt_start.yaml)
- name: instance
lifecycle mgmt
hosts: localhost
collections:
- oracle.oci
tasks:
- name: start instance
oci_compute_instance_actions:
instance_id:
action: start
register: output
- name: Print namespace name
debug:
msg: "{{ output }}"
Run ansbile-playbook as:
$
ansible-playbook
/home/a_prashant/.ansible/instance_mgmt_start.yaml
PLAY [Get namespace name] *****************************************************************************
TASK [Gathering Facts]
*****************************************************************************
ok: [localhost]
TASK [Get namespace name1]
*****************************************************************************
changed: [localhost]
TASK [Print namespace name]
************************************************************ok: [localhost]
=> {
"msg": {
"changed": true,
"failed": false,
"instance": {
"agent_config": {
"is_management_disabled": false,
"is_monitoring_disabled": false
},
"availability_config": {
"recovery_action":
"RESTORE_INSTANCE"
},
"availability_domain":
"RJkC:AP-MUMBAI-1-AD-1",
"compartment_id": " ",
"dedicated_vm_host_id":
null,
"defined_tags": {
"Operations": {
"CostCenter":
"56"
},
"Oracle-Tags": {
"CreatedBy":"oracleidentitycloudservice/prashant",
"CreatedOn":
"2021-02-12T05:12:02.350Z"
}
},
"display_name":
"TF_TERRAFORM_NEW",
"extended_metadata": {},
"fault_domain":
"FAULT-DOMAIN-1",
"freeform_tags": {},
"id": " ",
"image_id": " ",
"instance_options": {
"are_legacy_imds_endpoints_disabled": false
},
"ipxe_script": null,
"launch_mode":
"PARAVIRTUALIZED",
"launch_options": {
"boot_volume_type":
"PARAVIRTUALIZED",
"firmware":
"UEFI_64",
"is_consistent_volume_naming_enabled": true,
"is_pv_encryption_in_transit_enabled": false,
"network_type":
"PARAVIRTUALIZED",
"remote_data_volume_type":
"PARAVIRTUALIZED"
},
"lifecycle_state":
"RUNNING",
"metadata": {
"ssh_authorized_keys": " \n"
},
"region":
"ap-mumbai-1",
"shape":
"VM.Standard.E2.1.Micro",
"shape_config": {
"gpu_description":
null,
"gpus": 0,
"local_disk_description": null,
"local_disks": 0,
"local_disks_total_size_in_gbs": null,
"max_vnic_attachments":
1,
"memory_in_gbs": 1.0,
"networking_bandwidth_in_gbps": 0.48,
"ocpus": 1.0,
"processor_description": "2.0 GHz AMD EPYC™ 7551
(Naples)"
},
"source_details": {
"boot_volume_size_in_gbs": null,
"image_id": " ",
"kms_key_id": null,
"source_type":
"image"
},
"system_tags": {
"orcl-cloud": {
"free-tier-retained": "true"
}
},
"time_created":
"2021-02-12T05:12:02.923000+00:00",
"time_maintenance_reboot_due": null
}
}
}
PLAY
RECAP *****************************************************************************
localhost
: ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
No comments:
Post a Comment