def _one_runner_one_playbook_execution(playbook_dir, host_file, extra_vars, my_limit, logger=None, limit_playbooks=None, **runner_opts): runners = [ Runner.factory( host_file, os.path.join(playbook_dir, playbook_path), extra_vars=extra_vars, limit_hosts=my_limit, logger=logger, limit_playbooks=limit_playbooks, # Use atmosphere settings group_vars_map={ filename: os.path.join(settings.ANSIBLE_GROUP_VARS_DIR, filename) for filename in os.listdir(settings.ANSIBLE_GROUP_VARS_DIR) }, private_key_file=settings.ATMOSPHERE_PRIVATE_KEYFILE, **runner_opts) for playbook_path in os.listdir(playbook_dir) if not limit_playbooks or playbook_path in limit_playbooks ] [runner.run() for runner in runners] return runners
def _one_runner_all_playbook_execution(playbook_dir, host_file, extra_vars, my_limit, logger=None, limit_playbooks=None, **runner_opts): runner = Runner.factory( host_file, playbook_dir, extra_vars=extra_vars, limit_hosts=my_limit, logger=logger, limit_playbooks=limit_playbooks, private_key_file=settings.ATMOSPHERE_PRIVATE_KEYFILE, # Use atmosphere settings group_vars_map={ filename: os.path.join(settings.ANSIBLE_GROUP_VARS_DIR, filename) for filename in os.listdir(settings.ANSIBLE_GROUP_VARS_DIR) }, **runner_opts) if runner.playbooks == []: msg = "Playbook directory has no playbooks: %s" \ % (playbook_dir, ) if limit_playbooks: msg = "'limit_playbooks=%s' generated zero playbooks." \ " Available playbooks in directory are: %s" \ % (limit_playbooks, runner._get_files(playbook_dir)) raise AnsibleDeployException(msg) runner.run() return runner
def _one_runner_all_playbook_execution( playbook_dir, host_file, extra_vars, my_limit, logger=None, limit_playbooks=None, **runner_opts): from subspace.runner import Runner runner = Runner.factory( host_file, playbook_dir, extra_vars=extra_vars, limit_hosts=my_limit, logger=logger, limit_playbooks=limit_playbooks, private_key_file=settings.ATMOSPHERE_PRIVATE_KEYFILE, # Use atmosphere settings group_vars_map={ filename: os.path.join(settings.ANSIBLE_GROUP_VARS_DIR, filename) for filename in os.listdir(settings.ANSIBLE_GROUP_VARS_DIR) }, **runner_opts) if runner.playbooks == []: msg = "Playbook directory has no playbooks: %s" \ % (playbook_dir, ) if limit_playbooks: msg = "'limit_playbooks=%s' generated zero playbooks." \ " Available playbooks in directory are: %s" \ % (limit_playbooks, runner._get_files(playbook_dir)) raise AnsibleDeployException(msg) runner.run() return runner
def _one_runner_all_playbook_execution( playbook_dir, host_file, extra_vars, my_limit, logger=None, limit_playbooks=None, **runner_opts): runner = Runner.factory( host_file, playbook_dir, run_data=extra_vars, limit_hosts=my_limit, logger=logger, limit_playbooks=limit_playbooks, # Use atmosphere settings group_vars_map={ filename: os.path.join( settings.ANSIBLE_GROUP_VARS_DIR, filename) for filename in os.listdir(settings.ANSIBLE_GROUP_VARS_DIR)}, private_key_file=settings.ATMOSPHERE_PRIVATE_KEYFILE, **runner_opts) runner.run() return runner
def _one_runner_one_playbook_execution( playbook_dir, host_file, extra_vars, my_limit, logger=None, limit_playbooks=None, **runner_opts): from subspace.runner import Runner runners = [Runner.factory( host_file, os.path.join(playbook_dir, playbook_path), extra_vars=extra_vars, limit_hosts=my_limit, logger=logger, limit_playbooks=limit_playbooks, # Use atmosphere settings group_vars_map={ filename: os.path.join(settings.ANSIBLE_GROUP_VARS_DIR, filename) for filename in os.listdir(settings.ANSIBLE_GROUP_VARS_DIR) }, private_key_file=settings.ATMOSPHERE_PRIVATE_KEYFILE, **runner_opts) for playbook_path in os.listdir(playbook_dir) if not limit_playbooks or playbook_path in limit_playbooks] [runner.run() for runner in runners] return runners