diff options
-rw-r--r-- | qtip/ansible_library/plugins/filter/__init__.py | 0 | ||||
-rw-r--r-- | qtip/ansible_library/plugins/filter/format.py | 19 | ||||
-rw-r--r-- | tests/integration/ansible.cfg | 2 | ||||
-rw-r--r-- | tests/integration/compute.yaml | 5 | ||||
-rw-r--r-- | tests/integration/hosts | 5 | ||||
-rw-r--r-- | tests/integration/reports/inxi-system-info | 36 | ||||
-rw-r--r-- | tests/integration/tasks/inxi.yaml | 4 | ||||
-rw-r--r-- | tests/integration/templates/inxi-system-info.j2 | 16 |
8 files changed, 82 insertions, 5 deletions
diff --git a/qtip/ansible_library/plugins/filter/__init__.py b/qtip/ansible_library/plugins/filter/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/qtip/ansible_library/plugins/filter/__init__.py diff --git a/qtip/ansible_library/plugins/filter/format.py b/qtip/ansible_library/plugins/filter/format.py new file mode 100644 index 00000000..db844906 --- /dev/null +++ b/qtip/ansible_library/plugins/filter/format.py @@ -0,0 +1,19 @@ +############################################################### +# Copyright (c) 2017 ZTE Corporation +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +from qtip.reporter import filters + + +class FilterModule(object): + + @staticmethod + def filters(): + return { + 'justify': filters.justify + } diff --git a/tests/integration/ansible.cfg b/tests/integration/ansible.cfg index 03a0060c..85966e13 100644 --- a/tests/integration/ansible.cfg +++ b/tests/integration/ansible.cfg @@ -179,7 +179,7 @@ action_plugins = ../../qtip/ansible_library/plugins/action #lookup_plugins = /usr/share/ansible/plugins/lookup #inventory_plugins = /usr/share/ansible/plugins/inventory #vars_plugins = /usr/share/ansible/plugins/vars -#filter_plugins = /usr/share/ansible/plugins/filter +filter_plugins = ../../qtip/ansible_library/plugins/filter #test_plugins = /usr/share/ansible/plugins/test #terminal_plugins = /usr/share/ansible/plugins/terminal #strategy_plugins = /usr/share/ansible/plugins/strategy diff --git a/tests/integration/compute.yaml b/tests/integration/compute.yaml index 8e4353e1..4cb71e9f 100644 --- a/tests/integration/compute.yaml +++ b/tests/integration/compute.yaml @@ -25,3 +25,8 @@ - name: check ssh connection ping: - include: tasks/inxi.yaml +- hosts: local + tasks: + - name: create system information report + local_action: template src=templates/inxi-system-info.j2 dest=reports/inxi-system-info + delegate_to: localhost diff --git a/tests/integration/hosts b/tests/integration/hosts index c8d0641f..9b91eea6 100644 --- a/tests/integration/hosts +++ b/tests/integration/hosts @@ -1 +1,6 @@ +[fuel-master] fuel-master + +[local] +localhost ansible_connection=local + diff --git a/tests/integration/reports/inxi-system-info b/tests/integration/reports/inxi-system-info new file mode 100644 index 00000000..371243e2 --- /dev/null +++ b/tests/integration/reports/inxi-system-info @@ -0,0 +1,36 @@ +System Information from inxi +============================ + +node-26 +----------------------------- + +CPU Brand.................2 Deca core Intel Xeon E5-2650 v3s (-HT-MCP-SMP-) speed/max: 1200/3000 MHz +Disk............................................................................1200.3GB (0.8% used) +Host Name.........................................................................node-26.zte.com.cn +Kernel..............................................................4.4.0-66-generic x86_64 (64 bit) +Memory.............................................................................3836.1/128524.1MB +Operating System.................................................................Ubuntu 16.04 xenial +Product......................................................................................EC600G3 + +node-28 +----------------------------- + +CPU Brand.................2 Deca core Intel Xeon E5-2650 v3s (-HT-MCP-SMP-) speed/max: 1200/3000 MHz +Disk............................................................................1200.3GB (0.8% used) +Host Name.........................................................................node-28.zte.com.cn +Kernel..............................................................4.4.0-66-generic x86_64 (64 bit) +Memory.............................................................................3826.6/128524.1MB +Operating System.................................................................Ubuntu 16.04 xenial +Product......................................................................................EC600G3 + +node-27 +----------------------------- + +CPU Brand.................2 Deca core Intel Xeon E5-2650 v3s (-HT-MCP-SMP-) speed/max: 1200/3000 MHz +Disk............................................................................1200.3GB (0.8% used) +Host Name.........................................................................node-27.zte.com.cn +Kernel..............................................................4.4.0-66-generic x86_64 (64 bit) +Memory.............................................................................3922.4/128524.1MB +Operating System.................................................................Ubuntu 16.04 xenial +Product......................................................................................EC600G3 + diff --git a/tests/integration/tasks/inxi.yaml b/tests/integration/tasks/inxi.yaml index cbcf360d..f8951dc1 100644 --- a/tests/integration/tasks/inxi.yaml +++ b/tests/integration/tasks/inxi.yaml @@ -16,8 +16,6 @@ command: inxi -b -c0 -n register: inxi_log -- debug: var=inxi_log - - name: collect system information from inxi collect: string: "{{ inxi_log.stdout }}" @@ -30,5 +28,3 @@ - '.+\s+HDD Total Size:\s+(?P<disk>.+)\s' - '.+\sproduct:\s+(?P<product>.+)\sv' register: inxi_info - -- debug: var=inxi_info diff --git a/tests/integration/templates/inxi-system-info.j2 b/tests/integration/templates/inxi-system-info.j2 new file mode 100644 index 00000000..35c8661f --- /dev/null +++ b/tests/integration/templates/inxi-system-info.j2 @@ -0,0 +1,16 @@ +System Information from inxi +============================ + +{% for host in groups['compute'] %} +{{ hostvars[host].ansible_hostname }} +----------------------------- + +{{ ('CPU Brand', hostvars[host].inxi_info.cpu[0])|justify }} +{{ ('Disk', hostvars[host].inxi_info.disk[0])|justify }} +{{ ('Host Name', hostvars[host].inxi_info.hostname[0])|justify }} +{{ ('Kernel', hostvars[host].inxi_info.kernel[0])|justify }} +{{ ('Memory', hostvars[host].inxi_info.memory[0])|justify }} +{{ ('Operating System', hostvars[host].inxi_info.os[0])|justify }} +{{ ('Product', hostvars[host].inxi_info.product[0])|justify }} + +{% endfor %} |