Commit 04e7073a authored by yumaojun's avatar yumaojun

1. fixed ansible api auto load local host file (/etc/ansible/hosts) bug with null list

parent 2ccd0724
...@@ -15,9 +15,9 @@ from utils import get_rand_pass ...@@ -15,9 +15,9 @@ from utils import get_rand_pass
import os.path import os.path
API_DIR = os.path.dirname(os.path.abspath(__file__)) API_DIR = os.path.dirname(os.path.abspath(__file__))
ANSIBLE_DIR = os.path.join(API_DIR, 'playbooks') ANSIBLE_DIR = os.path.join(API_DIR, 'playbooks')
NULL_FILE = os.path.join(ANSIBLE_DIR, 'ansible_need.txt')
...@@ -62,7 +62,7 @@ class MyInventory(object): ...@@ -62,7 +62,7 @@ class MyInventory(object):
[{"hostname": "10.10.10.10", "port": "22", "username": "test", "password": "mypass"}, ...] [{"hostname": "10.10.10.10", "port": "22", "username": "test", "password": "mypass"}, ...]
""" """
self.resource = resource self.resource = resource
self.inventory = Inventory(host_list=NULL_FILE) self.inventory = Inventory(host_list=[])
self.gen_inventory() self.gen_inventory()
def add_group(self, hosts, groupname, groupvars=None): def add_group(self, hosts, groupname, groupvars=None):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment