summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ansible/vars/manager.py2
-rw-r--r--test/integration/targets/inventory_path_with_comma/aliases1
-rw-r--r--test/integration/targets/inventory_path_with_comma/playbook.yml9
-rwxr-xr-xtest/integration/targets/inventory_path_with_comma/runme.sh5
-rw-r--r--test/integration/targets/inventory_path_with_comma/this,path,has,commas/group_vars/all.yml1
-rw-r--r--test/integration/targets/inventory_path_with_comma/this,path,has,commas/hosts1
6 files changed, 18 insertions, 1 deletions
diff --git a/lib/ansible/vars/manager.py b/lib/ansible/vars/manager.py
index 8d3110b705..09e8c400ad 100644
--- a/lib/ansible/vars/manager.py
+++ b/lib/ansible/vars/manager.py
@@ -255,7 +255,7 @@ class VariableManager:
''' merges all entities by inventory source '''
data = {}
for inventory_dir in self._inventory._sources:
- if ',' in inventory_dir: # skip host lists
+ if ',' in inventory_dir and not os.path.exists(inventory_dir): # skip host lists
continue
elif not os.path.isdir(inventory_dir): # always pass 'inventory directory'
inventory_dir = os.path.dirname(inventory_dir)
diff --git a/test/integration/targets/inventory_path_with_comma/aliases b/test/integration/targets/inventory_path_with_comma/aliases
new file mode 100644
index 0000000000..79d8b9285e
--- /dev/null
+++ b/test/integration/targets/inventory_path_with_comma/aliases
@@ -0,0 +1 @@
+posix/ci/group3
diff --git a/test/integration/targets/inventory_path_with_comma/playbook.yml b/test/integration/targets/inventory_path_with_comma/playbook.yml
new file mode 100644
index 0000000000..64c83689d9
--- /dev/null
+++ b/test/integration/targets/inventory_path_with_comma/playbook.yml
@@ -0,0 +1,9 @@
+---
+- hosts: all
+ gather_facts: false
+ tasks:
+ - name: Ensure we can see group_vars from path with comma
+ assert:
+ that:
+ - inventory_var_from_path_with_commas is defined
+ - inventory_var_from_path_with_commas == 'here'
diff --git a/test/integration/targets/inventory_path_with_comma/runme.sh b/test/integration/targets/inventory_path_with_comma/runme.sh
new file mode 100755
index 0000000000..833e2ac5dd
--- /dev/null
+++ b/test/integration/targets/inventory_path_with_comma/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+set -ux
+
+ansible-playbook -i this,path,has,commas/hosts playbook.yml -v "$@"
diff --git a/test/integration/targets/inventory_path_with_comma/this,path,has,commas/group_vars/all.yml b/test/integration/targets/inventory_path_with_comma/this,path,has,commas/group_vars/all.yml
new file mode 100644
index 0000000000..df5b84d8e6
--- /dev/null
+++ b/test/integration/targets/inventory_path_with_comma/this,path,has,commas/group_vars/all.yml
@@ -0,0 +1 @@
+inventory_var_from_path_with_commas: 'here'
diff --git a/test/integration/targets/inventory_path_with_comma/this,path,has,commas/hosts b/test/integration/targets/inventory_path_with_comma/this,path,has,commas/hosts
new file mode 100644
index 0000000000..5219b90c65
--- /dev/null
+++ b/test/integration/targets/inventory_path_with_comma/this,path,has,commas/hosts
@@ -0,0 +1 @@
+localhost ansible_connect=local