def _instance(config_instance):
    _instance = ansible_playbook.AnsiblePlaybook('playbook', config_instance)

    # FIXME(decentral1se): temporarily force the sanity checks to not run while
    # putting the AnsiblePlaybook under test. TBD: reconsider whether invoking
    # sanity checks within the `execute()` function makes sense.
    _instance._config.state.change_state('sanity_checked', True)

    return _instance
Example #2
0
    def _get_ansible_playbook(self, playbook, **kwargs):
        """
        Get an instance of AnsiblePlaybook and returns it.

        :param playbook: A string containing an absolute path to a
         provisioner's playbook.
        :param kwargs: An optional keyword arguments.
        :return: object
        """
        return ansible_playbook.AnsiblePlaybook(playbook, self._config, **kwargs)
 def execute_playbook(self, name):
     """Excute the named playbook."""
     # First look for the user provided playbook in the scenario directory.
     # If not found, use the playbook bundled with the plugin.
     playbook = self.playbooks._get_playbook(name)
     if not playbook or not os.path.isfile(playbook):
         playbook = self._get_bundled_playbook(name)
     pb = ansible_playbook.AnsiblePlaybook(playbook, self._config)
     # Target just the testers (all by default.)
     pb.add_cli_arg('extra_vars',
                    f'molecule_robotframework_hosts={self.test_group}')
     pb.execute()
Example #4
0
    def _get_ansible_playbook(self, playbook, **kwargs):
        """
        Get an instance of AnsiblePlaybook and returns it.

        :param playbook: A string containing an absolute path to a
         provisioner's playbook.
        :param kwargs: An optional keyword arguments.
        :return: object
        """
        if playbook:
            # TODO(ssbarnea): Remove that deprecation fallback in 3.1+
            pb_rename_map = {"playbook.yml": "converge.yml"}
            basename = os.path.basename(playbook)
            if basename in pb_rename_map and os.path.isfile(playbook):
                LOG.warning("%s was deprecated, rename it to %s" %
                            (basename, pb_rename_map[basename]))
                old_name = os.path.join(os.path.dirname(playbook),
                                        pb_rename_map[basename])
                if os.path.isfile(old_name):
                    playbook = old_name

        return ansible_playbook.AnsiblePlaybook(playbook, self._config,
                                                **kwargs)
Example #5
0
def _instance(config_instance):
    return ansible_playbook.AnsiblePlaybook('playbook', config_instance)
Example #6
0
def _instance(config_instance):
    _instance = ansible_playbook.AnsiblePlaybook("playbook", config_instance)

    return _instance
Example #7
0
def ansible_playbook_instance(config_instance):
    return ansible_playbook.AnsiblePlaybook('inventory', 'playbook',
                                            config_instance)