Fix Ansible documentation in part of example formatting. Part 1 (#332)

* Fix Ansible documentation in part of example formatting

* Fix
This commit is contained in:
Andrew Klychkov 2020-05-15 13:13:45 +03:00 committed by GitHub
commit 328319b926
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
70 changed files with 762 additions and 705 deletions

View file

@ -110,17 +110,17 @@ EXAMPLES = '''
# If a key matches this name, will return the ssh key id and changed = False
# If no existing key matches this name, a new key is created, the ssh key id is returned and changed = False
- digital_ocean:
- name: Ensure a SSH key is present
digital_ocean:
state: present
command: ssh
name: my_ssh_key
ssh_pub_key: 'ssh-rsa AAAA...'
api_token: XXX
# Create a new Droplet
# Will return the droplet details including the droplet id (used for idempotence)
- digital_ocean:
- name: Create a new Droplet
digital_ocean:
state: present
command: droplet
name: mydroplet
@ -141,7 +141,8 @@ EXAMPLES = '''
# If droplet id already exist, will return the droplet details and changed = False
# If no droplet matches the id, a new droplet will be created and the droplet details (including the new id) are returned, changed = True.
- digital_ocean:
- name: Ensure a droplet is present
digital_ocean:
state: present
command: droplet
id: 123
@ -157,7 +158,8 @@ EXAMPLES = '''
# Several keys can be added to ssh_key_ids as id1,id2,id3
# The keys are used to connect as root to the droplet.
- digital_ocean:
- name: Create a droplet with ssh key
digital_ocean:
state: present
ssh_key_ids: 123,456
name: mydroplet
@ -165,7 +167,6 @@ EXAMPLES = '''
size_id: 2gb
region_id: ams2
image_id: fedora-19-x64
'''
import os

View file

@ -58,31 +58,34 @@ author:
'''
EXAMPLES = '''
# Create new Block Storage
- digital_ocean_block_storage:
- name: Create new Block Storage
digital_ocean_block_storage:
state: present
command: create
api_token: <TOKEN>
region: nyc1
block_size: 10
volume_name: nyc1-block-storage
# Delete Block Storage
- digital_ocean_block_storage:
- name: Delete Block Storage
digital_ocean_block_storage:
state: absent
command: create
api_token: <TOKEN>
region: nyc1
volume_name: nyc1-block-storage
# Attach Block Storage to a Droplet
- digital_ocean_block_storage:
- name: Attach Block Storage to a Droplet
digital_ocean_block_storage:
state: present
command: attach
api_token: <TOKEN>
volume_name: nyc1-block-storage
region: nyc1
droplet_id: <ID>
# Detach Block Storage from a Droplet
- digital_ocean_block_storage:
- name: Detach Block Storage from a Droplet
digital_ocean_block_storage:
state: absent
command: attach
api_token: <TOKEN>

View file

@ -45,26 +45,24 @@ requirements:
EXAMPLES = '''
# Create a domain
- digital_ocean_domain:
- name: Create a domain
digital_ocean_domain:
state: present
name: my.digitalocean.domain
ip: 127.0.0.1
# Create a droplet and a corresponding domain
- digital_ocean:
# Create a droplet and corresponding domain
- name: Create a droplet
digital_ocean:
state: present
name: test_droplet
size_id: 1gb
region_id: sgp1
image_id: ubuntu-14-04-x64
register: test_droplet
- digital_ocean_domain:
- name: Create a corresponding domain
digital_ocean_domain:
state: present
name: "{{ test_droplet.droplet.name }}.my.domain"
ip: "{{ test_droplet.droplet.ip_address }}"

View file

@ -28,17 +28,20 @@ requirements:
EXAMPLES = '''
- digital_ocean_sshkey_info:
- name: Gather information about DigitalOcean SSH keys
digital_ocean_sshkey_info:
oauth_token: "{{ my_do_key }}"
register: ssh_keys
- set_fact:
- name: Set facts based on the gathered information
set_fact:
pubkey: "{{ item.public_key }}"
loop: "{{ ssh_keys.data|json_query(ssh_pubkey) }}"
vars:
ssh_pubkey: "[?name=='ansible_ctrl']"
- debug:
- name: Print SSH public key
debug:
msg: "{{ pubkey }}"
'''