Make ohai and facter work via module_utils Fact classes rather than in the setup module

This commit is contained in:
Toshio Kuratomi
2016-03-14 14:50:27 -07:00
parent 5a1e35224b
commit 512825455e
9 changed files with 135 additions and 104 deletions

View File

@@ -23,7 +23,7 @@ VAULT_PASSWORD_FILE = vault-password
CONSUL_RUNNING := $(shell python consul_running.py)
EUID := $(shell id -u -r)
all: setup test_test_infra parsing test_var_precedence unicode test_templating_settings environment non_destructive destructive includes blocks pull check_mode test_hash test_handlers test_group_by test_vault test_tags test_lookup_paths no_log test_connection
all: setup test_test_infra parsing test_var_precedence unicode test_templating_settings environment non_destructive destructive includes blocks pull check_mode test_hash test_handlers test_group_by test_vault test_tags test_lookup_paths no_log test_connection test_gathering_facts
test_test_infra:
[ "$$(ansible-playbook -i $(INVENTORY) test_test_infra.yml -e @$(VARS_FILE) $(CREDENTIALS_ARG) $(TEST_FLAGS) | fgrep works | xargs)" = "msg: fail works (True) msg: assert works (True)" ]
@@ -70,6 +70,9 @@ unicode: setup
test_templating_settings: setup
ansible-playbook test_templating_settings.yml -i $(INVENTORY) -e outputdir=$(TEST_DIR) -e @$(VARS_FILE) $(CREDENTIALS_ARG) -v $(TEST_FLAGS)
test_gathering_facts: setup
ansible-playbook test_gathering_facts.yml -i $(INVENTORY) -e outputdir=$(TEST_DIR) -e @$(VARS_FILE) -v $(TEST_FLAGS)
environment: setup
ansible-playbook test_environment.yml -i $(INVENTORY) -e outputdir=$(TEST_DIR) -e @$(VARS_FILE) $(CREDENTIALS_ARG) $(TEST_FLAGS)

View File

@@ -3,20 +3,16 @@
- hosts: localhost
tags: [ 'min' ]
connection: local
gather_subset: "min"
ignore_facter: yes
ignore_ohai: yes
gather_subset: "!all"
gather_facts: yes
tasks:
- debug: var={{item}}
with_items: [ 'ansible_user_id', 'ansible_interfaces', 'ansible_mounts', 'ansible_virtualization_role' ]
with_items: [ 'ansible_user_id', 'ansible_interfaces', 'ansible_mounts', 'ansible_virtualization_role' ]
- hosts: localhost
tags: [ 'network' ]
connection: local
gather_subset: "network"
ignore_facter: yes
ignore_ohai: yes
gather_facts: yes
tasks:
- debug: var={{item}}
@@ -26,8 +22,6 @@
tags: [ 'hardware' ]
connection: local
gather_subset: "hardware"
ignore_facter: yes
ignore_ohai: yes
gather_facts: yes
tasks:
- debug: var={{item}}
@@ -37,8 +31,6 @@
tags: [ 'virtual' ]
connection: local
gather_subset: "virtual"
ignore_facter: yes
ignore_ohai: yes
gather_facts: yes
tasks:
- debug: var={{item}}