1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

modules: fix examples to use FQCN for builtin plugins (#661)

This commit is contained in:
Andrew Klychkov 2020-07-16 14:42:12 +03:00 committed by GitHub
parent 2c3efea14b
commit 4c4a6ab27c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 36 additions and 36 deletions

View file

@ -210,7 +210,7 @@ EXAMPLES = """
# return_format (or its alias 'as') can control how secrets are returned to you
- name: return secrets as a dict (default)
set_fact:
ansible.builtin.set_fact:
my_secrets: "{{ lookup('community.general.hashi_vault', 'secret/data/manysecrets', token=my_token_var, url='http://myvault_url:8200') }}"
- ansible.builtin.debug:
msg: "{{ my_secrets['secret_key'] }}"
@ -224,7 +224,7 @@ EXAMPLES = """
loop: "{{ query('community.general.hashi_vault', 'secret/data/manysecrets', token=my_token_var, url='http://myvault_url:8200', return_format='values') }}"
- name: return raw secret from API, including metadata
set_fact:
ansible.builtin.set_fact:
my_secret: "{{ lookup('community.general.hashi_vault', 'secret/data/hello:value', token=my_token_var, url='http://myvault_url:8200', as='raw') }}"
- ansible.builtin.debug:
msg: "This is version {{ my_secret['metadata']['version'] }} of hello:value. The secret data is {{ my_secret['data']['data']['value'] }}"

View file

@ -36,7 +36,7 @@ EXAMPLES = """
- "n*"
- name: get an item by key
assert:
ansible.builtin.assert:
that:
- item == 'Belgium'
vars:

View file

@ -47,11 +47,11 @@ options:
EXAMPLES = """
- name: fetch all networkview objects
set_fact:
ansible.builtin.set_fact:
networkviews: "{{ lookup('nios', 'networkview', provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}"
- name: fetch the default dns view
set_fact:
ansible.builtin.set_fact:
dns_views: "{{ lookup('nios', 'view', filter={'name': 'default'}, provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}"
# all of the examples below use credentials that are set using env variables
@ -60,20 +60,20 @@ EXAMPLES = """
# export INFOBLOX_PASSWORD=admin
- name: fetch all host records and include extended attributes
set_fact:
ansible.builtin.set_fact:
host_records: "{{ lookup('nios', 'record:host', return_fields=['extattrs', 'name', 'view', 'comment']}) }}"
- name: use env variables to pass credentials
set_fact:
ansible.builtin.set_fact:
networkviews: "{{ lookup('nios', 'networkview') }}"
- name: get a host record
set_fact:
ansible.builtin.set_fact:
host: "{{ lookup('nios', 'record:host', filter={'name': 'hostname.ansible.com'}) }}"
- name: get the authoritative zone from a non default dns view
set_fact:
ansible.builtin.set_fact:
host: "{{ lookup('nios', 'zone_auth', filter={'fqdn': 'ansible.com', 'view': 'ansible-dns'}) }}"
"""

View file

@ -47,15 +47,15 @@ options:
EXAMPLES = """
- name: return next available IP address for network 192.168.10.0/24
set_fact:
ansible.builtin.set_fact:
ipaddr: "{{ lookup('nios_next_ip', '192.168.10.0/24', provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}"
- name: return the next 3 available IP addresses for network 192.168.10.0/24
set_fact:
ansible.builtin.set_fact:
ipaddr: "{{ lookup('nios_next_ip', '192.168.10.0/24', num=3, provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}"
- name: return the next 3 available IP addresses for network 192.168.10.0/24 excluding ip addresses - ['192.168.10.1', '192.168.10.2']
set_fact:
ansible.builtin.set_fact:
ipaddr: "{{ lookup('nios_next_ip', '192.168.10.0/24', num=3, exclude=['192.168.10.1', '192.168.10.2'],
provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}"
"""

View file

@ -55,16 +55,16 @@ options:
EXAMPLES = """
- name: return next available network for network-container 192.168.10.0/24
set_fact:
ansible.builtin.set_fact:
networkaddr: "{{ lookup('nios_next_network', '192.168.10.0/24', cidr=25, provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}"
- name: return the next 2 available network addresses for network-container 192.168.10.0/24
set_fact:
ansible.builtin.set_fact:
networkaddr: "{{ lookup('nios_next_network', '192.168.10.0/24', cidr=25, num=2,
provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}"
- name: return the available network addresses for network-container 192.168.10.0/24 excluding network range '192.168.10.0/25'
set_fact:
ansible.builtin.set_fact:
networkaddr: "{{ lookup('nios_next_network', '192.168.10.0/24', cidr=25, exclude=['192.168.10.0/25'],
provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}"
"""

View file

@ -82,7 +82,7 @@ EXAMPLES = """
msg: "{{ lookup('passwordstore', 'example/test subkey=user')}}"
- name: Return the entire password file content
set_fact:
ansible.builtin.set_fact:
passfilecontent: "{{ lookup('passwordstore', 'example/test returnall=true')}}"
"""

View file

@ -189,7 +189,7 @@ EXAMPLES = '''
- ansible.builtin.debug:
var: output
- assert:
- ansible.builtin.assert:
that: "not output.changed "
- name: Stop all services
@ -202,7 +202,7 @@ EXAMPLES = '''
- ansible.builtin.debug:
var: output
- assert:
- ansible.builtin.assert:
that:
- "not web.flask_web_1.state.running"
- "not db.flask_db_1.state.running"
@ -217,7 +217,7 @@ EXAMPLES = '''
- ansible.builtin.debug:
var: output
- assert:
- ansible.builtin.assert:
that:
- "web.flask_web_1.state.running"
- "db.flask_db_1.state.running"
@ -264,7 +264,7 @@ EXAMPLES = '''
- ansible.builtin.debug:
var: output
- assert:
- ansible.builtin.assert:
that:
- "web.flask_web_1.state.running"
- "db.flask_db_1.state.running"
@ -296,7 +296,7 @@ EXAMPLES = '''
- ansible.builtin.debug:
var: output
- assert:
- ansible.builtin.assert:
that:
- "web.flask_web_1.state.running"
- "db.flask_db_1.state.running"

View file

@ -62,7 +62,7 @@ EXAMPLES = '''
register: result
- name: Make sure that both images pacur/centos-7 and sinatra exist locally
assert:
ansible.builtin.assert:
that:
- result.images | length == 2
'''

View file

@ -242,7 +242,7 @@ EXAMPLES = '''
with_items: "{{ gce.instance_data }}"
- name: Wait for SSH for instances
wait_for:
ansible.builtin.wait_for:
delay: 1
host: "{{ item.public_ip }}"
port: 22

View file

@ -327,7 +327,7 @@ EXAMPLES = '''
register: vm
- name: Wait for SSH to come up
wait_for_connection:
ansible.builtin.wait_for_connection:
delegate_to: '{{ vm.instances[0].networks[0].ip }}'
- name: Terminate VMs by ids

View file

@ -208,7 +208,7 @@ EXAMPLES = '''
register: newhosts
- name: Wait for ssh
wait_for:
ansible.builtin.wait_for:
delay: 1
host: "{{ item.public_ipv4 }}"
port: 22

View file

@ -41,7 +41,7 @@ EXAMPLES = '''
name: "{{ inventory_hostname }}"
region: DFW
- name: Map some facts
set_fact:
ansible.builtin.set_fact:
ansible_ssh_host: "{{ rax_accessipv4 }}"
'''

View file

@ -139,7 +139,7 @@ EXAMPLES = r'''
# Pass list and string vars as positional_args
- name: Set vars
set_fact:
ansible.builtin.set_fact:
my_list:
- 1
- 2

View file

@ -67,7 +67,7 @@ EXAMPLES = '''
# Examples to display the value of all or a single iDRAC attribute
- name: Store iDRAC attributes as a fact variable
set_fact:
ansible.builtin.set_fact:
idrac_attributes: "{{ result.redfish_facts.entries | selectattr('Id', 'defined') | selectattr('Id', 'equalto', 'iDRACAttributes') | list | first }}"
- name: Display all iDRAC attributes
@ -80,7 +80,7 @@ EXAMPLES = '''
# Examples to display the value of all or a single LifecycleController attribute
- name: Store LifecycleController attributes as a fact variable
set_fact:
ansible.builtin.set_fact:
lc_attributes: "{{ result.redfish_facts.entries | selectattr('Id', 'defined') | selectattr('Id', 'equalto', 'LCAttributes') | list | first }}"
- name: Display LifecycleController attributes
@ -93,7 +93,7 @@ EXAMPLES = '''
# Examples to display the value of all or a single System attribute
- name: Store System attributes as a fact variable
set_fact:
ansible.builtin.set_fact:
system_attributes: "{{ result.redfish_facts.entries | selectattr('Id', 'defined') | selectattr('Id', 'equalto', 'SystemAttributes') | list | first }}"
- name: Display System attributes

View file

@ -86,7 +86,7 @@ EXAMPLES = '''
delegate_to: myloadbalancernode
- name: Step 2
wait_for:
ansible.builtin.wait_for:
host: '{{ member.host }}'
port: '{{ member.port }}'
state: drained

View file

@ -188,17 +188,17 @@ EXAMPLES = '''
with_dict: "{{ my_jenkins_plugins }}"
- name: Initiate the fact
set_fact:
ansible.builtin.set_fact:
jenkins_restart_required: no
- name: Check if restart is required by any of the versioned plugins
set_fact:
ansible.builtin.set_fact:
jenkins_restart_required: yes
when: item.changed
with_items: "{{ my_jenkins_plugin_versioned.results }}"
- name: Check if restart is required by any of the unversioned plugins
set_fact:
ansible.builtin.set_fact:
jenkins_restart_required: yes
when: item.changed
with_items: "{{ my_jenkins_plugin_unversioned.results }}"
@ -224,7 +224,7 @@ EXAMPLES = '''
when: jenkins_restart_required
- name: Reset the fact
set_fact:
ansible.builtin.set_fact:
jenkins_restart_required: no
when: jenkins_restart_required

View file

@ -65,7 +65,7 @@ EXAMPLES = '''
password: admin
- name: Setting master using a variable to hold a more complicate script
set_fact:
ansible.builtin.set_fact:
setmaster_mode: |
import jenkins.model.*
instance = Jenkins.getInstance()