using FQCN also for ansible.builtin collection (#75644)

pull/75783/head
Jonas I. Liechti 3 years ago committed by GitHub
parent e5a52c1e9d
commit e021a65403
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -28,7 +28,7 @@ things in your playbooks.
.. code-block:: yaml
tasks:
- service:
- ansible.builtin.service:
name: foo
state: started
enabled: yes
@ -54,7 +54,7 @@ want certain steps to execute in normal mode even when the `--check` flag is use
- webserver
tasks:
- script: verify.sh
- ansible.builtin.script: verify.sh
check_mode: no
Modules That Are Useful for Testing
@ -64,7 +64,7 @@ Certain playbook modules are particularly good for testing. Below is an example
tasks:
- wait_for:
- ansible.builtin.wait_for:
host: "{{ inventory_hostname }}"
port: 22
delegate_to: localhost
@ -84,8 +84,8 @@ It's easy to push an arbitrary script (in any language) on a remote host and the
tasks:
- script: test_script1
- script: test_script2 --parameter value --parameter2 value
- ansible.builtin.script: test_script1
- ansible.builtin.script: test_script2 --parameter value --parameter2 value
If using roles (you should be, roles are great!), scripts pushed by the script module can live in the 'files/' directory of a role.
@ -93,10 +93,10 @@ And the assert module makes it very easy to validate various kinds of truth::
tasks:
- shell: /usr/bin/some-command --parameter value
- ansible.builtin.shell: /usr/bin/some-command --parameter value
register: cmd_result
- assert:
- ansible.builtin.assert:
that:
- "'not ready' not in cmd_result.stderr"
- "'gizmo enabled' in cmd_result.stdout"
@ -105,11 +105,11 @@ Should you feel the need to test for the existence of files that are not declara
tasks:
- stat:
- ansible.builtin.stat:
path: /path/to/something
register: p
- assert:
- ansible.builtin.assert:
that:
- p.stat.exists and p.stat.isdir
@ -157,7 +157,7 @@ This is the great culmination of embedded tests::
pre_tasks:
- name: take out of load balancer pool
command: /usr/bin/take_out_of_pool {{ inventory_hostname }}
ansible.builtin.command: /usr/bin/take_out_of_pool {{ inventory_hostname }}
delegate_to: 127.0.0.1
roles:
@ -169,7 +169,7 @@ This is the great culmination of embedded tests::
post_tasks:
- name: add back to load balancer pool
command: /usr/bin/add_back_to_pool {{ inventory_hostname }}
ansible.builtin.command: /usr/bin/add_back_to_pool {{ inventory_hostname }}
delegate_to: 127.0.0.1
Of course in the above, the "take out of the pool" and "add back" steps would be replaced with a call to an Ansible load balancer
@ -192,7 +192,7 @@ This above approach can also be modified to run a step from a testing machine re
pre_tasks:
- name: take out of load balancer pool
command: /usr/bin/take_out_of_pool {{ inventory_hostname }}
ansible.builtin.command: /usr/bin/take_out_of_pool {{ inventory_hostname }}
delegate_to: 127.0.0.1
roles:
@ -201,13 +201,13 @@ This above approach can also be modified to run a step from a testing machine re
- webserver
tasks:
- script: /srv/qa_team/app_testing_script.sh --server {{ inventory_hostname }}
- ansible.builtin.script: /srv/qa_team/app_testing_script.sh --server {{ inventory_hostname }}
delegate_to: testing_server
post_tasks:
- name: add back to load balancer pool
command: /usr/bin/add_back_to_pool {{ inventory_hostname }}
ansible.builtin.command: /usr/bin/add_back_to_pool {{ inventory_hostname }}
delegate_to: 127.0.0.1
In the above example, a script is run from the testing server against a remote node prior to bringing it back into

Loading…
Cancel
Save