ec2_key - clean up examples (#32714)
* ec2_key - clean up examples * ec2_key: remove unnecessary example
This commit is contained in:
parent
9e15f82aa3
commit
d5e247243f
1 changed files with 16 additions and 27 deletions
|
@ -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: "{{ lookup('file', '/path/to/public_key/id_rsa.pub') }}"
|
||||||
|
|
||||||
|
# try creating a key pair with the name of an already existing keypair
|
||||||
|
# but don't overwrite it even if the key is different (force=false)
|
||||||
|
- name: try creating a key pair with name of an already existing keypair
|
||||||
|
ec2_key:
|
||||||
|
name: my_existing_keypair
|
||||||
key_material: 'ssh-rsa AAAAxyz...== me@example.com'
|
key_material: 'ssh-rsa AAAAxyz...== me@example.com'
|
||||||
force: false
|
force: false
|
||||||
state: present
|
|
||||||
|
|
||||||
# Creates a new ec2 key pair named `example` if not present using provided key
|
- name: remove key pair by name
|
||||||
# material
|
|
||||||
- name: example3 ec2 key
|
|
||||||
ec2_key:
|
ec2_key:
|
||||||
name: example3
|
name: my_keypair
|
||||||
key_material: "{{ item }}"
|
|
||||||
with_file: /path/to/public_key.id_rsa.pub
|
|
||||||
|
|
||||||
# Removes ec2 key pair by name
|
|
||||||
- name: remove example key
|
|
||||||
ec2_key:
|
|
||||||
name: example
|
|
||||||
state: absent
|
state: absent
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue