correct document of module apex_generate_inventory 69/33569/2
authorzhihui wu <wu.zhihui1@zte.com.cn>
Thu, 20 Apr 2017 05:53:29 +0000 (13:53 +0800)
committerYujun Zhang <zhang.yujunz@zte.com.cn>
Fri, 21 Apr 2017 11:52:28 +0000 (11:52 +0000)
Change-Id: I10bfd526e377ae02d2f6cf6d60d82fbb175ac431
Signed-off-by: zhihui wu <wu.zhihui1@zte.com.cn>
qtip/ansible_library/modules/apex_generate_inventory.py

index 9621ba6..7c6c3b6 100644 (file)
@@ -28,6 +28,13 @@ description:
 version_added: "2.2"
 author: "Zhihui Wu"
 options:
+  baremetal_info:
+    description:
+      - return value from "openstack baremetal node list
+        --fields instance_uuid properties provision_state --format json"
+  server_info:
+    description:
+      - return value from "openstack server list --format json"
 notes:
 requirements:
     - Host 'apex-undercloud' is in ~/.ssh/config
@@ -40,7 +47,7 @@ ansible_facts:
   type: dictionary
   contains:
     hosts:
-      description: host grouped by hostname, cluster, role and manufacture
+      description: host grouped by role
       type: dict
     hosts_meta:
       description: hosts meta data indexed by hostname
@@ -52,19 +59,9 @@ EXAMPLES = '''
 - hosts: apex-undercloud
   tasks:
   - name: collect facts of apex hosts
-    apex:
-  - debug: var=hostvarsi
-  - name: add compute node to ansible inventory
-    add_host:
-      name: "{{ hosts_meta[item]['ip'] }}"
-      groups: compute
-      ansible_user: root
-      ansible_ssh_common_args: '-o StrictHostKeyChecking=No -o ProxyJump=apex-master'
-    with_items: "{{ hosts.compute }}"
-- hosts: compute
-  tasks:
-  - name: check ssh connection
-    ping:
+    apex_generate_inventory:
+      baremetal_info: "{{ baremetal_info.stdout | from_json }}"
+      server_info: "{{ server_info.stdout | from_json }}"
 '''