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 modules (#648)
* modules: fix examples to use FQCN for builtin modules * fix * fix * fix * fix * fix * fix * fix
This commit is contained in:
parent
c034e8c04f
commit
c055340ecb
126 changed files with 290 additions and 286 deletions
|
@ -629,7 +629,7 @@ playbook.yml: >
|
|||
gather_facts: no
|
||||
tasks:
|
||||
- name: Default plugin output
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: default plugin output
|
||||
|
||||
- name: Override from play vars
|
||||
|
@ -687,11 +687,11 @@ playbook.yml: >
|
|||
|
||||
tasks:
|
||||
- name: Custom banner with default plugin result output
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "default plugin output: result example"
|
||||
|
||||
- name: Override from task vars
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "example {{ two }}"
|
||||
changed_when: true
|
||||
vars:
|
||||
|
@ -703,14 +703,14 @@ playbook.yml: >
|
|||
ansible_callback_diy_runner_on_ok_msg_color: "{{ 'yellow' if ansible_callback_diy.result.is_changed else 'bright green' }}"
|
||||
|
||||
- name: Suppress output
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: i should not be displayed
|
||||
vars:
|
||||
ansible_callback_diy_playbook_on_task_start_msg: ""
|
||||
ansible_callback_diy_runner_on_ok_msg: ""
|
||||
|
||||
- name: Using alias vars (see ansible.cfg)
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg:
|
||||
when: False
|
||||
vars:
|
||||
|
@ -719,13 +719,13 @@ playbook.yml: >
|
|||
on_skipped_msg_color: white
|
||||
|
||||
- name: Just stdout
|
||||
command: echo some stdout
|
||||
ansible.builtin.command: echo some stdout
|
||||
vars:
|
||||
ansible_callback_diy_playbook_on_task_start_msg: "\n"
|
||||
ansible_callback_diy_runner_on_ok_msg: "{{ ansible_callback_diy.result.output.stdout }}\n"
|
||||
|
||||
- name: Multiline output
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ multiline }}"
|
||||
vars:
|
||||
ansible_callback_diy_playbook_on_task_start_msg: "\nDIY output(via task vars): task example: {{ ansible_callback_diy.task.name }}"
|
||||
|
@ -738,7 +738,7 @@ playbook.yml: >
|
|||
ansible_callback_diy_playbook_on_task_start_msg_color: bright blue
|
||||
|
||||
- name: Indentation
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ item.msg }}"
|
||||
with_items:
|
||||
- { indent: 1, msg: one., color: red }
|
||||
|
@ -751,14 +751,14 @@ playbook.yml: >
|
|||
ansible_callback_diy_runner_on_ok_msg_color: bright green
|
||||
|
||||
- name: Using lookup and template as file
|
||||
shell: "echo {% raw %}'output from {{ file_name }}'{% endraw %} > {{ file_name }}"
|
||||
ansible.builtin.shell: "echo {% raw %}'output from {{ file_name }}'{% endraw %} > {{ file_name }}"
|
||||
vars:
|
||||
ansible_callback_diy_playbook_on_task_start_msg: "\nDIY output(via task vars): task example: {{ ansible_callback_diy.task.name }}"
|
||||
file_name: diy_file_template_example
|
||||
ansible_callback_diy_runner_on_ok_msg: "{{ lookup('template', file_name) }}"
|
||||
|
||||
- name: 'Look at top level vars available to the "runner_on_ok" callback'
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: ''
|
||||
vars:
|
||||
ansible_callback_diy_playbook_on_task_start_msg: "\nDIY output(via task vars): task example: {{ ansible_callback_diy.task.name }}"
|
||||
|
@ -771,7 +771,7 @@ playbook.yml: >
|
|||
ansible_callback_diy_runner_on_ok_msg_color: white
|
||||
|
||||
- name: 'Look at event data available to the "runner_on_ok" callback'
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: ''
|
||||
vars:
|
||||
ansible_callback_diy_playbook_on_task_start_msg: "\nDIY output(via task vars): task example: {{ ansible_callback_diy.task.name }}"
|
||||
|
|
|
@ -30,8 +30,8 @@ DOCUMENTATION = '''
|
|||
'''
|
||||
|
||||
EXAMPLES = """
|
||||
- debug: msg="This will not be printed"
|
||||
- debug: msg="But this will"
|
||||
- ansible.builtin.debug: msg="This will not be printed"
|
||||
- ansible.builtin.debug: msg="But this will"
|
||||
tags: [print_action]
|
||||
"""
|
||||
|
||||
|
|
|
@ -54,5 +54,5 @@ requirements:
|
|||
notes:
|
||||
- "In order to use this module you have to install oVirt Python SDK.
|
||||
To ensure it's installed with correct version you can create the following task:
|
||||
pip: name=ovirt-engine-sdk-python version=4.3.0"
|
||||
ansible.builtin.pip: name=ovirt-engine-sdk-python version=4.3.0"
|
||||
'''
|
||||
|
|
|
@ -29,7 +29,7 @@ except ImportError:
|
|||
|
||||
def json_query(data, expr):
|
||||
'''Query data using jmespath query language ( http://jmespath.org ). Example:
|
||||
- debug: msg="{{ instance | json_query(tagged_instances[*].block_device_mapping.*.volume_id') }}"
|
||||
- ansible.builtin.debug: msg="{{ instance | json_query(tagged_instances[*].block_device_mapping.*.volume_id') }}"
|
||||
'''
|
||||
if not HAS_LIB:
|
||||
raise AnsibleError('You need to install "jmespath" prior to running '
|
||||
|
|
|
@ -20,10 +20,10 @@ DOCUMENTATION = '''
|
|||
|
||||
EXAMPLES = """
|
||||
- name: Example of the change in the description
|
||||
debug: msg="{{ lookup('cartesian', [1,2,3], [a, b])}}"
|
||||
ansible.builtin.debug: msg="{{ lookup('cartesian', [1,2,3], [a, b])}}"
|
||||
|
||||
- name: loops over the cartesian product of the supplied lists
|
||||
debug: msg="{{item}}"
|
||||
ansible.builtin.debug: msg="{{item}}"
|
||||
with_cartesian:
|
||||
- "{{list1}}"
|
||||
- "{{list2}}"
|
||||
|
|
|
@ -27,7 +27,7 @@ DOCUMENTATION = '''
|
|||
'''
|
||||
|
||||
EXAMPLES = """
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: "{{ lookup('chef_databag', 'name=data_bag_name item=data_bag_item') }}"
|
||||
"""
|
||||
|
||||
|
|
|
@ -78,19 +78,19 @@ DOCUMENTATION = '''
|
|||
'''
|
||||
|
||||
EXAMPLES = """
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: 'key contains {{item}}'
|
||||
with_consul_kv:
|
||||
- 'key/to/retrieve'
|
||||
|
||||
- name: Parameters can be provided after the key be more specific about what to retrieve
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: 'key contains {{item}}'
|
||||
with_consul_kv:
|
||||
- 'key/to recurse=true token=E6C060A9-26FB-407A-B83E-12DDAFCB4D98'
|
||||
|
||||
- name: retrieving a KV from a remote cluster on non default port
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ lookup('consul_kv', 'my/key', host='10.10.10.10', port='2000') }}"
|
||||
"""
|
||||
|
||||
|
|
|
@ -44,16 +44,16 @@ DOCUMENTATION = '''
|
|||
|
||||
EXAMPLES = """
|
||||
- name: first use credstash to store your secrets
|
||||
shell: credstash put my-github-password secure123
|
||||
ansible.builtin.shell: credstash put my-github-password secure123
|
||||
|
||||
- name: "Test credstash lookup plugin -- get my github password"
|
||||
debug: msg="Credstash lookup! {{ lookup('credstash', 'my-github-password') }}"
|
||||
ansible.builtin.debug: msg="Credstash lookup! {{ lookup('credstash', 'my-github-password') }}"
|
||||
|
||||
- name: "Test credstash lookup plugin -- get my other password from us-west-1"
|
||||
debug: msg="Credstash lookup! {{ lookup('credstash', 'my-other-password', region='us-west-1') }}"
|
||||
ansible.builtin.debug: msg="Credstash lookup! {{ lookup('credstash', 'my-other-password', region='us-west-1') }}"
|
||||
|
||||
- name: "Test credstash lookup plugin -- get the company's github password"
|
||||
debug: msg="Credstash lookup! {{ lookup('credstash', 'company-github-password', table='company-passwords') }}"
|
||||
ansible.builtin.debug: msg="Credstash lookup! {{ lookup('credstash', 'company-github-password', table='company-passwords') }}"
|
||||
|
||||
- name: Example play using the 'context' feature
|
||||
hosts: localhost
|
||||
|
@ -64,10 +64,10 @@ EXAMPLES = """
|
|||
tasks:
|
||||
|
||||
- name: "Test credstash lookup plugin -- get the password with a context passed as a variable"
|
||||
debug: msg="{{ lookup('credstash', 'some-password', context=context) }}"
|
||||
ansible.builtin.debug: msg="{{ lookup('credstash', 'some-password', context=context) }}"
|
||||
|
||||
- name: "Test credstash lookup plugin -- get the password with a context defined here"
|
||||
debug: msg="{{ lookup('credstash', 'some-password', context=dict(app='my_app', environment='production')) }}"
|
||||
ansible.builtin.debug: msg="{{ lookup('credstash', 'some-password', context=dict(app='my_app', environment='production')) }}"
|
||||
"""
|
||||
|
||||
RETURN = """
|
||||
|
|
|
@ -36,7 +36,7 @@ DOCUMENTATION = '''
|
|||
|
||||
EXAMPLES = """
|
||||
- name: passing options to the lookup
|
||||
debug: msg={{ lookup("cyberarkpassword", cyquery)}}
|
||||
ansible.builtin.debug: msg={{ lookup("cyberarkpassword", cyquery)}}
|
||||
vars:
|
||||
cyquery:
|
||||
appid: "app_ansible"
|
||||
|
@ -45,7 +45,7 @@ EXAMPLES = """
|
|||
|
||||
|
||||
- name: used in a loop
|
||||
debug: msg={{item}}
|
||||
ansible.builtin.debug: msg={{item}}
|
||||
with_cyberarkpassword:
|
||||
appid: 'app_ansible'
|
||||
query: 'safe=CyberArk_Passwords;folder=root;object=AdminPass'
|
||||
|
|
|
@ -44,24 +44,24 @@ DOCUMENTATION = '''
|
|||
|
||||
EXAMPLES = """
|
||||
- name: Simple A record (IPV4 address) lookup for example.com
|
||||
debug: msg="{{ lookup('dig', 'example.com.')}}"
|
||||
ansible.builtin.debug: msg="{{ lookup('dig', 'example.com.')}}"
|
||||
|
||||
- name: "The TXT record for example.org."
|
||||
debug: msg="{{ lookup('dig', 'example.org.', 'qtype=TXT') }}"
|
||||
ansible.builtin.debug: msg="{{ lookup('dig', 'example.org.', 'qtype=TXT') }}"
|
||||
|
||||
- name: "The TXT record for example.org, alternative syntax."
|
||||
debug: msg="{{ lookup('dig', 'example.org./TXT') }}"
|
||||
ansible.builtin.debug: msg="{{ lookup('dig', 'example.org./TXT') }}"
|
||||
|
||||
- name: use in a loop
|
||||
debug: msg="MX record for gmail.com {{ item }}"
|
||||
ansible.builtin.debug: msg="MX record for gmail.com {{ item }}"
|
||||
with_items: "{{ lookup('dig', 'gmail.com./MX', wantlist=True) }}"
|
||||
|
||||
- debug: msg="Reverse DNS for 192.0.2.5 is {{ lookup('dig', '192.0.2.5/PTR') }}"
|
||||
- debug: msg="Reverse DNS for 192.0.2.5 is {{ lookup('dig', '5.2.0.192.in-addr.arpa./PTR') }}"
|
||||
- debug: msg="Reverse DNS for 192.0.2.5 is {{ lookup('dig', '5.2.0.192.in-addr.arpa.', 'qtype=PTR') }}"
|
||||
- debug: msg="Querying 198.51.100.23 for IPv4 address for example.com. produces {{ lookup('dig', 'example.com', '@198.51.100.23') }}"
|
||||
- ansible.builtin.debug: msg="Reverse DNS for 192.0.2.5 is {{ lookup('dig', '192.0.2.5/PTR') }}"
|
||||
- ansible.builtin.debug: msg="Reverse DNS for 192.0.2.5 is {{ lookup('dig', '5.2.0.192.in-addr.arpa./PTR') }}"
|
||||
- ansible.builtin.debug: msg="Reverse DNS for 192.0.2.5 is {{ lookup('dig', '5.2.0.192.in-addr.arpa.', 'qtype=PTR') }}"
|
||||
- ansible.builtin.debug: msg="Querying 198.51.100.23 for IPv4 address for example.com. produces {{ lookup('dig', 'example.com', '@198.51.100.23') }}"
|
||||
|
||||
- debug: msg="XMPP service for gmail.com. is available at {{ item.target }} on port {{ item.port }}"
|
||||
- ansible.builtin.debug: msg="XMPP service for gmail.com. is available at {{ item.target }} on port {{ item.port }}"
|
||||
with_items: "{{ lookup('dig', '_xmpp-server._tcp.gmail.com./SRV', 'flat=0', wantlist=True) }}"
|
||||
"""
|
||||
|
||||
|
|
|
@ -21,17 +21,17 @@ DOCUMENTATION = '''
|
|||
|
||||
EXAMPLES = """
|
||||
- name: show txt entry
|
||||
debug: msg="{{lookup('dnstxt', ['test.example.com'])}}"
|
||||
ansible.builtin.debug: msg="{{lookup('dnstxt', ['test.example.com'])}}"
|
||||
|
||||
- name: iterate over txt entries
|
||||
debug: msg="{{item}}"
|
||||
ansible.builtin.debug: msg="{{item}}"
|
||||
with_dnstxt:
|
||||
- 'test.example.com'
|
||||
- 'other.example.com'
|
||||
- 'last.example.com'
|
||||
|
||||
- name: iterate of a comma delimited DNS TXT entry
|
||||
debug: msg="{{item}}"
|
||||
ansible.builtin.debug: msg="{{item}}"
|
||||
with_dnstxt: "{{lookup('dnstxt', ['test.example.com']).split(',')}}"
|
||||
"""
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ EXAMPLES = r"""
|
|||
vars:
|
||||
secret: "{{ lookup('community.general.dsv', '/test/secret') }}"
|
||||
tasks:
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: 'the password is {{ secret["data"]["password"] }}'
|
||||
"""
|
||||
|
||||
|
|
|
@ -54,13 +54,13 @@ DOCUMENTATION = '''
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: "a value from a locally running etcd"
|
||||
debug: msg={{ lookup('etcd', 'foo/bar') }}
|
||||
ansible.builtin.debug: msg={{ lookup('etcd', 'foo/bar') }}
|
||||
|
||||
- name: "values from multiple folders on a locally running etcd"
|
||||
debug: msg={{ lookup('etcd', 'foo', 'bar', 'baz') }}
|
||||
ansible.builtin.debug: msg={{ lookup('etcd', 'foo', 'bar', 'baz') }}
|
||||
|
||||
- name: "since Ansible 2.5 you can set server options inline"
|
||||
debug: msg="{{ lookup('etcd', 'foo', version='v2', url='http://192.168.0.27:4001') }}"
|
||||
ansible.builtin.debug: msg="{{ lookup('etcd', 'foo', version='v2', url='http://192.168.0.27:4001') }}"
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
|
@ -82,7 +82,7 @@ from ansible.module_utils.urls import open_url
|
|||
# If etcd v2 running on host 192.168.1.21 on port 2379
|
||||
# we can use the following in a playbook to retrieve /tfm/network/config key
|
||||
#
|
||||
# - debug: msg={{lookup('etcd','/tfm/network/config', url='http://192.168.1.21:2379' , version='v2')}}
|
||||
# - ansible.builtin.debug: msg={{lookup('etcd','/tfm/network/config', url='http://192.168.1.21:2379' , version='v2')}}
|
||||
#
|
||||
# Example Output:
|
||||
#
|
||||
|
|
|
@ -101,19 +101,19 @@ DOCUMENTATION = '''
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: "a value from a locally running etcd"
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ lookup('community.general.etcd3', 'foo/bar') }}"
|
||||
|
||||
- name: "values from multiple folders on a locally running etcd"
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ lookup('community.general.etcd3', 'foo', 'bar', 'baz') }}"
|
||||
|
||||
- name: "look for a key prefix"
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ lookup('community.general.etcd3', '/foo/bar', prefix=True) }}"
|
||||
|
||||
- name: "connect to etcd3 with a client certificate"
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ lookup('community.general.etcd3', 'foo/bar', cert_cert='/etc/ssl/etcd/client.pem', cert_key='/etc/ssl/etcd/client.key') }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ options:
|
|||
|
||||
EXAMPLES = """
|
||||
- name: Create directories
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: /web/{{ item.path }}
|
||||
state: directory
|
||||
mode: '{{ item.mode }}'
|
||||
|
@ -29,7 +29,7 @@ EXAMPLES = """
|
|||
when: item.state == 'directory'
|
||||
|
||||
- name: Template files (explicitly skip directories in order to use the 'src' attribute)
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: '{{ item.src }}'
|
||||
dest: /web/{{ item.path }}
|
||||
mode: '{{ item.mode }}'
|
||||
|
@ -37,7 +37,7 @@ EXAMPLES = """
|
|||
when: item.state == 'file'
|
||||
|
||||
- name: Recreate symlinks
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
src: '{{ item.src }}'
|
||||
dest: /web/{{ item.path }}
|
||||
state: link
|
||||
|
|
|
@ -21,7 +21,7 @@ DOCUMENTATION = '''
|
|||
|
||||
EXAMPLES = """
|
||||
- name: "'unnest' all elements into single list"
|
||||
debug: msg="all in one list {{lookup('flattened', [1,2,3,[5,6]], [a,b,c], [[5,6,1,3], [34,a,b,c]])}}"
|
||||
ansible.builtin.debug: msg="all in one list {{lookup('flattened', [1,2,3,[5,6]], [a,b,c], [[5,6,1,3], [34,a,b,c]])}}"
|
||||
"""
|
||||
|
||||
RETURN = """
|
||||
|
|
|
@ -29,7 +29,7 @@ extends_documentation_fragment:
|
|||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- debug: msg="the value of foo.txt is {{ lookup('gcp_storage_file',
|
||||
- ansible.builtin.debug: msg="the value of foo.txt is {{ lookup('gcp_storage_file',
|
||||
bucket='gcp-bucket', src='mydir/foo.txt', project='project-name',
|
||||
auth_kind='serviceaccount', service_account_file='/tmp/myserviceaccountfile.json') }}"
|
||||
'''
|
||||
|
|
|
@ -161,79 +161,79 @@ DOCUMENTATION = """
|
|||
"""
|
||||
|
||||
EXAMPLES = """
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: "{{ lookup('community.general.hashi_vault', 'secret=secret/hello:value token=c975b780-d1be-8016-866b-01d0f9b688a5 url=http://myvault:8200') }}"
|
||||
|
||||
- name: Return all secrets from a path
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ lookup('community.general.hashi_vault', 'secret=secret/hello token=c975b780-d1be-8016-866b-01d0f9b688a5 url=http://myvault:8200') }}"
|
||||
|
||||
- name: Vault that requires authentication via LDAP
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ lookup('community.general.hashi_vault', 'secret/hello:value auth_method=ldap mount_point=ldap username=myuser password=mypas') }}"
|
||||
|
||||
- name: Vault that requires authentication via username and password
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ lookup('community.general.hashi_vault', 'secret=secret/hello:value auth_method=userpass username=myuser password=psw url=http://myvault:8200') }}"
|
||||
|
||||
- name: Using an ssl vault
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ lookup('community.general.hashi_vault', 'secret=secret/hola:value token=c975b780-d1be-8016-866b-01d0f9b688a5 validate_certs=False') }}"
|
||||
|
||||
- name: using certificate auth
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ lookup('community.general.hashi_vault', 'secret/hi:value token=xxxx url=https://myvault:8200 validate_certs=True cacert=/cacert/path/ca.pem') }}"
|
||||
|
||||
- name: authenticate with a Vault app role
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ lookup('community.general.hashi_vault', 'secret=secret/hello:value auth_method=approle role_id=myroleid secret_id=mysecretid') }}"
|
||||
|
||||
- name: Return all secrets from a path in a namespace
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ lookup('community.general.hashi_vault', 'secret=secret/hello token=c975b780-d1be-8016-866b-01d0f9b688a5 namespace=teama/admins') }}"
|
||||
|
||||
# When using KV v2 the PATH should include "data" between the secret engine mount and path (e.g. "secret/data/:path")
|
||||
# see: https://www.vaultproject.io/api/secret/kv/kv-v2.html#read-secret-version
|
||||
- name: Return latest KV v2 secret from path
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ lookup('community.general.hashi_vault', 'secret=secret/data/hello token=my_vault_token url=http://myvault_url:8200') }}"
|
||||
|
||||
# The following examples work in collection releases after community.general 0.2.0
|
||||
|
||||
- name: secret= is not required if secret is first
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ lookup('community.general.hashi_vault', 'secret/data/hello token=<token> url=http://myvault_url:8200') }}"
|
||||
|
||||
- name: options can be specified as parameters rather than put in term string
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ lookup('community.general.hashi_vault', 'secret/data/hello', token=my_token_var, url='http://myvault_url:8200') }}"
|
||||
|
||||
# return_format (or its alias 'as') can control how secrets are returned to you
|
||||
- name: return secrets as a dict (default)
|
||||
set_fact:
|
||||
my_secrets: "{{ lookup('community.general.hashi_vault', 'secret/data/manysecrets', token=my_token_var, url='http://myvault_url:8200') }}"
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: "{{ my_secrets['secret_key'] }}"
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: "Secret '{{ item.key }}' has value '{{ item.value }}'"
|
||||
loop: "{{ my_secrets | dict2items }}"
|
||||
|
||||
- name: return secrets as values only
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "A secret value: {{ item }}"
|
||||
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:
|
||||
my_secret: "{{ lookup('community.general.hashi_vault', 'secret/data/hello:value', token=my_token_var, url='http://myvault_url:8200', as='raw') }}"
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: "This is version {{ my_secret['metadata']['version'] }} of hello:value. The secret data is {{ my_secret['data']['data']['value'] }}"
|
||||
|
||||
# AWS IAM authentication method
|
||||
# uses Ansible standard AWS options
|
||||
|
||||
- name: authenticate with aws_iam_login
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ lookup('community.general.hashi_vault', 'secret/hello:value', auth_method='aws_iam_login' role_id='myroleid', profile=my_boto_profile) }}"
|
||||
"""
|
||||
|
||||
|
|
|
@ -39,13 +39,13 @@ EXAMPLES = """
|
|||
# All this examples depends on hiera.yml that describes the hierarchy
|
||||
|
||||
- name: "a value from Hiera 'DB'"
|
||||
debug: msg={{ lookup('hiera', 'foo') }}
|
||||
ansible.builtin.debug: msg={{ lookup('hiera', 'foo') }}
|
||||
|
||||
- name: "a value from a Hiera 'DB' on other environment"
|
||||
debug: msg={{ lookup('hiera', 'foo environment=production') }}
|
||||
ansible.builtin.debug: msg={{ lookup('hiera', 'foo environment=production') }}
|
||||
|
||||
- name: "a value from a Hiera 'DB' for a concrete node"
|
||||
debug: msg={{ lookup('hiera', 'foo fqdn=puppet01.localdomain') }}
|
||||
ansible.builtin.debug: msg={{ lookup('hiera', 'foo fqdn=puppet01.localdomain') }}
|
||||
"""
|
||||
|
||||
RETURN = """
|
||||
|
|
|
@ -18,7 +18,7 @@ DOCUMENTATION = '''
|
|||
|
||||
EXAMPLES = """
|
||||
- name : output secrets to screen (BAD IDEA)
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "Password: {{item}}"
|
||||
with_keyring:
|
||||
- 'servicename username'
|
||||
|
|
|
@ -25,7 +25,7 @@ DOCUMENTATION = '''
|
|||
|
||||
EXAMPLES = """
|
||||
- name: get 'custom_field' from lastpass entry 'entry-name'
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ lookup('lastpass', 'entry-name', field='custom_field') }}"
|
||||
"""
|
||||
|
||||
|
|
|
@ -24,11 +24,11 @@ DOCUMENTATION = '''
|
|||
|
||||
EXAMPLES = """
|
||||
- name: query LMDB for a list of country codes
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ query('lmdb_kv', 'nl', 'be', 'lu', db='jp.mdb') }}"
|
||||
|
||||
- name: use list of values in a loop by key wildcard
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "Hello from {{ item.0 }} a.k.a. {{ item.1 }}"
|
||||
vars:
|
||||
- lmdb_kv_db: jp.mdb
|
||||
|
|
|
@ -40,11 +40,11 @@ DOCUMENTATION = '''
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: all available resources
|
||||
debug: msg="{{ lookup('manifold', api_token='SecretToken') }}"
|
||||
ansible.builtin.debug: msg="{{ lookup('manifold', api_token='SecretToken') }}"
|
||||
- name: all available resources for a specific project in specific team
|
||||
debug: msg="{{ lookup('manifold', api_token='SecretToken', project='poject-1', team='team-2') }}"
|
||||
ansible.builtin.debug: msg="{{ lookup('manifold', api_token='SecretToken', project='poject-1', team='team-2') }}"
|
||||
- name: two specific resources
|
||||
debug: msg="{{ lookup('manifold', 'resource-1', 'resource-2') }}"
|
||||
ansible.builtin.debug: msg="{{ lookup('manifold', 'resource-1', 'resource-2') }}"
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
|
|
|
@ -55,26 +55,26 @@ DOCUMENTATION = '''
|
|||
EXAMPLES = """
|
||||
# These examples only work when already signed in to 1Password
|
||||
- name: Retrieve password for KITT when already signed in to 1Password
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: lookup('onepassword', 'KITT')
|
||||
|
||||
- name: Retrieve password for Wintermute when already signed in to 1Password
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: lookup('onepassword', 'Tessier-Ashpool', section='Wintermute')
|
||||
|
||||
- name: Retrieve username for HAL when already signed in to 1Password
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: lookup('onepassword', 'HAL 9000', field='username', vault='Discovery')
|
||||
|
||||
- name: Retrieve password for HAL when not signed in to 1Password
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: lookup('onepassword'
|
||||
'HAL 9000'
|
||||
subdomain='Discovery'
|
||||
master_password=vault_master_password)
|
||||
|
||||
- name: Retrieve password for HAL when never signed in to 1Password
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: lookup('onepassword'
|
||||
'HAL 9000'
|
||||
subdomain='Discovery'
|
||||
|
|
|
@ -51,11 +51,11 @@ DOCUMENTATION = '''
|
|||
|
||||
EXAMPLES = """
|
||||
- name: Retrieve all data about Wintermute
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: lookup('onepassword_raw', 'Wintermute')
|
||||
|
||||
- name: Retrieve all data about Wintermute when not signed in to 1Password
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: lookup('onepassword_raw', 'Wintermute', subdomain='Turing', vault_password='DmbslfLvasjdl')
|
||||
"""
|
||||
|
||||
|
|
|
@ -57,28 +57,28 @@ DOCUMENTATION = '''
|
|||
EXAMPLES = """
|
||||
# Debug is used for examples, BAD IDEA to show passwords on screen
|
||||
- name: Basic lookup. Fails if example/test doesn't exist
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ lookup('passwordstore', 'example/test')}}"
|
||||
|
||||
- name: Create pass with random 16 character password. If password exists just give the password
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: mypassword
|
||||
vars:
|
||||
mypassword: "{{ lookup('passwordstore', 'example/test create=true')}}"
|
||||
|
||||
- name: Different size password
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ lookup('passwordstore', 'example/test create=true length=42')}}"
|
||||
|
||||
- name: Create password and overwrite the password if it exists. As a bonus, this module includes the old password inside the pass file
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ lookup('passwordstore', 'example/test create=true overwrite=true')}}"
|
||||
|
||||
- name: Create an alphanumeric password
|
||||
debug: msg="{{ lookup('passwordstore', 'example/test create=true nosymbols=true') }}"
|
||||
ansible.builtin.debug: msg="{{ lookup('passwordstore', 'example/test create=true nosymbols=true') }}"
|
||||
|
||||
- name: Return the value for user in the KV pair user, username
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ lookup('passwordstore', 'example/test subkey=user')}}"
|
||||
|
||||
- name: Return the entire password file content
|
||||
|
|
|
@ -46,17 +46,17 @@ DOCUMENTATION = '''
|
|||
|
||||
EXAMPLES = """
|
||||
- name: query redis for somekey (default or configured settings used)
|
||||
debug: msg="{{ lookup('redis', 'somekey') }}"
|
||||
ansible.builtin.debug: msg="{{ lookup('redis', 'somekey') }}"
|
||||
|
||||
- name: query redis for list of keys and non-default host and port
|
||||
debug: msg="{{ lookup('redis', item, host='myredis.internal.com', port=2121) }}"
|
||||
ansible.builtin.debug: msg="{{ lookup('redis', item, host='myredis.internal.com', port=2121) }}"
|
||||
loop: '{{list_of_redis_keys}}'
|
||||
|
||||
- name: use list directly
|
||||
debug: msg="{{ lookup('redis', 'key1', 'key2', 'key3') }}"
|
||||
ansible.builtin.debug: msg="{{ lookup('redis', 'key1', 'key2', 'key3') }}"
|
||||
|
||||
- name: use list directly with a socket
|
||||
debug: msg="{{ lookup('redis', 'key1', 'key2', socket='/var/tmp/redis.sock') }}"
|
||||
ansible.builtin.debug: msg="{{ lookup('redis', 'key1', 'key2', socket='/var/tmp/redis.sock') }}"
|
||||
|
||||
"""
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ DOCUMENTATION = '''
|
|||
|
||||
EXAMPLES = """
|
||||
- name: retrieve a string value corresponding to a key inside a Python shelve file
|
||||
debug: msg="{{ lookup('shelvefile', 'file=path_to_some_shelve_file.db key=key_to_retrieve') }}
|
||||
ansible.builtin.debug: msg="{{ lookup('shelvefile', 'file=path_to_some_shelve_file.db key=key_to_retrieve') }}
|
||||
"""
|
||||
|
||||
RETURN = """
|
||||
|
|
|
@ -73,7 +73,7 @@ EXAMPLES = r"""
|
|||
vars:
|
||||
secret: "{{ lookup('community.general.tss', 1) }}"
|
||||
tasks:
|
||||
- debug: msg="the password is {{ (secret['items'] | items2dict(key_name='slug', value_name='itemValue'))['password'] }}"
|
||||
- ansible.builtin.debug: msg="the password is {{ (secret['items'] | items2dict(key_name='slug', value_name='itemValue'))['password'] }}"
|
||||
"""
|
||||
|
||||
from ansible.errors import AnsibleError, AnsibleOptionsError
|
||||
|
|
|
@ -64,8 +64,8 @@ EXAMPLES = '''
|
|||
state: present
|
||||
register: policy
|
||||
|
||||
- name: debug
|
||||
debug:
|
||||
- name: Debug
|
||||
ansible.builtin.debug:
|
||||
var: policy
|
||||
|
||||
---
|
||||
|
@ -82,7 +82,7 @@ EXAMPLES = '''
|
|||
register: policy
|
||||
|
||||
- name: Debug
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: policy
|
||||
'''
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ EXAMPLES = '''
|
|||
register: policy
|
||||
|
||||
- name: Debug
|
||||
debug: var=policy
|
||||
ansible.builtin.debug: var=policy
|
||||
|
||||
---
|
||||
- name: Delete Alert Policy Example
|
||||
|
@ -103,7 +103,7 @@ EXAMPLES = '''
|
|||
register: policy
|
||||
|
||||
- name: Debug
|
||||
debug: var=policy
|
||||
ansible.builtin.debug: var=policy
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
|
|
|
@ -77,7 +77,7 @@ EXAMPLES = '''
|
|||
register: clc
|
||||
|
||||
- name: Debug
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: clc
|
||||
|
||||
# Delete a Server Group
|
||||
|
@ -96,7 +96,7 @@ EXAMPLES = '''
|
|||
register: clc
|
||||
|
||||
- name: Debug
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: clc
|
||||
'''
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ EXAMPLES = '''
|
|||
register: clc
|
||||
|
||||
- name: Debug
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: clc
|
||||
|
||||
- name: Delete Public IP from Server
|
||||
|
@ -90,7 +90,7 @@ EXAMPLES = '''
|
|||
register: clc
|
||||
|
||||
- name: Debug
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: clc
|
||||
'''
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ EXAMPLES = '''
|
|||
project_src: flask
|
||||
register: output
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
var: output
|
||||
|
||||
- name: Run `docker-compose up` again
|
||||
|
@ -186,7 +186,7 @@ EXAMPLES = '''
|
|||
build: no
|
||||
register: output
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
var: output
|
||||
|
||||
- assert:
|
||||
|
@ -199,7 +199,7 @@ EXAMPLES = '''
|
|||
stopped: yes
|
||||
register: output
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
var: output
|
||||
|
||||
- assert:
|
||||
|
@ -214,7 +214,7 @@ EXAMPLES = '''
|
|||
restarted: yes
|
||||
register: output
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
var: output
|
||||
|
||||
- assert:
|
||||
|
@ -232,7 +232,7 @@ EXAMPLES = '''
|
|||
web: 2
|
||||
register: output
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
var: output
|
||||
|
||||
- name: Run with inline v2 compose
|
||||
|
@ -261,7 +261,7 @@ EXAMPLES = '''
|
|||
- db
|
||||
register: output
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
var: output
|
||||
|
||||
- assert:
|
||||
|
@ -293,7 +293,7 @@ EXAMPLES = '''
|
|||
- db
|
||||
register: output
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
var: output
|
||||
|
||||
- assert:
|
||||
|
|
|
@ -46,11 +46,11 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Does container exist?
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "The container {{ 'exists' if result.exists else 'does not exist' }}"
|
||||
|
||||
- name: Print information about container
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: result.container
|
||||
when: result.exists
|
||||
'''
|
||||
|
|
|
@ -126,7 +126,7 @@ EXAMPLES = '''
|
|||
disk_usage: yes
|
||||
register: result
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
var: result.host_info
|
||||
|
||||
'''
|
||||
|
|
|
@ -46,11 +46,11 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Does network exist?
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "The network {{ 'exists' if result.exists else 'does not exist' }}"
|
||||
|
||||
- name: Print information about network
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: result.network
|
||||
when: result.exists
|
||||
'''
|
||||
|
|
|
@ -94,7 +94,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Inform about basic flags
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: |
|
||||
Was able to talk to docker daemon: {{ result.can_talk_to_docker }}
|
||||
Docker in Swarm mode: {{ result.docker_swarm_active }}
|
||||
|
@ -120,7 +120,7 @@ EXAMPLES = '''
|
|||
name: mynode
|
||||
register: result
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
var: result.swarm_facts
|
||||
|
||||
- name: Get the swarm unlock key
|
||||
|
@ -128,7 +128,7 @@ EXAMPLES = '''
|
|||
unlock_key: yes
|
||||
register: result
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
var: result.swarm_unlock_key
|
||||
|
||||
'''
|
||||
|
|
|
@ -42,11 +42,11 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Does volume exist?
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "The volume {{ 'exists' if result.exists else 'does not exist' }}"
|
||||
|
||||
- name: Print information about volume
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: result.volume
|
||||
when: result.exists
|
||||
'''
|
||||
|
|
|
@ -236,7 +236,7 @@ EXAMPLES = '''
|
|||
register: gce
|
||||
|
||||
- name: Save host data
|
||||
add_host:
|
||||
ansible.builtin.add_host:
|
||||
hostname: "{{ item.public_ip }}"
|
||||
groupname: gce_instances_ips
|
||||
with_items: "{{ gce.instance_data }}"
|
||||
|
|
|
@ -93,7 +93,7 @@ EXAMPLES = '''
|
|||
port: 82
|
||||
|
||||
- name: Pause for 30 seconds
|
||||
pause:
|
||||
ansible.builtin.pause:
|
||||
seconds: 30
|
||||
|
||||
- name: Recreate MIG Instances with Instance Template change.
|
||||
|
@ -105,7 +105,7 @@ EXAMPLES = '''
|
|||
recreate_instances: yes
|
||||
|
||||
- name: Pause for 30 seconds
|
||||
pause:
|
||||
ansible.builtin.pause:
|
||||
seconds: 30
|
||||
|
||||
- name: Resize MIG
|
||||
|
@ -136,7 +136,7 @@ EXAMPLES = '''
|
|||
target: 0.4
|
||||
|
||||
- name: Pause for 30 seconds
|
||||
pause:
|
||||
ansible.builtin.pause:
|
||||
seconds: 30
|
||||
|
||||
- name: Delete MIG
|
||||
|
|
|
@ -238,7 +238,7 @@ EXAMPLES = """
|
|||
register: lvm_container_info
|
||||
|
||||
- name: Debug info on container "test-container-lvm"
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: lvm_container_info
|
||||
|
||||
- name: Run a command in a container and ensure its in a "stopped" state.
|
||||
|
@ -305,7 +305,7 @@ EXAMPLES = """
|
|||
register: clone_container_info
|
||||
|
||||
- name: Debug info on container "test-container"
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: clone_container_info
|
||||
|
||||
- name: Clone a container using snapshot
|
||||
|
|
|
@ -164,14 +164,14 @@ EXAMPLES = '''
|
|||
|
||||
- name: Check python is installed in container
|
||||
delegate_to: mycontainer
|
||||
raw: dpkg -s python
|
||||
ansible.builtin.raw: dpkg -s python
|
||||
register: python_install_check
|
||||
failed_when: python_install_check.rc not in [0, 1]
|
||||
changed_when: false
|
||||
|
||||
- name: Install python in container
|
||||
delegate_to: mycontainer
|
||||
raw: apt-get install -y python
|
||||
ansible.builtin.raw: apt-get install -y python
|
||||
when: python_install_check.rc == 1
|
||||
|
||||
# An example for creating an Ubuntu 14.04 container using an image fingerprint.
|
||||
|
@ -239,7 +239,7 @@ EXAMPLES = '''
|
|||
- mycontainer
|
||||
tasks:
|
||||
- name: Copy /etc/hosts in the created container to localhost with name "mycontainer-hosts"
|
||||
fetch:
|
||||
ansible.builtin.fetch:
|
||||
src: /etc/hosts
|
||||
dest: /tmp/mycontainer-hosts
|
||||
flat: true
|
||||
|
|
|
@ -29,7 +29,7 @@ EXAMPLES = '''
|
|||
community.general.cloud_init_data_facts:
|
||||
register: result
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
var: result
|
||||
|
||||
- name: Wait for cloud init to finish
|
||||
|
|
|
@ -25,7 +25,7 @@ EXAMPLES = '''
|
|||
community.general.xenserver_facts:
|
||||
|
||||
- name: Print running VMs
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ item }}"
|
||||
with_items: "{{ xs_vms.keys() }}"
|
||||
when: xs_vms[item]['power_state'] == "Running"
|
||||
|
|
|
@ -27,7 +27,7 @@ EXAMPLES = r'''
|
|||
api_token: '0d1627e8-bbf0-44c5-a46f-5c4d3aef033f'
|
||||
register: result
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: "{{ result.online_server_info }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ EXAMPLES = r'''
|
|||
community.general.online_user_info:
|
||||
register: result
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: "{{ result.online_user_info }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print the IMAGE properties
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: result
|
||||
|
||||
- name: Rename existing IMAGE
|
||||
|
|
|
@ -70,7 +70,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print all images facts
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: result
|
||||
|
||||
- name: Gather facts about an image using ID
|
||||
|
|
|
@ -110,7 +110,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print service properties
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: result
|
||||
|
||||
- name: Instantiate a new service with specified service_name, service group and mode
|
||||
|
|
|
@ -194,7 +194,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print VM properties
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: result
|
||||
|
||||
- name: Deploy a new VM on hold
|
||||
|
|
|
@ -62,7 +62,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_affinity_labels }}"
|
||||
|
||||
- name: >
|
||||
|
@ -73,7 +73,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_affinity_labels }}"
|
||||
|
||||
- name: >
|
||||
|
@ -84,7 +84,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_affinity_labels }}"
|
||||
|
||||
- name: >
|
||||
|
@ -96,7 +96,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_affinity_labels }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_api }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_clusters }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_datacenters }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_disks }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ EXAMPLES = '''
|
|||
ovirt_event_info:
|
||||
search: "severity=alert"
|
||||
register: result
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_events }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_external_providers }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_groups }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_hosts }}"
|
||||
|
||||
- name: Gather information about all hosts with cluster version 4.2
|
||||
|
@ -64,7 +64,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_hosts }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_host_storages }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_networks }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_nics }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_permissions }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_quotas }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_scheduling_policies }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_snapshots }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_storage_domains }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_storage_templates }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_storage_vms }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_tags }}"
|
||||
|
||||
- name: Gather information about all tags, which are assigned to VM postgres
|
||||
|
@ -71,7 +71,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_tags }}"
|
||||
|
||||
- name: Gather information about all tags, which are assigned to host west
|
||||
|
@ -80,7 +80,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_tags }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_templates }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_users }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_vms }}"
|
||||
|
||||
- name: Gather info about next run configuration of virtual machine named myvm
|
||||
|
@ -87,7 +87,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_vms[0] }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print gathered information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.ovirt_vm_pools }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ EXAMPLES = r'''
|
|||
region: par1
|
||||
register: result
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: "{{ result.scaleway_image_info }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ EXAMPLES = r'''
|
|||
region: par1
|
||||
register: result
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: "{{ result.scaleway_ip_info }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ EXAMPLES = r'''
|
|||
community.general.scaleway_organization_info:
|
||||
register: result
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: "{{ result.scaleway_organization_info }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ EXAMPLES = r'''
|
|||
region: par1
|
||||
register: result
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: "{{ result.scaleway_security_group_info }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ EXAMPLES = r'''
|
|||
region: par1
|
||||
register: result
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: "{{ result.scaleway_server_info }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ EXAMPLES = r'''
|
|||
region: par1
|
||||
register: result
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: "{{ result.scaleway_snapshot_info }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ EXAMPLES = r'''
|
|||
region: par1
|
||||
register: result
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: "{{ result.scaleway_volume_info }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Print information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.smartos_images[item]['name'] }}-{{ result.smartos_images[item]['version'] }}
|
||||
has {{ result.smartos_images[item]['clones'] }} VM(s)"
|
||||
with_items: "{{ result.smartos_images.keys() | list }}"
|
||||
|
@ -50,7 +50,7 @@ EXAMPLES = '''
|
|||
# in ansible_facts['smartos_images'] and can be used as follows.
|
||||
# Note that this is deprecated and will stop working in community.general 3.0.0.
|
||||
- name: Print information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ smartos_images[item]['name'] }}-{{ smartos_images[item]['version'] }}
|
||||
has {{ smartos_images[item]['clones'] }} VM(s)"
|
||||
with_items: "{{ smartos_images.keys() | list }}"
|
||||
|
|
|
@ -494,7 +494,7 @@ EXAMPLES = '''
|
|||
- image_id
|
||||
- target
|
||||
register: result
|
||||
- debug: var=result
|
||||
- ansible.builtin.debug: var=result
|
||||
|
||||
# In this example, we create an elastigroup and wait 600 seconds to retrieve the instances, and use their private ips
|
||||
|
||||
|
@ -538,9 +538,9 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Store private ips to file
|
||||
shell: echo {{ item.private_ip }}\\n >> list-of-private-ips
|
||||
ansible.builtin.shell: echo {{ item.private_ip }}\\n >> list-of-private-ips
|
||||
with_items: "{{ result.instances }}"
|
||||
- debug: var=result
|
||||
- ansible.builtin.debug: var=result
|
||||
|
||||
# In this example, we create an elastigroup with multiple block device mappings, tags, and also an account id
|
||||
# In organizations with more than one account, it is required to specify an account_id
|
||||
|
@ -589,9 +589,9 @@ EXAMPLES = '''
|
|||
register: result
|
||||
|
||||
- name: Store private ips to file
|
||||
shell: echo {{ item.private_ip }}\\n >> list-of-private-ips
|
||||
ansible.builtin.shell: echo {{ item.private_ip }}\\n >> list-of-private-ips
|
||||
with_items: "{{ result.instances }}"
|
||||
- debug: var=result
|
||||
- ansible.builtin.debug: var=result
|
||||
|
||||
# In this example we have set up block device mapping with ephemeral devices
|
||||
|
||||
|
@ -630,7 +630,7 @@ EXAMPLES = '''
|
|||
- image_id
|
||||
- target
|
||||
register: result
|
||||
- debug: var=result
|
||||
- ansible.builtin.debug: var=result
|
||||
|
||||
# In this example we create a basic group configuration with a network interface defined.
|
||||
# Each network interface must have a device index
|
||||
|
@ -668,7 +668,7 @@ EXAMPLES = '''
|
|||
- image_id
|
||||
- target
|
||||
register: result
|
||||
- debug: var=result
|
||||
- ansible.builtin.debug: var=result
|
||||
|
||||
|
||||
# In this example we create a basic group configuration with a target tracking scaling policy defined
|
||||
|
@ -713,7 +713,7 @@ EXAMPLES = '''
|
|||
do_not_update:
|
||||
- image_id
|
||||
register: result
|
||||
- debug: var=result
|
||||
- ansible.builtin.debug: var=result
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
|
|
|
@ -122,14 +122,14 @@ EXAMPLES = '''
|
|||
serial: 1
|
||||
tasks:
|
||||
- name: Install dependencies
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- python
|
||||
- python-pip
|
||||
- python-setuptools
|
||||
state: latest
|
||||
- name: Setup aerospike
|
||||
pip:
|
||||
ansible.builtin.pip:
|
||||
name: aerospike
|
||||
# check for migrations every (sleep_between_checks)
|
||||
# If at least (consecutive_good_checks) checks come back OK in a row, then return OK.
|
||||
|
@ -152,10 +152,10 @@ EXAMPLES = '''
|
|||
delay: 60
|
||||
retries: 120
|
||||
- name: Another thing
|
||||
shell: |
|
||||
ansible.builtin.shell: |
|
||||
echo foo
|
||||
- name: Reboot
|
||||
reboot:
|
||||
ansible.builtin.reboot:
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
|
|
|
@ -49,7 +49,7 @@ EXAMPLES = r'''
|
|||
register: connection
|
||||
|
||||
- name: Print results from the query
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: connection.query_results
|
||||
'''
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ EXAMPLES = r'''
|
|||
register: result
|
||||
|
||||
- name: Print server information
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: result.info
|
||||
'''
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ EXAMPLES = '''
|
|||
|
||||
# Copy database dump file to remote host and restore it to database 'my_db'
|
||||
- name: Copy database dump file to remote host
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: dump.sql
|
||||
dest: /tmp
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ EXAMPLES = r'''
|
|||
value: 32mb
|
||||
register: set
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: "{{ set.name }} {{ set.prev_val_pretty }} >> {{ set.value_pretty }} restart_req: {{ set.restart_required }}"
|
||||
when: set.changed
|
||||
# Ensure that the restart of PostgreSQL server must be required for some parameters.
|
||||
|
|
|
@ -54,7 +54,7 @@ EXAMPLES = """
|
|||
register: result
|
||||
|
||||
- name: Print schemas
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.vertica_schemas }}"
|
||||
"""
|
||||
import traceback
|
||||
|
|
|
@ -82,7 +82,7 @@ EXAMPLES = r'''
|
|||
register: users
|
||||
delegate_to: localhost
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: 'User {{ users.dict.dag.name }} has UID {{ users.dict.dag.uid }} and GID {{ users.dict.dag.gid }}'
|
||||
|
||||
# Read a CSV file and access the first item
|
||||
|
@ -92,7 +92,7 @@ EXAMPLES = r'''
|
|||
register: users
|
||||
delegate_to: localhost
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: 'User {{ users.list.1.name }} has UID {{ users.list.1.uid }} and GID {{ users.list.1.gid }}'
|
||||
|
||||
# Example CSV file without header and semi-colon delimiter
|
||||
|
|
|
@ -195,7 +195,7 @@ EXAMPLES = r'''
|
|||
count: yes
|
||||
register: hits
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
var: hits.count
|
||||
|
||||
# Example where parent XML nodes are created automatically
|
||||
|
@ -251,7 +251,7 @@ EXAMPLES = r'''
|
|||
register: xmlresp
|
||||
|
||||
- name: Show an attribute value
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
var: xmlresp.matches[0].validxhtml.validatedon
|
||||
|
||||
- name: Remove all children from the 'website' element (option 1)
|
||||
|
|
|
@ -135,7 +135,7 @@ EXAMPLES = '''
|
|||
no_log: true # Don't want to log the secrets to the console!
|
||||
|
||||
- name: Debug a password (for example)
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ my_1password_item['onepassword']['My 1Password item'] }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ EXAMPLES = '''
|
|||
- Restart sensu-client
|
||||
|
||||
- name: Secure Sensu client configuration file
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ client['file'] }}"
|
||||
owner: "sensu"
|
||||
group: "sensu"
|
||||
|
|
|
@ -119,7 +119,7 @@ EXAMPLES = '''
|
|||
- Restart sensu-server
|
||||
|
||||
- name: Secure Sensu handler configuration file
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ handler['file'] }}"
|
||||
owner: "sensu"
|
||||
group: "sensu"
|
||||
|
|
|
@ -42,7 +42,7 @@ EXAMPLES = r'''
|
|||
register: result
|
||||
|
||||
- name: Print value of failover IP 1.2.3.4 in case it is routed
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "1.2.3.4 routes to {{ result.value }}"
|
||||
when: result.state == 'routed'
|
||||
'''
|
||||
|
|
|
@ -164,7 +164,7 @@ EXAMPLES = r'''
|
|||
action: discard
|
||||
register: result
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: "{{ result }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ EXAMPLES = r'''
|
|||
server_ip: 1.2.3.4
|
||||
register: result
|
||||
|
||||
- debug:
|
||||
- ansible.builtin.debug:
|
||||
msg: "{{ result.firewall }}"
|
||||
'''
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ EXAMPLES = '''
|
|||
community.general.lldp:
|
||||
|
||||
- name: Print each switch/port
|
||||
debug:
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ lldp[item]['chassis']['name'] }} / {{ lldp[item]['port']['ifname'] }}"
|
||||
with_items: "{{ lldp.keys() }}"
|
||||
|
||||
|
|
|
@ -355,7 +355,7 @@ EXAMPLES = r'''
|
|||
tasks:
|
||||
|
||||
- name: Install needed network manager libs
|
||||
package:
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- NetworkManager-libnm
|
||||
- nm-connection-editor
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue