From 507cf4beb4bfabc9238a63a9d7c20404878a3d9c Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Wed, 12 Feb 2025 21:29:29 +0100 Subject: [PATCH] Extend description for meta refresh_inventory (#84691) (#84706) * Link to amazon.aws.aws_ec2 inventory plugin. * Mention that refresh_inventory does not update the selected hosts for a play. * Address comments by bcoca. * Apply suggestions from code review --------- Co-authored-by: Abhijeet Kasurde (cherry picked from commit ea2fe793aaa94b5ea4bbc9ad15e4487b0d728196) --- lib/ansible/modules/meta.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/meta.py b/lib/ansible/modules/meta.py index 91b3f0403f9..823ae38303b 100644 --- a/lib/ansible/modules/meta.py +++ b/lib/ansible/modules/meta.py @@ -22,8 +22,13 @@ options: points to implicitly trigger handler runs (after pre/post tasks, the final role execution, and the main tasks section of your plays). - V(refresh_inventory) (added in Ansible 2.0) forces the reload of the inventory, which in the case of dynamic inventory scripts means they will be re-executed. If the dynamic inventory script is using a cache, Ansible cannot know this and has no way of refreshing it (you can disable the cache - or, if available for your specific inventory datasource (e.g. aws), you can use the an inventory plugin instead of an inventory script). - This is mainly useful when additional hosts are created and users wish to use them instead of using the M(ansible.builtin.add_host) module. + or, if available for your specific inventory datasource (for example P(amazon.aws.aws_ec2#inventory)), you can use the an inventory plugin instead + of an inventory script). This is mainly useful when additional hosts are created and users wish to use them instead of using the + M(ansible.builtin.add_host) module. + - Note that neither V(refresh_inventory) nor the M(ansible.builtin.add_host) add hosts to the hosts the current play iterates over. + However, if needed, you can explicitly delegate tasks to new hosts with C(delegate_to). Generally, + C(delegate_to) can be used against hosts regardless of whether they are in the inventory or not, as long as + the value supplied is sufficient for the connection plugin to access the host. - V(noop) (added in Ansible 2.0) This literally does 'nothing'. It is mainly used internally and not recommended for general use. - V(clear_facts) (added in Ansible 2.1) causes the gathered facts for the hosts specified in the play's list of hosts to be cleared, including the fact cache.