summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/inventory_yaml
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/targets/inventory_yaml')
-rw-r--r--test/integration/targets/inventory_yaml/aliases1
-rw-r--r--test/integration/targets/inventory_yaml/empty.json10
-rwxr-xr-xtest/integration/targets/inventory_yaml/runme.sh6
-rw-r--r--test/integration/targets/inventory_yaml/success.json61
-rw-r--r--test/integration/targets/inventory_yaml/test.yml27
-rw-r--r--test/integration/targets/inventory_yaml/test_int_hostname.yml5
6 files changed, 110 insertions, 0 deletions
diff --git a/test/integration/targets/inventory_yaml/aliases b/test/integration/targets/inventory_yaml/aliases
new file mode 100644
index 0000000..b598321
--- /dev/null
+++ b/test/integration/targets/inventory_yaml/aliases
@@ -0,0 +1 @@
+shippable/posix/group3
diff --git a/test/integration/targets/inventory_yaml/empty.json b/test/integration/targets/inventory_yaml/empty.json
new file mode 100644
index 0000000..e1ae068
--- /dev/null
+++ b/test/integration/targets/inventory_yaml/empty.json
@@ -0,0 +1,10 @@
+{
+ "_meta": {
+ "hostvars": {}
+ },
+ "all": {
+ "children": [
+ "ungrouped"
+ ]
+ }
+}
diff --git a/test/integration/targets/inventory_yaml/runme.sh b/test/integration/targets/inventory_yaml/runme.sh
new file mode 100755
index 0000000..a8818dd
--- /dev/null
+++ b/test/integration/targets/inventory_yaml/runme.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+# handle empty/commented out group keys correctly https://github.com/ansible/ansible/issues/47254
+ANSIBLE_VERBOSITY=0 diff -w <(ansible-inventory -i ./test.yml --list) success.json
+
+ansible-inventory -i ./test_int_hostname.yml --list 2>&1 | grep 'Host pattern 1234 must be a string'
diff --git a/test/integration/targets/inventory_yaml/success.json b/test/integration/targets/inventory_yaml/success.json
new file mode 100644
index 0000000..a8b15f9
--- /dev/null
+++ b/test/integration/targets/inventory_yaml/success.json
@@ -0,0 +1,61 @@
+{
+ "_meta": {
+ "hostvars": {
+ "alice": {
+ "status": "single"
+ },
+ "bobby": {
+ "in_trouble": true,
+ "popular": false
+ },
+ "cindy": {
+ "in_trouble": true,
+ "popular": true
+ },
+ "greg": {
+ "in_trouble": true,
+ "popular": true
+ },
+ "jan": {
+ "in_trouble": true,
+ "popular": false
+ },
+ "marcia": {
+ "in_trouble": true,
+ "popular": true
+ },
+ "peter": {
+ "in_trouble": true,
+ "popular": false
+ }
+ }
+ },
+ "all": {
+ "children": [
+ "cousins",
+ "kids",
+ "the-maid",
+ "ungrouped"
+ ]
+ },
+ "cousins": {
+ "children": [
+ "redheads"
+ ]
+ },
+ "kids": {
+ "hosts": [
+ "bobby",
+ "cindy",
+ "greg",
+ "jan",
+ "marcia",
+ "peter"
+ ]
+ },
+ "the-maid": {
+ "hosts": [
+ "alice"
+ ]
+ }
+}
diff --git a/test/integration/targets/inventory_yaml/test.yml b/test/integration/targets/inventory_yaml/test.yml
new file mode 100644
index 0000000..9755396
--- /dev/null
+++ b/test/integration/targets/inventory_yaml/test.yml
@@ -0,0 +1,27 @@
+all:
+ children:
+ kids:
+ hosts:
+ marcia:
+ popular: True
+ jan:
+ popular: False
+ cindy:
+ popular: True
+ greg:
+ popular: True
+ peter:
+ popular: False
+ bobby:
+ popular: False
+ vars:
+ in_trouble: True
+ cousins:
+ children:
+ redheads:
+ hosts:
+ #oliver: # this used to cause an error and deliver incomplete inventory
+ the-maid:
+ hosts:
+ alice:
+ status: single
diff --git a/test/integration/targets/inventory_yaml/test_int_hostname.yml b/test/integration/targets/inventory_yaml/test_int_hostname.yml
new file mode 100644
index 0000000..d2285cb
--- /dev/null
+++ b/test/integration/targets/inventory_yaml/test_int_hostname.yml
@@ -0,0 +1,5 @@
+all:
+ children:
+ kids:
+ hosts:
+ 1234: {}