mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-04 13:14:24 -07:00
Improved inventory handling when inventory does not yet exist
Fixes #8324 Improves #7667
This commit is contained in:
parent
b0e863b3f8
commit
1787c29354
1 changed files with 4 additions and 1 deletions
|
@ -49,6 +49,7 @@ import time
|
||||||
from ansible import utils
|
from ansible import utils
|
||||||
from ansible.utils import cmd_functions
|
from ansible.utils import cmd_functions
|
||||||
from ansible import errors
|
from ansible import errors
|
||||||
|
from ansible import inventory
|
||||||
|
|
||||||
DEFAULT_REPO_TYPE = 'git'
|
DEFAULT_REPO_TYPE = 'git'
|
||||||
DEFAULT_PLAYBOOK = 'local.yml'
|
DEFAULT_PLAYBOOK = 'local.yml'
|
||||||
|
@ -150,7 +151,9 @@ def main(args):
|
||||||
now = datetime.datetime.now()
|
now = datetime.datetime.now()
|
||||||
print >>sys.stderr, now.strftime("Starting ansible-pull at %F %T")
|
print >>sys.stderr, now.strftime("Starting ansible-pull at %F %T")
|
||||||
|
|
||||||
if not options.inventory:
|
# Attempt to use the inventory passed in as an argument
|
||||||
|
# It might not yet have been downloaded so use localhost if note
|
||||||
|
if not options.inventory or not os.path.exists(options.inventory):
|
||||||
inv_opts = 'localhost,'
|
inv_opts = 'localhost,'
|
||||||
else:
|
else:
|
||||||
inv_opts = options.inventory
|
inv_opts = options.inventory
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue