aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/common/ansible_common.py
AgeCommit message (Collapse)AuthorFilesLines
2018-07-23Cleanup Ansible common unit testsRodolfo Alonso Hernandez1-19/+17
Removed unneeded output, use proper exception checks and remove filesystem access. JIRA: YARDSTICK-1341 Change-Id: I5c56e7b34d0e96946211e6172290bce24a156d68 Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
2018-04-24Bugfix: ansible can't not run without configchenjiankun1-1/+1
JIRA: YARDSTICK-1135 Ansible need ansible.cfg when run in the remote node. However the file name is wrong. Need: setup.cfg -> ansible.cfg Change-Id: Ifa674fb624ca83d90c3ac9ad3bfe148013bf8bfd Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2018-03-12Get SUT informationchenjiankun1-0/+53
JIRA: YARDSTICK-1063 We have the demand to get SUT information. In this patch, we use ansible to get the SUT information. Change-Id: I983675d6d367fa528f00c1b50bc6fa2a9cee03f7 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2018-02-23Add 'ANSIBLE_ROLES_PATH' in ansible_envJingLu51-2/+3
JIRA: YARDSTICK-1024 This work adds the 'ANSIBLE_ROLES_PATH' as one of the Ansible environment variables. This 'ANSIBLE_ROLES_PATH' is set to the roles directory in Yardstick repo. By adding this variable, Ansible will first searches the local project for a role, then searches the roles_path. It will let the users of the plugin projects to able to use a relative role path for any of their own roles in ansible playbook. Change-Id: I0926ab0c0fa5c6cc37c4fe560db5b2aec3fe6eb1 Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-11-02Ansible: fix lowercasing issue with ConfigParserRoss Brattain1-1/+4
by default ConfigParser will lowercase everything, unless you override optionxform. also sort key value in inventory line for consistency https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.optionxform Transforms the option name option as found in an input file or as passed in by client code to the form that should be used in the internal structures. The default implementation returns a lower-case version of option; subclasses may override this or client code can set an attribute of this name on instances to affect this behavior. You don’t need to subclass the parser to use this method, you can also set it on an instance, to a function that takes a string argument and returns a string. Setting it to str, for example, would make option names case sensitive: cfgparser = ConfigParser() cfgparser.optionxform = str Note that when reading configuration files, whitespace around the option names is stripped before optionxform() is called. YARDSTICK-833 Change-Id: Ia1810b0c77922d84e11c9e538540b38816338593 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-08-11Add Ansible executor class for node contextRoss Brattain1-0/+584
import the AnsibleCommon class to execute Ansible playbooks Update node context support to use AnsibleCommon needs unittests We must call ansible-playbook as an executable, so we must create temp files for inventory, and for the playbooks. AnsibleCommon has evolved to be quite flexible, it auto-generates the inventory from the context['nodes'] and generates groups from the node Role. We also support either a single playbook filename, or a list of filenames. If given a list we dynamically generate a playbook that includes the other playbooks. We support adding any number of extra_vars using a temp JSON file. Also designed to be extended by subclassing. Change-Id: I5bd0a2b4547feaadd70b7e2b8801f19371b99df0 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>