From 46159b9d88d3066495462a01b958dfff91fea131 Mon Sep 17 00:00:00 2001 From: Yoshiyuki Nakahara Date: Tue, 25 Apr 2017 18:20:43 +0900 Subject: [PATCH] change_env_var --- README.md | 27 ++++++++++++++--------- ansible_dynamic_inventory/__version__.txt | 2 +- ansible_dynamic_inventory/cli.py | 4 ++-- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index e02e041..fbfbef2 100755 --- a/README.md +++ b/README.md @@ -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, @@ -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 diff --git a/ansible_dynamic_inventory/__version__.txt b/ansible_dynamic_inventory/__version__.txt index a2268e2..9fc80f9 100755 --- a/ansible_dynamic_inventory/__version__.txt +++ b/ansible_dynamic_inventory/__version__.txt @@ -1 +1 @@ -0.3.1 \ No newline at end of file +0.3.2 \ No newline at end of file diff --git a/ansible_dynamic_inventory/cli.py b/ansible_dynamic_inventory/cli.py index c46652d..3466760 100755 --- a/ansible_dynamic_inventory/cli.py +++ b/ansible_dynamic_inventory/cli.py @@ -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