How to use add_cli_arg method in molecule

Best Python code snippet using molecule_python

ansible_playbook.py

Source:ansible_playbook.py Github

copy

Full Screen

...52 if not self._playbook:53 return54 # Pass a directory as inventory to let Ansible merge the multiple55 # inventory sources located under56 self.add_cli_arg("inventory", self._config.provisioner.inventory_directory)57 options = util.merge_dicts(self._config.provisioner.options, self._cli)58 verbose_flag = util.verbose_flag(options)59 if self._playbook != self._config.provisioner.playbooks.converge:60 if options.get("become"):61 del options["become"]62 self._ansible_command = sh.ansible_playbook.bake(63 options,64 self._playbook,65 *verbose_flag,66 _cwd=self._config.scenario.directory,67 _env=self._env,68 _out=self._out,69 _err=self._err70 )71 ansible_args = list(self._config.provisioner.ansible_args) + list(72 self._config.ansible_args73 )74 if ansible_args:75 if self._config.action not in ["create", "destroy"]:76 self._ansible_command = self._ansible_command.bake(ansible_args)77 def execute(self):78 """79 Execute ``ansible-playbook`` and returns a string.80 :return: str81 """82 if self._ansible_command is None:83 self.bake()84 if not self._playbook:85 LOG.warning("Skipping, %s action has no playbook." % self._config.action)86 return87 try:88 self._config.driver.sanity_checks()89 cmd = util.run_command(self._ansible_command, debug=self._config.debug)90 return cmd.stdout.decode("utf-8")91 except sh.ErrorReturnCode as e:92 out = e.stdout.decode("utf-8")93 util.sysexit_with_message(str(out), e.exit_code)94 def add_cli_arg(self, name, value):95 """96 Add argument to CLI passed to ansible-playbook and returns None.97 :param name: A string containing the name of argument to be added.98 :param value: The value of argument to be added.99 :return: None100 """101 if value:102 self._cli[name] = value103 def add_env_arg(self, name, value):104 """105 Add argument to environment passed to ansible-playbook and returns \106 None.107 :param name: A string containing the name of argument to be added.108 :param value: The value of argument to be added....

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run molecule automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful