ec2_key - clean up examples (#32714)

* ec2_key - clean up examples

* ec2_key: remove unnecessary example
pull/30492/head
Prasad Katti 7 years ago committed by Will Thames
parent 9e15f82aa3
commit d5e247243f

@ -62,44 +62,33 @@ author: "Vincent Viallet (@zbal)"
''' '''
EXAMPLES = ''' EXAMPLES = '''
# Note: None of these examples set aws_access_key, aws_secret_key, or region. # Note: These examples do not set authentication details, see the AWS Guide for details.
# It is assumed that their matching environment variables are set.
# Creates a new ec2 key pair named `example` if not present, returns generated - name: create a new ec2 key pair, returns generated private key
# private key
- name: example ec2 key
ec2_key: ec2_key:
name: example name: my_keypair
# Creates a new ec2 key pair named `example` if not present using provided key - name: create key pair using provided key_material
# material. This could use the 'file' lookup plugin to pull this off disk.
- name: example2 ec2 key
ec2_key: ec2_key:
name: example2 name: my_keypair
key_material: 'ssh-rsa AAAAxyz...== me@example.com' key_material: 'ssh-rsa AAAAxyz...== me@example.com'
state: present
# Given example2 is already existing, the key will not be replaced because the - name: create key pair using key_material obtained using 'file' lookup plugin
# force flag was set to `false`
- name: example2 ec2 key
ec2_key: ec2_key:
name: example2 name: my_keypair
key_material: 'ssh-rsa AAAAxyz...== me@example.com' key_material: "{{ lookup('file', '/path/to/public_key/id_rsa.pub') }}"
force: false
state: present
# Creates a new ec2 key pair named `example` if not present using provided key # try creating a key pair with the name of an already existing keypair
# material # but don't overwrite it even if the key is different (force=false)
- name: example3 ec2 key - name: try creating a key pair with name of an already existing keypair
ec2_key: ec2_key:
name: example3 name: my_existing_keypair
key_material: "{{ item }}" key_material: 'ssh-rsa AAAAxyz...== me@example.com'
with_file: /path/to/public_key.id_rsa.pub force: false
# Removes ec2 key pair by name - name: remove key pair by name
- name: remove example key
ec2_key: ec2_key:
name: example name: my_keypair
state: absent state: absent
''' '''

Loading…
Cancel
Save