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

Add this module's namespace to the 'module_' namespace.

Much like we currently have *setup* register the variable `module_setup`, we would like other facts-modules register their own namespace. This means that:

 - *network_facts* registers `module_network`
 - *hpilo_facts* registers `module_hw`
 - *vsphere_facts* registers `module_hw`

In retrospect, it would have made more sense to have `setup` register `module_ansible` instead as the setup module uses the `ansible_` namesepace.

Having the `module_` namespace allows us to check whether a certain namespace has already been loaded so we can avoid running the facts module a second time using only_if.

```yaml
 - action: network_facts host=${ansible_hostname_short}
   only_if: is_unset('$module_network')
```
This commit is contained in:
Dag Wieers 2012-10-08 15:13:17 +02:00
parent c8854a23ea
commit b39aed8736
2 changed files with 4 additions and 1 deletions

View file

@ -124,7 +124,9 @@ def main():
# TODO: Count number of CPUs, DIMMs and total memory # TODO: Count number of CPUs, DIMMs and total memory
data = ilo.get_host_data() data = ilo.get_host_data()
facts = {} facts = {
'module_hw': True,
}
for entry in data: for entry in data:
if not entry.has_key('type'): continue if not entry.has_key('type'): continue
if entry['type'] == 0: # BIOS Information if entry['type'] == 0: # BIOS Information

View file

@ -107,6 +107,7 @@ def main():
data = vm.get_properties() data = vm.get_properties()
facts = { facts = {
'module_hw': True,
'hw_name': vm.properties.name, 'hw_name': vm.properties.name,
'hw_guest_full_name': vm.properties.config.guestFullName, 'hw_guest_full_name': vm.properties.config.guestFullName,
'hw_guest_id': vm.properties.config.guestId, 'hw_guest_id': vm.properties.config.guestId,