[docs] Add examples to ec2_instance docs (#38479)
This commit is contained in:
parent
e10e0d42d8
commit
546a406a14
1 changed files with 35 additions and 13 deletions
|
@ -171,26 +171,48 @@ extends_documentation_fragment:
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Note: These examples do not set authentication details, see the AWS Guide for details.
|
# Note: These examples do not set authentication details, see the AWS Guide for details.
|
||||||
|
|
||||||
# Terminate every instance in a region. Use with caution.
|
# Terminate every running instance in a region. Use with EXTREME caution.
|
||||||
- ec2_instance_facts:
|
- ec2_instance:
|
||||||
state: absent
|
state: absent
|
||||||
filters:
|
filters:
|
||||||
instance-state-name: running
|
instance-state-name: running
|
||||||
|
|
||||||
# Gather facts about all instances in AZ ap-southeast-2a
|
# restart a particular instance by its ID
|
||||||
- ec2_instance_facts:
|
- ec2_instance:
|
||||||
filters:
|
state: restarted
|
||||||
availability-zone: ap-southeast-2a
|
|
||||||
|
|
||||||
# Gather facts about a particular instance using ID
|
|
||||||
- ec2_instance_facts:
|
|
||||||
instance_ids:
|
instance_ids:
|
||||||
- i-12345678
|
- i-12345678
|
||||||
|
|
||||||
# Gather facts about any instance with a tag key Name and value Example
|
# start an instance with a public IP address
|
||||||
- ec2_instance_facts:
|
- ec2_instance:
|
||||||
filters:
|
name: "public-compute-instance"
|
||||||
"tag:Name": Example
|
key_name: "prod-ssh-key"
|
||||||
|
vpc_subnet_id: subnet-5ca1ab1e
|
||||||
|
instance_type: c5.large
|
||||||
|
security_group: default
|
||||||
|
network:
|
||||||
|
assign_public_ip: true
|
||||||
|
image_id: ami-123456
|
||||||
|
tags:
|
||||||
|
Environment: Testing
|
||||||
|
|
||||||
|
# start an instance and have it begin a Tower callback on boot
|
||||||
|
- ec2_instance:
|
||||||
|
name: "tower-callback-test"
|
||||||
|
key_name: "prod-ssh-key"
|
||||||
|
vpc_subnet_id: subnet-5ca1ab1e
|
||||||
|
security_group: default
|
||||||
|
tower_callback:
|
||||||
|
# IP or hostname of tower server
|
||||||
|
tower_address: 1.2.3.4
|
||||||
|
job_template_id: 876
|
||||||
|
host_config_key: '[secret config key goes here]'
|
||||||
|
network:
|
||||||
|
assign_public_ip: true
|
||||||
|
image_id: ami-123456
|
||||||
|
cpu_credit_specification: unlimited
|
||||||
|
tags:
|
||||||
|
SomeThing: "A value"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = '''
|
||||||
|
|
Loading…
Reference in a new issue