mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-28 07:31:23 -07:00
Allow multiple users to use ec2 inventory scripts
Move the ec2 cache files from a shared /tmp location to the user's ansible tmp directory.
This commit is contained in:
parent
27199dc219
commit
3a0d2860e0
2 changed files with 7 additions and 4 deletions
|
@ -47,7 +47,7 @@ route53 = False
|
||||||
# will be written to this directory:
|
# will be written to this directory:
|
||||||
# - ansible-ec2.cache
|
# - ansible-ec2.cache
|
||||||
# - ansible-ec2.index
|
# - ansible-ec2.index
|
||||||
cache_path = /tmp
|
cache_path = ~/.ansible/tmp
|
||||||
|
|
||||||
# The number of seconds a cache file is considered valid. After this many
|
# The number of seconds a cache file is considered valid. After this many
|
||||||
# seconds, a new API call will be made, and the cache file will be updated.
|
# seconds, a new API call will be made, and the cache file will be updated.
|
||||||
|
|
|
@ -220,9 +220,12 @@ class Ec2Inventory(object):
|
||||||
config.get('ec2', 'route53_excluded_zones', '').split(','))
|
config.get('ec2', 'route53_excluded_zones', '').split(','))
|
||||||
|
|
||||||
# Cache related
|
# Cache related
|
||||||
cache_path = config.get('ec2', 'cache_path')
|
cache_dir = os.path.expanduser(config.get('ec2', 'cache_path'))
|
||||||
self.cache_path_cache = cache_path + "/ansible-ec2.cache"
|
if not os.path.exists(cache_dir):
|
||||||
self.cache_path_index = cache_path + "/ansible-ec2.index"
|
os.makedirs(cache_dir)
|
||||||
|
|
||||||
|
self.cache_path_cache = cache_dir + "/ansible-ec2.cache"
|
||||||
|
self.cache_path_index = cache_dir + "/ansible-ec2.index"
|
||||||
self.cache_max_age = config.getint('ec2', 'cache_max_age')
|
self.cache_max_age = config.getint('ec2', 'cache_max_age')
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue