Skip to content

Commit

Permalink
change_env_var
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoshiyuki-Nakahara committed Apr 25, 2017
1 parent 63c47d9 commit 46159b9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
27 changes: 16 additions & 11 deletions README.md
Expand Up @@ -27,8 +27,23 @@ Optionally, Replace the host list of ansible static inventory with ServiceAddres
# Prerequisite of Replace with Consul Service
If the group name written in the ansible static inventory and the service name registered in the consul service are the same, the host name is replaced.

# Usage
# Stand alone execution
$ ansible-dynamic-inventory --list

# Stand alone execution and specified config file
$ ansible-dynamic-inventory --list --config /path/to/config
# or Specify config file with environment variable
$ ANSIBLE_DYNAMIC_INVENTORY_CONFIG_PATH=/path/to/config ansible-dynamic-inventory --list

# As Ansible Dynamic Inventory execution
$ ansible-playbook --inventory ansible-dynamic-inventory /path/to/playbook.yml

# outut in platuml format
ansible-dynamic-inventory --plantuml

# Configuration
# vi ${module_installed_path}/ansible_dynamic_inventory.ini
# vi ansible_dynamic_inventory.ini

[ansible]
# If both static_inventory_path and dynamic_inventory_path are specified,
Expand All @@ -45,16 +60,6 @@ Optionally, Replace the host list of ansible static inventory with ServiceAddres
#url = http://localhost:8500/v1
url =

# Usage
# Stand alone execution
$ ansible-dynamic-inventory --list

# As Ansible Dynamic Inventory execution
$ ansible-playbook --inventory ansible-dynamic-inventory /path/to/playbook.yml

# outut in platuml format
ansible-dynamic-inventory --plantuml

# Stand alone execution example
ex. ansible:static_inventory_path = ${this repository}/sample_inventory

Expand Down
2 changes: 1 addition & 1 deletion ansible_dynamic_inventory/__version__.txt
@@ -1 +1 @@
0.3.1
0.3.2
4 changes: 2 additions & 2 deletions ansible_dynamic_inventory/cli.py
Expand Up @@ -16,8 +16,8 @@ def _parse_program_args():
parser.add_argument('--plantuml', action='store_true', help='print plantuml format')
parser.add_argument('--config', action='store', help='path to ansible_dynamic_inventory.ini')
args = vars(parser.parse_args())
if args['config'] is None and 'ANSIBLE_DYNAMIC_INVENTORY_INI_PATH' in os.environ:
args['config'] = os.environ['ANSIBLE_DYNAMIC_INVENTORY_INI_PATH']
if args['config'] is None and 'ANSIBLE_DYNAMIC_INVENTORY_CONFIG_PATH' in os.environ:
args['config'] = os.environ['ANSIBLE_DYNAMIC_INVENTORY_CONFIG_PATH']
return args


Expand Down

0 comments on commit 46159b9

Please sign in to comment.