r10k 3.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitattributes +1 -0
- data/.github/pull_request_template.md +1 -0
- data/.github/workflows/docker.yml +56 -0
- data/.github/workflows/release.yml +36 -0
- data/.gitignore +9 -0
- data/.travis.yml +45 -0
- data/CHANGELOG.mkd +1759 -0
- data/CODEOWNERS +2 -0
- data/CONTRIBUTING.mkd +105 -0
- data/Gemfile +15 -0
- data/LICENSE +14 -0
- data/README.mkd +118 -0
- data/Rakefile +3 -0
- data/azure-pipelines.yml +86 -0
- data/bin/r10k +17 -0
- data/doc/common-patterns.mkd +44 -0
- data/doc/dynamic-environments.mkd +31 -0
- data/doc/dynamic-environments/configuration.mkd +669 -0
- data/doc/dynamic-environments/git-environments.mkd +75 -0
- data/doc/dynamic-environments/introduction.mkd +69 -0
- data/doc/dynamic-environments/master-configuration.mkd +40 -0
- data/doc/dynamic-environments/quickstart.mkd +201 -0
- data/doc/dynamic-environments/svn-environments.mkd +45 -0
- data/doc/dynamic-environments/usage.mkd +132 -0
- data/doc/dynamic-environments/workflow-guide.mkd +247 -0
- data/doc/faq.mkd +164 -0
- data/doc/git/cloning-and-mirroring.mkd +60 -0
- data/doc/git/providers.mkd +111 -0
- data/doc/puppetfile.mkd +309 -0
- data/doc/updating-your-puppetfile.mkd +38 -0
- data/docker/.gitignore +1 -0
- data/docker/.rspec +4 -0
- data/docker/Gemfile +11 -0
- data/docker/Makefile +89 -0
- data/docker/README.md +28 -0
- data/docker/r10k/Dockerfile +67 -0
- data/docker/r10k/adduser.sh +13 -0
- data/docker/r10k/docker-entrypoint.d/10-analytics.sh +30 -0
- data/docker/r10k/docker-entrypoint.sh +11 -0
- data/docker/r10k/release.Dockerfile +54 -0
- data/docker/spec/dockerfile_spec.rb +43 -0
- data/docker/spec/fixtures/Puppetfile +2 -0
- data/integration/Gemfile +19 -0
- data/integration/README.mkd +29 -0
- data/integration/Rakefile +77 -0
- data/integration/component/pre-suite/05_install_dev_r10k.rb +12 -0
- data/integration/files/README.mkd +4 -0
- data/integration/files/hiera.yaml +8 -0
- data/integration/files/modules/helloworld/manifests/init.pp +3 -0
- data/integration/files/modules/hieratest/manifests/init.pp +3 -0
- data/integration/files/modules/unicode/files/pretend_unicode +1 -0
- data/integration/files/modules/unicode/manifests/init.pp +6 -0
- data/integration/files/pre-suite/git_config.pp.erb +19 -0
- data/integration/files/pre-suite/prod_env.config +3 -0
- data/integration/files/r10k_conf.yaml.erb +9 -0
- data/integration/lib/README.mkd +4 -0
- data/integration/lib/git_utils.rb +205 -0
- data/integration/lib/master_manipulator.rb +205 -0
- data/integration/lib/r10k_utils.rb +222 -0
- data/integration/manifests/README.mkd +4 -0
- data/integration/pre-suite/00_pe_install.rb +6 -0
- data/integration/pre-suite/10_git_config.rb +48 -0
- data/integration/pre-suite/20_pe_r10k.rb +55 -0
- data/integration/pre-suite/README.mkd +5 -0
- data/integration/tests/Puppetfile/HTTP_PROXY_affects_forge_source.rb +72 -0
- data/integration/tests/Puppetfile/HTTP_PROXY_affects_git_source.rb +70 -0
- data/integration/tests/README.mkd +4 -0
- data/integration/tests/basic_functionality/install_pe_only_module_with_puppetfile.rb +83 -0
- data/integration/tests/basic_functionality/negative/neg_deploy_with_invalid_r10k_yaml.rb +51 -0
- data/integration/tests/basic_functionality/negative/neg_deploy_with_missing_r10k_yaml.rb +28 -0
- data/integration/tests/basic_functionality/negative/neg_invalid_git_provider.rb +45 -0
- data/integration/tests/basic_functionality/negative/negative_bad_proxy.rb +34 -0
- data/integration/tests/basic_functionality/proxy_specified_in_configuration.rb +103 -0
- data/integration/tests/basic_functionality/proxy_with_pe_only_module.rb +128 -0
- data/integration/tests/basic_functionality/proxy_with_puppetfile.rb +61 -0
- data/integration/tests/basic_functionality/rugged_git_provider_with_ssh.rb +109 -0
- data/integration/tests/basic_functionality/rugged_git_provider_without_ssh.rb +108 -0
- data/integration/tests/command_line/deploy_env_without_mod_update.rb +76 -0
- data/integration/tests/command_line/negative/neg_deploy_env_with_module_update.rb +77 -0
- data/integration/tests/command_line/negative/neg_invalid_cmd_line_arg.rb +23 -0
- data/integration/tests/git_source/HTTP_proxy_and_git_source.rb +70 -0
- data/integration/tests/git_source/git_source_git.rb +128 -0
- data/integration/tests/git_source/git_source_ssh.rb +87 -0
- data/integration/tests/git_source/git_source_submodule.rb +70 -0
- data/integration/tests/git_source/negative/neg_git_broken_remote.rb +38 -0
- data/integration/tests/git_source/negative/neg_git_unauthorized_https.rb +46 -0
- data/integration/tests/git_source/negative/neg_git_unauthorized_ssh.rb +73 -0
- data/integration/tests/git_source/negative/neg_git_unicode_branch.rb +35 -0
- data/integration/tests/i18n/deploy_module_with_unicode_in_file_name.rb +64 -0
- data/integration/tests/purging/content_not_purged_at_root.rb +89 -0
- data/integration/tests/purging/default_purging.rb +125 -0
- data/integration/tests/purging/does_not_purge_files_on_white_list.rb +93 -0
- data/integration/tests/purging/invalid_whitelist_types.rb +63 -0
- data/integration/tests/user_scenario/basic_workflow/multi_env_1000_branches.rb +66 -0
- data/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module.rb +111 -0
- data/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module_static.rb +117 -0
- data/integration/tests/user_scenario/basic_workflow/multi_env_hiera.rb +100 -0
- data/integration/tests/user_scenario/basic_workflow/multi_env_multi_source.rb +133 -0
- data/integration/tests/user_scenario/basic_workflow/multi_source_custom_forge_git_module.rb +161 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_basedir.rb +46 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_forge_module.rb +48 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_module.rb +45 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_module_ref.rb +43 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_remote.rb +45 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_branch_name_collision.rb +64 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_disk_full.rb +75 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_duplicate_module_names.rb +44 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_inaccessible_forge.rb +58 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_invalid_env_name.rb +34 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_invalid_puppet_file.rb +36 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_module_specified_at_deleted_release.rb +49 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_read_only.rb +58 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_specify_deleted_forge_module.rb +51 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_10000_files.rb +75 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_git_module.rb +104 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_module.rb +81 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_custom_module.rb +49 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_large_files.rb +75 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_module_already_installed.rb +82 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_module_last_release_deleted.rb +68 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_non-existent_base_dir.rb +94 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_purge_unmanaged_modules.rb +93 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_switch_forge_git_module.rb +117 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_unicode_paths.rb +60 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_upgrade_forge_mod_revert_change.rb +166 -0
- data/integration/tests/user_scenario/complex_workflow/multi_env_add_change_remove.rb +163 -0
- data/integration/tests/user_scenario/complex_workflow/multi_env_remove_re-add.rb +111 -0
- data/integration/tests/user_scenario/complex_workflow/multi_env_unamanaged.rb +78 -0
- data/integration/tests/user_scenario/complex_workflow/single_env_git_module_update.rb +100 -0
- data/lib/r10k.rb +11 -0
- data/lib/r10k/action/base.rb +31 -0
- data/lib/r10k/action/cri_runner.rb +72 -0
- data/lib/r10k/action/deploy.rb +9 -0
- data/lib/r10k/action/deploy/deploy_helpers.rb +34 -0
- data/lib/r10k/action/deploy/display.rb +89 -0
- data/lib/r10k/action/deploy/environment.rb +196 -0
- data/lib/r10k/action/deploy/module.rb +84 -0
- data/lib/r10k/action/puppetfile.rb +10 -0
- data/lib/r10k/action/puppetfile/check.rb +31 -0
- data/lib/r10k/action/puppetfile/cri_runner.rb +26 -0
- data/lib/r10k/action/puppetfile/install.rb +45 -0
- data/lib/r10k/action/puppetfile/purge.rb +28 -0
- data/lib/r10k/action/runner.rb +96 -0
- data/lib/r10k/action/visitor.rb +31 -0
- data/lib/r10k/cli.rb +51 -0
- data/lib/r10k/cli/deploy.rb +114 -0
- data/lib/r10k/cli/ext/logging.rb +15 -0
- data/lib/r10k/cli/help.rb +7 -0
- data/lib/r10k/cli/puppetfile.rb +74 -0
- data/lib/r10k/cli/version.rb +31 -0
- data/lib/r10k/deployment.rb +132 -0
- data/lib/r10k/deployment/config.rb +56 -0
- data/lib/r10k/environment.rb +37 -0
- data/lib/r10k/environment/bare.rb +16 -0
- data/lib/r10k/environment/base.rb +150 -0
- data/lib/r10k/environment/git.rb +81 -0
- data/lib/r10k/environment/name.rb +86 -0
- data/lib/r10k/environment/svn.rb +91 -0
- data/lib/r10k/environment/with_modules.rb +139 -0
- data/lib/r10k/errors.rb +61 -0
- data/lib/r10k/errors/formatting.rb +28 -0
- data/lib/r10k/feature.rb +56 -0
- data/lib/r10k/feature/collection.rb +23 -0
- data/lib/r10k/features.rb +20 -0
- data/lib/r10k/forge/module_release.rb +228 -0
- data/lib/r10k/git.rb +196 -0
- data/lib/r10k/git/alternates.rb +63 -0
- data/lib/r10k/git/cache.rb +108 -0
- data/lib/r10k/git/errors.rb +34 -0
- data/lib/r10k/git/rugged.rb +17 -0
- data/lib/r10k/git/rugged/bare_repository.rb +85 -0
- data/lib/r10k/git/rugged/base_repository.rb +93 -0
- data/lib/r10k/git/rugged/cache.rb +11 -0
- data/lib/r10k/git/rugged/credentials.rb +91 -0
- data/lib/r10k/git/rugged/thin_repository.rb +89 -0
- data/lib/r10k/git/rugged/working_repository.rb +145 -0
- data/lib/r10k/git/shellgit.rb +9 -0
- data/lib/r10k/git/shellgit/bare_repository.rb +43 -0
- data/lib/r10k/git/shellgit/base_repository.rb +137 -0
- data/lib/r10k/git/shellgit/cache.rb +11 -0
- data/lib/r10k/git/shellgit/thin_repository.rb +69 -0
- data/lib/r10k/git/shellgit/working_repository.rb +111 -0
- data/lib/r10k/git/stateful_repository.rb +95 -0
- data/lib/r10k/initializers.rb +67 -0
- data/lib/r10k/instance_cache.rb +32 -0
- data/lib/r10k/keyed_factory.rb +39 -0
- data/lib/r10k/logging.rb +109 -0
- data/lib/r10k/logging/terminaloutputter.rb +36 -0
- data/lib/r10k/module.rb +38 -0
- data/lib/r10k/module/base.rb +113 -0
- data/lib/r10k/module/forge.rb +177 -0
- data/lib/r10k/module/git.rb +109 -0
- data/lib/r10k/module/local.rb +36 -0
- data/lib/r10k/module/metadata_file.rb +31 -0
- data/lib/r10k/module/svn.rb +112 -0
- data/lib/r10k/puppetfile.rb +286 -0
- data/lib/r10k/settings.rb +194 -0
- data/lib/r10k/settings/collection.rb +123 -0
- data/lib/r10k/settings/container.rb +97 -0
- data/lib/r10k/settings/definition.rb +124 -0
- data/lib/r10k/settings/enum_definition.rb +30 -0
- data/lib/r10k/settings/helpers.rb +38 -0
- data/lib/r10k/settings/list.rb +107 -0
- data/lib/r10k/settings/loader.rb +99 -0
- data/lib/r10k/settings/mixin.rb +54 -0
- data/lib/r10k/settings/uri_definition.rb +19 -0
- data/lib/r10k/source.rb +42 -0
- data/lib/r10k/source/base.rb +74 -0
- data/lib/r10k/source/exec.rb +51 -0
- data/lib/r10k/source/git.rb +142 -0
- data/lib/r10k/source/hash.rb +182 -0
- data/lib/r10k/source/svn.rb +136 -0
- data/lib/r10k/source/yaml.rb +20 -0
- data/lib/r10k/source/yamldir.rb +32 -0
- data/lib/r10k/svn.rb +6 -0
- data/lib/r10k/svn/remote.rb +68 -0
- data/lib/r10k/svn/working_dir.rb +125 -0
- data/lib/r10k/util/attempt.rb +84 -0
- data/lib/r10k/util/basedir.rb +65 -0
- data/lib/r10k/util/commands.rb +31 -0
- data/lib/r10k/util/exec_env.rb +36 -0
- data/lib/r10k/util/license.rb +24 -0
- data/lib/r10k/util/platform.rb +42 -0
- data/lib/r10k/util/purgeable.rb +88 -0
- data/lib/r10k/util/setopts.rb +55 -0
- data/lib/r10k/util/subprocess.rb +84 -0
- data/lib/r10k/util/subprocess/result.rb +56 -0
- data/lib/r10k/util/subprocess/runner.rb +26 -0
- data/lib/r10k/util/subprocess/runner/jruby.rb +23 -0
- data/lib/r10k/util/subprocess/runner/posix.rb +103 -0
- data/lib/r10k/util/subprocess/runner/pump.rb +59 -0
- data/lib/r10k/util/subprocess/runner/windows.rb +23 -0
- data/lib/r10k/util/subprocess/subprocess_error.rb +24 -0
- data/lib/r10k/util/symbolize_keys.rb +35 -0
- data/lib/r10k/version.rb +6 -0
- data/locales/config.yaml +21 -0
- data/locales/r10k.pot +545 -0
- data/r10k.gemspec +50 -0
- data/r10k.yaml.example +112 -0
- data/spec/fixtures/empty/.empty +0 -0
- data/spec/fixtures/integration/git/puppet-boolean-bare.tar +0 -0
- data/spec/fixtures/module/forge/bad_module/metadata.json +1 -0
- data/spec/fixtures/module/forge/eight_hundred/Modulefile +8 -0
- data/spec/fixtures/module/forge/eight_hundred/metadata.json +19 -0
- data/spec/fixtures/unit/action/r10k.yaml +5 -0
- data/spec/fixtures/unit/action/r10k_cachedir.yaml +2 -0
- data/spec/fixtures/unit/action/r10k_generate_types.yaml +3 -0
- data/spec/fixtures/unit/action/r10k_puppet_path.yaml +3 -0
- data/spec/fixtures/unit/puppetfile/argument-error/Puppetfile +1 -0
- data/spec/fixtures/unit/puppetfile/default-branch-override/Puppetfile +5 -0
- data/spec/fixtures/unit/puppetfile/duplicate-module-error/Puppetfile +10 -0
- data/spec/fixtures/unit/puppetfile/invalid-syntax/Puppetfile +1 -0
- data/spec/fixtures/unit/puppetfile/load-error/Puppetfile +1 -0
- data/spec/fixtures/unit/puppetfile/name-error/Puppetfile +1 -0
- data/spec/fixtures/unit/puppetfile/valid-forge-with-version/Puppetfile +1 -0
- data/spec/fixtures/unit/puppetfile/valid-forge-without-version/Puppetfile +1 -0
- data/spec/fixtures/unit/util/purgeable/managed_one/expected_1 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_one/managed_subdir_1/subdir_expected_1 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_one/managed_subdir_1/subdir_unmanaged_1 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_one/unmanaged_1 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_two/expected_2 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_two/unmanaged_2 +0 -0
- data/spec/fixtures/unit/util/subprocess/runner/no-execute.sh +3 -0
- data/spec/integration/git/rugged/bare_repository_spec.rb +13 -0
- data/spec/integration/git/rugged/thin_repository_spec.rb +14 -0
- data/spec/integration/git/rugged/working_repository_spec.rb +48 -0
- data/spec/integration/git/shellgit/bare_repository_spec.rb +13 -0
- data/spec/integration/git/shellgit/thin_repository_spec.rb +14 -0
- data/spec/integration/git/shellgit/working_repository_spec.rb +13 -0
- data/spec/integration/git/stateful_repository_spec.rb +159 -0
- data/spec/matchers/exit_with.rb +28 -0
- data/spec/matchers/match_realpath.rb +18 -0
- data/spec/r10k-mocks.rb +3 -0
- data/spec/r10k-mocks/mock_config.rb +33 -0
- data/spec/r10k-mocks/mock_env.rb +15 -0
- data/spec/r10k-mocks/mock_source.rb +13 -0
- data/spec/shared-contexts/git-fixtures.rb +55 -0
- data/spec/shared-examples/deploy-actions.rb +69 -0
- data/spec/shared-examples/git-repository.rb +38 -0
- data/spec/shared-examples/git/bare_repository.rb +132 -0
- data/spec/shared-examples/git/thin_repository.rb +26 -0
- data/spec/shared-examples/git/working_repository.rb +207 -0
- data/spec/shared-examples/puppetfile-action.rb +39 -0
- data/spec/shared-examples/settings/ancestry.rb +44 -0
- data/spec/shared-examples/subprocess-runner.rb +83 -0
- data/spec/spec_helper.rb +40 -0
- data/spec/unit/action/cri_runner_spec.rb +72 -0
- data/spec/unit/action/deploy/deploy_helpers_spec.rb +38 -0
- data/spec/unit/action/deploy/display_spec.rb +31 -0
- data/spec/unit/action/deploy/environment_spec.rb +395 -0
- data/spec/unit/action/deploy/module_spec.rb +139 -0
- data/spec/unit/action/puppetfile/check_spec.rb +41 -0
- data/spec/unit/action/puppetfile/cri_runner_spec.rb +47 -0
- data/spec/unit/action/puppetfile/install_spec.rb +84 -0
- data/spec/unit/action/puppetfile/purge_spec.rb +42 -0
- data/spec/unit/action/runner_spec.rb +213 -0
- data/spec/unit/action/visitor_spec.rb +39 -0
- data/spec/unit/cli_spec.rb +9 -0
- data/spec/unit/deployment/config_spec.rb +33 -0
- data/spec/unit/deployment_spec.rb +162 -0
- data/spec/unit/environment/base_spec.rb +109 -0
- data/spec/unit/environment/git_spec.rb +97 -0
- data/spec/unit/environment/name_spec.rb +135 -0
- data/spec/unit/environment/svn_spec.rb +133 -0
- data/spec/unit/errors/formatting_spec.rb +84 -0
- data/spec/unit/feature_spec.rb +50 -0
- data/spec/unit/forge/module_release_spec.rb +213 -0
- data/spec/unit/git/alternates_spec.rb +116 -0
- data/spec/unit/git/cache_spec.rb +55 -0
- data/spec/unit/git/rugged/cache_spec.rb +29 -0
- data/spec/unit/git/rugged/credentials_spec.rb +109 -0
- data/spec/unit/git/shellgit/cache_spec.rb +27 -0
- data/spec/unit/git/stateful_repository_spec.rb +40 -0
- data/spec/unit/git_spec.rb +102 -0
- data/spec/unit/initializers_spec.rb +68 -0
- data/spec/unit/instance_cache_spec.rb +78 -0
- data/spec/unit/keyed_factory_spec.rb +51 -0
- data/spec/unit/logging/terminaloutputter_spec.rb +53 -0
- data/spec/unit/logging_spec.rb +68 -0
- data/spec/unit/module/base_spec.rb +72 -0
- data/spec/unit/module/forge_spec.rb +207 -0
- data/spec/unit/module/git_spec.rb +274 -0
- data/spec/unit/module/metadata_file_spec.rb +68 -0
- data/spec/unit/module/svn_spec.rb +178 -0
- data/spec/unit/module_spec.rb +29 -0
- data/spec/unit/puppetfile_spec.rb +300 -0
- data/spec/unit/settings/collection_spec.rb +123 -0
- data/spec/unit/settings/container_spec.rb +92 -0
- data/spec/unit/settings/definition_spec.rb +79 -0
- data/spec/unit/settings/enum_definition_spec.rb +20 -0
- data/spec/unit/settings/inheritance_spec.rb +38 -0
- data/spec/unit/settings/list_spec.rb +88 -0
- data/spec/unit/settings/loader_spec.rb +110 -0
- data/spec/unit/settings/uri_definition_spec.rb +23 -0
- data/spec/unit/settings_spec.rb +246 -0
- data/spec/unit/source/base_spec.rb +31 -0
- data/spec/unit/source/exec_spec.rb +81 -0
- data/spec/unit/source/git_spec.rb +185 -0
- data/spec/unit/source/hash_spec.rb +54 -0
- data/spec/unit/source/svn_spec.rb +196 -0
- data/spec/unit/source/yaml_spec.rb +42 -0
- data/spec/unit/source_spec.rb +10 -0
- data/spec/unit/svn/remote_spec.rb +21 -0
- data/spec/unit/svn/working_dir_spec.rb +56 -0
- data/spec/unit/util/attempt_spec.rb +82 -0
- data/spec/unit/util/commands_spec.rb +61 -0
- data/spec/unit/util/exec_env_spec.rb +56 -0
- data/spec/unit/util/purgeable_spec.rb +230 -0
- data/spec/unit/util/setopts_spec.rb +59 -0
- data/spec/unit/util/subprocess/result_spec.rb +36 -0
- data/spec/unit/util/subprocess/runner/posix_spec.rb +7 -0
- data/spec/unit/util/subprocess/runner/pump_spec.rb +79 -0
- data/spec/unit/util/subprocess/runner/windows_spec.rb +7 -0
- data/spec/unit/util/subprocess/subprocess_error_spec.rb +26 -0
- data/spec/unit/util/subprocess_spec.rb +65 -0
- data/spec/unit/util/symbolize_keys_spec.rb +67 -0
- metadata +582 -0
@@ -0,0 +1,669 @@
|
|
1
|
+
Dynamic Environment Configuration
|
2
|
+
=================================
|
3
|
+
|
4
|
+
R10k uses a configuration file to determine how dynamic environments should be
|
5
|
+
deployed.
|
6
|
+
|
7
|
+
Config file location
|
8
|
+
--------------------
|
9
|
+
|
10
|
+
### Manual configuration
|
11
|
+
|
12
|
+
An explicit configuration file location be specified by providing the `--config`
|
13
|
+
option to `r10k deploy`, like so:
|
14
|
+
|
15
|
+
r10k deploy --config /srv/puppet/r10k.yaml [...]
|
16
|
+
|
17
|
+
### Automatic configuration
|
18
|
+
|
19
|
+
If an explicit configuration file is not given, r10k will search the following
|
20
|
+
locations for a configuration file.
|
21
|
+
|
22
|
+
* `{current working directory}/r10k.yaml`
|
23
|
+
* `/etc/puppetlabs/r10k/r10k.yaml` (1.5.0 and later)
|
24
|
+
* `/etc/r10k.yaml` (deprecated in 1.5.0)
|
25
|
+
|
26
|
+
In 1.5.0 r10k added `/etc/puppetlabs/r10k/r10k.yaml` to the configuration search
|
27
|
+
path. The old location, `/etc/r10k.yaml` has been deprecated in favor of the new
|
28
|
+
location. If both `/etc/puppetlabs/r10k/r10k.yaml` and `/etc/r10k.yaml` exist
|
29
|
+
and explicit configuration file has not been given, r10k will log a warning and
|
30
|
+
use `/etc/puppetlabs/r10k/r10.yaml`.
|
31
|
+
|
32
|
+
General options
|
33
|
+
---------------
|
34
|
+
|
35
|
+
### cachedir
|
36
|
+
|
37
|
+
The 'cachedir' setting specifies where r10k should keep cached information.
|
38
|
+
Right now this is predominantly used for caching git repositories but will be
|
39
|
+
expanded as other subsystems can take advantage of caching.
|
40
|
+
|
41
|
+
For example:
|
42
|
+
|
43
|
+
```yaml
|
44
|
+
---
|
45
|
+
# Store all cache information in /var/cache
|
46
|
+
cachedir: '/var/cache/r10k'
|
47
|
+
```
|
48
|
+
|
49
|
+
|
50
|
+
The cachedir setting defaults to `~/.r10k`. If the HOME environment variable is
|
51
|
+
unset r10k will assume that r10k is being run with the Puppet [`prerun_command`](https://puppet.com/docs/puppet/latest/configuration.html#preruncommand)
|
52
|
+
setting and will set the cachedir default to `/root/.r10k`.
|
53
|
+
|
54
|
+
### proxy
|
55
|
+
|
56
|
+
The 'proxy' setting configures a proxy server to use for all operations which occur over
|
57
|
+
an HTTP(S) transport. You can override this setting for Git or Forge operations only by
|
58
|
+
setting the 'proxy' setting under the 'git' or 'forge' settings. You can also override
|
59
|
+
for a specific Git repository by setting a proxy in the 'repositories' list of the 'git'
|
60
|
+
setting. By default, r10k will look for and use the first environment variable it finds
|
61
|
+
in this list: HTTPS\_PROXY, https\_proxy, HTTP\_PROXY, http\_proxy. If no proxy setting
|
62
|
+
is found in the environment, this setting will default to use no proxy.
|
63
|
+
|
64
|
+
```yaml
|
65
|
+
proxy: 'http://proxy.example.com:3128'
|
66
|
+
```
|
67
|
+
|
68
|
+
r10k also supports using authenticated proxies with either Basic or Digest authentication:
|
69
|
+
|
70
|
+
```yaml
|
71
|
+
proxy: 'http://user:password@proxy.example.com:3128'
|
72
|
+
```
|
73
|
+
|
74
|
+
The proxy server being used will be logged at the "debug" level when r10k runs.
|
75
|
+
|
76
|
+
### pool_size
|
77
|
+
|
78
|
+
The pool_size setting is a number to determine how many threads should be spawn
|
79
|
+
while updating modules. The default value is 1, which means the default behaviour
|
80
|
+
is to update modules in a serial manner. Increasing this number should bring
|
81
|
+
some performance gains.
|
82
|
+
|
83
|
+
### git
|
84
|
+
|
85
|
+
The 'git' setting is a hash that contains Git specific settings.
|
86
|
+
|
87
|
+
#### provider
|
88
|
+
|
89
|
+
The provider option determines which Git provider should be used.
|
90
|
+
|
91
|
+
```yaml
|
92
|
+
git:
|
93
|
+
provider: rugged # one of shellgit, rugged
|
94
|
+
```
|
95
|
+
|
96
|
+
See the [git provider documentation](../git/providers.mkd) for more information
|
97
|
+
regarding Git providers.
|
98
|
+
|
99
|
+
#### proxy
|
100
|
+
|
101
|
+
The 'proxy' setting allows you to set or override the global proxy setting specifically
|
102
|
+
for Git operations that use an HTTP(S) transport. See the global proxy setting documentation
|
103
|
+
for more information and examples.
|
104
|
+
|
105
|
+
#### username
|
106
|
+
|
107
|
+
The username setting is only used by the Rugged git provider.
|
108
|
+
|
109
|
+
The username option sets the username for SSH remotes when the SSH URL does not provide
|
110
|
+
a username. When used with a Git hosting service this is most sensibly set to 'git'.
|
111
|
+
|
112
|
+
The username defaults to the username of the currently logged in user.
|
113
|
+
|
114
|
+
```yaml
|
115
|
+
git:
|
116
|
+
username: "git"
|
117
|
+
```
|
118
|
+
|
119
|
+
#### private_key
|
120
|
+
|
121
|
+
The private_key setting is only used by the Rugged git provider.
|
122
|
+
|
123
|
+
The private_key option specifies the path to the default Git SSH private key for Git SSH remotes.
|
124
|
+
The private_key setting must be set if SSH remotes are used.
|
125
|
+
|
126
|
+
```yaml
|
127
|
+
git:
|
128
|
+
private_key: "/etc/puppetlabs/r10k/ssh/id_rsa"
|
129
|
+
```
|
130
|
+
|
131
|
+
#### repositories
|
132
|
+
|
133
|
+
The repositories option allows configuration to be set on a per-remote basis. Each entry is a map of
|
134
|
+
the repository URL and per-repository configuration for that repo.
|
135
|
+
|
136
|
+
##### private_key
|
137
|
+
|
138
|
+
A repository specific private key to use for SSH connections for the given repository URL. This
|
139
|
+
overrides the global private_key setting.
|
140
|
+
|
141
|
+
```yaml
|
142
|
+
git:
|
143
|
+
repositories:
|
144
|
+
- remote: "ssh://tessier-ashpool.freeside/protected-repo.git"
|
145
|
+
private_key: "/etc/puppetlabs/r10k/ssh/id_rsa-protected-repo-deploy-key"
|
146
|
+
```
|
147
|
+
|
148
|
+
##### proxy
|
149
|
+
|
150
|
+
The 'proxy' setting allows you to set or override the global proxy setting for a single, specific
|
151
|
+
repository. See the global proxy setting documentation for more information and examples.
|
152
|
+
|
153
|
+
### forge
|
154
|
+
|
155
|
+
The 'forge' setting is a hash that contains settings for downloading modules
|
156
|
+
from the Puppet Forge.
|
157
|
+
|
158
|
+
#### proxy
|
159
|
+
|
160
|
+
The 'proxy' setting allows you to set or override the global proxy setting for all Forge
|
161
|
+
interactions. See the global proxy setting documentation for more information and examples.
|
162
|
+
|
163
|
+
#### baseurl
|
164
|
+
|
165
|
+
The 'baseurl' setting indicates where Forge modules should be installed from.
|
166
|
+
This defaults to 'https://forgeapi.puppetlabs.com'
|
167
|
+
|
168
|
+
```yaml
|
169
|
+
forge:
|
170
|
+
baseurl: 'https://private-forge.mysite'
|
171
|
+
```
|
172
|
+
|
173
|
+
Deployment options
|
174
|
+
------------------
|
175
|
+
|
176
|
+
The following options configure how r10k deploys dynamic environments.
|
177
|
+
|
178
|
+
### postrun
|
179
|
+
|
180
|
+
The `postrun` setting specifies an arbitrary command to run after deploying all
|
181
|
+
environments. The command must be an array of strings that will be used as an
|
182
|
+
argument vector. The exit code of the command is not currently used, but the
|
183
|
+
command should exit with a return code of 0 as the exit code may have semantics
|
184
|
+
in the future.
|
185
|
+
|
186
|
+
```yaml
|
187
|
+
---
|
188
|
+
postrun: ['/usr/bin/curl', '-F', 'deploy=done', 'http://my-app.site/endpoint']
|
189
|
+
```
|
190
|
+
|
191
|
+
The postrun setting can only be set once.
|
192
|
+
|
193
|
+
Occurrences of the string `$modifiedenvs` in the postrun command will be
|
194
|
+
replaced with the current environment(s) being deployed.
|
195
|
+
|
196
|
+
### sources
|
197
|
+
|
198
|
+
The `sources` setting specifies what repositories should be used for creating
|
199
|
+
dynamic environments. It is a hash where each key is the short name of a
|
200
|
+
specific repository (for instance, "qa" or "web" or "ops") and the value is a
|
201
|
+
hash of properties for that source.
|
202
|
+
|
203
|
+
```yaml
|
204
|
+
---
|
205
|
+
sources:
|
206
|
+
main:
|
207
|
+
# Source settings follow
|
208
|
+
```
|
209
|
+
|
210
|
+
### deploy
|
211
|
+
|
212
|
+
The `deploy` setting is a top level setting for controlling how r10k deploys
|
213
|
+
behave. At this point only new settings are included under this setting, but in
|
214
|
+
the long term the current top level deploy settings will be moved under
|
215
|
+
`deploy`.
|
216
|
+
|
217
|
+
#### purge\_levels
|
218
|
+
|
219
|
+
The `purge_levels` setting controls how aggressively r10k will purge unmanaged
|
220
|
+
content during a deployment. Given value must be a list of strings indicating at
|
221
|
+
what levels unmanaged content should be purged. The valid string options for the
|
222
|
+
list are 'deployment', 'environment', and 'puppetfile'.
|
223
|
+
|
224
|
+
```yaml
|
225
|
+
---
|
226
|
+
deploy:
|
227
|
+
purge_levels: [ 'deployment', 'environment', 'puppetfile' ]
|
228
|
+
```
|
229
|
+
|
230
|
+
This setting currently only impacts the "deploy environment" action.
|
231
|
+
|
232
|
+
The default value is `['deployment', 'puppetfile']` to maintain parity with
|
233
|
+
existing behavior before this setting was added.
|
234
|
+
|
235
|
+
The effect of enabling the various purge levels is as follows:
|
236
|
+
|
237
|
+
##### deployment
|
238
|
+
|
239
|
+
After each deploy, in the configured basedir, r10k will recursively remove any
|
240
|
+
content found which is not managed by one of the sources declared in the r10k.yaml
|
241
|
+
configuration. Note that disabling this level of purging may cause the number of
|
242
|
+
deployed environments to grow without bound; deleting branches from a control
|
243
|
+
repo would no longer cause the matching environment to be purged.
|
244
|
+
|
245
|
+
##### environment
|
246
|
+
|
247
|
+
After a given environment is deployed, r10k will recursively remove any content
|
248
|
+
found which is neither committed to the control repo branch that maps to that
|
249
|
+
environment, nor declared in a Puppetfile committed to that branch.
|
250
|
+
|
251
|
+
Enabling this purge level will cause r10k to load and parse the Puppetfile for
|
252
|
+
the environment even without the `--puppetfile` flag being set. However,
|
253
|
+
Puppetfile content will still only be deployed if the environment is new or
|
254
|
+
the `--puppetfile` flag is set. Additionally, no environment-level content
|
255
|
+
will be purged if any errors are encountered while evaluating the Puppetfile
|
256
|
+
or deploying its contents.
|
257
|
+
|
258
|
+
Note that the .r10k-deploy.json file is exempt from this purging.
|
259
|
+
|
260
|
+
##### puppetfile
|
261
|
+
|
262
|
+
After Puppetfile content for a given environment is deployed, r10k will
|
263
|
+
recursively remove any content found in a directory managed by the Puppetfile
|
264
|
+
which is not also declared in that Puppetfile. Directories considered to be
|
265
|
+
managed by a Puppetfile include the configured `moduledir` (which defaults to
|
266
|
+
"modules") as well as alternate directories specified as an `install_path`
|
267
|
+
option to any Puppetfile content declarations.
|
268
|
+
|
269
|
+
#### purge\_whitelist
|
270
|
+
|
271
|
+
The `purge_whitelist` setting exempts the specified filename patterns from
|
272
|
+
being purged. This setting is currently only considered during `environment`
|
273
|
+
level purging. (See above.) Given value must be a list of shell style filename
|
274
|
+
patterns in string format.
|
275
|
+
|
276
|
+
See the Ruby [documentation for the `fnmatch` method](http://ruby-doc.org/core-2.2.0/File.html#method-c-fnmatch)
|
277
|
+
for more details on valid patterns. Note that the `FNM_PATHNAME` and
|
278
|
+
`FNM_DOTMATCH` flags are in effect when r10k considers the whitelist.
|
279
|
+
|
280
|
+
Patterns are relative to the root of the environment being purged and *do
|
281
|
+
not match recursively* by default. For example, a whitelist value of
|
282
|
+
`*myfile*` would only preserve a matching file at the root of the
|
283
|
+
environment. To preserve the file throughout the deployed environment,
|
284
|
+
a recursive pattern such as `**/*myfile*` would be required.
|
285
|
+
|
286
|
+
Files matching a whitelist pattern may still be removed if they exist in
|
287
|
+
a folder that is otherwise subject to purging. In this case, an additional
|
288
|
+
whitelist rule to preserve the containing folder is required.
|
289
|
+
|
290
|
+
```yaml
|
291
|
+
---
|
292
|
+
deploy:
|
293
|
+
purge_whitelist: [ 'custom.json', '**/*.xpp' ]
|
294
|
+
```
|
295
|
+
|
296
|
+
|
297
|
+
#### write\_lock
|
298
|
+
|
299
|
+
The `write_lock` setting allows administrators to temporarily disallow r10k code
|
300
|
+
deploys without having to remove the r10k configuration entirely. This can be
|
301
|
+
useful to prevent r10k deploys at certain times or prevent r10k from interfering
|
302
|
+
with a common set of code that may be touched by multiple r10k configurations.
|
303
|
+
|
304
|
+
```yaml
|
305
|
+
---
|
306
|
+
deploy:
|
307
|
+
write_lock: "Deploying code is disallowed until the next maintenance window (2038-01-19)"
|
308
|
+
```
|
309
|
+
|
310
|
+
#### generate\_types
|
311
|
+
|
312
|
+
The `generate_types` setting controls whether r10k should update generated types
|
313
|
+
after a successful environment update. See [Environment isolation](https://puppet.com/docs/puppet/latest/environment\_isolation.html)
|
314
|
+
for more information on generated types. Defaults to false.
|
315
|
+
|
316
|
+
```yaml
|
317
|
+
deploy:
|
318
|
+
generate_types: true
|
319
|
+
```
|
320
|
+
|
321
|
+
#### puppet\_path
|
322
|
+
|
323
|
+
The path to the puppet executable used for generating types. Defaults to `/opt/puppetlabs/bin/puppet`.
|
324
|
+
|
325
|
+
```yaml
|
326
|
+
deploy:
|
327
|
+
puppet_path: '/usr/local/bin/puppet'
|
328
|
+
```
|
329
|
+
|
330
|
+
Source options
|
331
|
+
--------------
|
332
|
+
|
333
|
+
The following options are respected by all source implementations. Sources may
|
334
|
+
implement other options in addition to the ones listed below; see the source
|
335
|
+
specific documentation for more information.
|
336
|
+
|
337
|
+
### remote
|
338
|
+
|
339
|
+
The 'remote' setting specifies where the source repository should be fetched
|
340
|
+
from. It may be any valid URL that the source may check out or clone. The remote
|
341
|
+
must be able to be fetched without any interactive input, eg usernames or
|
342
|
+
passwords cannot be prompted for in order to fetch the remote.
|
343
|
+
|
344
|
+
```yaml
|
345
|
+
---
|
346
|
+
sources:
|
347
|
+
mysource:
|
348
|
+
remote: 'git://git-server.site/my-org/main-modules'
|
349
|
+
```
|
350
|
+
|
351
|
+
### basedir
|
352
|
+
|
353
|
+
The 'basedir' setting specifies where environments will be created for this
|
354
|
+
source. This directory will be entirely managed by r10k and any contents that
|
355
|
+
r10k did not put there will be _removed_.
|
356
|
+
|
357
|
+
```yaml
|
358
|
+
---
|
359
|
+
sources:
|
360
|
+
mysource:
|
361
|
+
basedir: '/etc/puppet/environments'
|
362
|
+
```
|
363
|
+
|
364
|
+
If two different sources have the same basedir, it's possible for them to create
|
365
|
+
two separate environments with the same name and file path. If this occurs r10k
|
366
|
+
will treat this as a fatal error and will abort. To avoid this, use prefixing on one
|
367
|
+
or both of the sources to make sure that all environment names are unique. See
|
368
|
+
also the [prefix](#prefix) setting.
|
369
|
+
|
370
|
+
### prefix
|
371
|
+
|
372
|
+
The prefix setting allows environment names to be prefixed with the short name
|
373
|
+
of the given source. This prevents collisions when multiple sources are deployed
|
374
|
+
into the same directory.
|
375
|
+
|
376
|
+
```yaml
|
377
|
+
---
|
378
|
+
sources:
|
379
|
+
mysource:
|
380
|
+
basedir: '/etc/puppet/environments'
|
381
|
+
prefix: true # All environments will be prefixed with "mysource_"
|
382
|
+
```
|
383
|
+
#### prefix behaviour
|
384
|
+
* if `true` environment folder will be prefixed with the name of the source.
|
385
|
+
* if `false` (default) environment folder will not be prefixed
|
386
|
+
* if `String` environment folder will be prefixed with the `prefix` value.
|
387
|
+
|
388
|
+
### ignore_branch_prefixes
|
389
|
+
|
390
|
+
The 'ignore_branch_prefixes' setting causes environments to be ignored which match in part or whole
|
391
|
+
to any of the prefixes listed in the setting.
|
392
|
+
The setting is a list of strings. Each branch in
|
393
|
+
the 'git' repo will have its name tested against all prefixes and, if the prefix
|
394
|
+
is found, then an environment will not be deployed for this branch.
|
395
|
+
If no 'ignore_branch_prefixes' is specified, then all branches in the 'git' repo will
|
396
|
+
be deployed (default behavior).
|
397
|
+
|
398
|
+
#### ignore_branch_prefixes behaviour
|
399
|
+
* if empty, deploy environments for all branches
|
400
|
+
* for each branch in git repo
|
401
|
+
** if `branch.name` has a prefix found in `ignore_branch_prefixes`, then do not deploy an environment for branch
|
402
|
+
|
403
|
+
Example: do not deploy branches with names starting with (or completely named) 'test' or 'dev'.
|
404
|
+
```yaml
|
405
|
+
---
|
406
|
+
sources:
|
407
|
+
mysource:
|
408
|
+
basedir: '/etc/puppet/environments'
|
409
|
+
ignore_branch_prefixes:
|
410
|
+
- 'test'
|
411
|
+
- 'dev'
|
412
|
+
```
|
413
|
+
|
414
|
+
Examples
|
415
|
+
--------
|
416
|
+
|
417
|
+
### Minimal example
|
418
|
+
|
419
|
+
The majority of users will only have a single repository where all modules and
|
420
|
+
hiera data files are kept. In this case you will specify a single source:
|
421
|
+
|
422
|
+
```yaml
|
423
|
+
---
|
424
|
+
sources:
|
425
|
+
operations:
|
426
|
+
remote: 'git://git-server.site/my-org/org-modules'
|
427
|
+
basedir: '/etc/puppet/environments'
|
428
|
+
```
|
429
|
+
|
430
|
+
### Separate hiera data
|
431
|
+
|
432
|
+
For more complex cases where you want to store hiera data in a different
|
433
|
+
repository and your modules in another repository, you can specify two sources:
|
434
|
+
|
435
|
+
```yaml
|
436
|
+
---
|
437
|
+
sources:
|
438
|
+
operations:
|
439
|
+
remote: 'git://git-server.site/my-org/org-modules'
|
440
|
+
basedir: '/etc/puppet/environments'
|
441
|
+
hiera:
|
442
|
+
remote: 'git://git-server.site/my-org/org-hiera-data'
|
443
|
+
basedir: '/etc/puppet/hiera-data'
|
444
|
+
```
|
445
|
+
|
446
|
+
### Multiple tenancy
|
447
|
+
|
448
|
+
Alternately you may want to create separate environments from multiple
|
449
|
+
repositories. This is useful when you want two groups to be able to deploy
|
450
|
+
Puppet modules but they should only have write access to their own modules and
|
451
|
+
not the modules of other groups.
|
452
|
+
|
453
|
+
```yaml
|
454
|
+
---
|
455
|
+
sources:
|
456
|
+
main:
|
457
|
+
remote: 'git://git-server.site/my-org/main-modules'
|
458
|
+
basedir: '/etc/puppet/environments'
|
459
|
+
prefix: false # Prefix defaults to false so this is only here for clarity
|
460
|
+
qa:
|
461
|
+
remote: 'git://git-server.site/my-org/qa-puppet-modules'
|
462
|
+
basedir: '/etc/puppet/environments'
|
463
|
+
prefix: true
|
464
|
+
dev:
|
465
|
+
remote: 'git://git-server.site/my-org/dev-puppet-modules'
|
466
|
+
basedir: '/etc/puppet/environments'
|
467
|
+
prefix: true
|
468
|
+
```
|
469
|
+
|
470
|
+
This will create the following directory structure:
|
471
|
+
|
472
|
+
```
|
473
|
+
/etc/puppet/environments
|
474
|
+
|-- production # main-modules repository, production branch
|
475
|
+
|-- upgrade_apache # main-modules repository, upgrade_apache branch
|
476
|
+
|-- qa_production # qa repository, production branch
|
477
|
+
|-- qa_jenkins_test # qa repository, jenkins_test branch
|
478
|
+
|-- dev_production # dev repository, production branch
|
479
|
+
`-- dev_loadtest # dev repository, loadtest branch
|
480
|
+
```
|
481
|
+
|
482
|
+
#### Multiple tenancy with external hieradata
|
483
|
+
|
484
|
+
If hiera data is in a separate repository from your control repository, you
|
485
|
+
must override the `prefix` so environment folders line up in both directories:
|
486
|
+
|
487
|
+
```yaml
|
488
|
+
---
|
489
|
+
sources:
|
490
|
+
app1_data:
|
491
|
+
remote: 'git://git-server.site/my-org/app1-hieradata'
|
492
|
+
basedir: '/etc/puppet/hieradata'
|
493
|
+
prefix: "app1"
|
494
|
+
app1_modules:
|
495
|
+
remote: 'git://git-server.site/my-org/app1-puppet-modules'
|
496
|
+
basedir: '/etc/puppet/environments'
|
497
|
+
prefix: "app1"
|
498
|
+
```
|
499
|
+
|
500
|
+
|
501
|
+
This will create the following directory structure:
|
502
|
+
|
503
|
+
```
|
504
|
+
/etc/puppet/environments
|
505
|
+
|-- app1_production # app1 modules repository, production branch
|
506
|
+
|-- app1_develop # app1 modules repository, develop branch
|
507
|
+
|
508
|
+
/etc/puppet/hieradata
|
509
|
+
|-- app1_production # app1 data repository, production branch
|
510
|
+
|-- app1_develop # app1 data repository, develop branch
|
511
|
+
```
|
512
|
+
|
513
|
+
Experimental Features
|
514
|
+
---------------------
|
515
|
+
|
516
|
+
### YAML Environment Source
|
517
|
+
|
518
|
+
Dynamically deploying Puppet content based on the state of version control repositories can be powerful and efficient for development workflows. The linkage however is not advantageous when trying to build precision controls over deployment of previously-developed and tested content.
|
519
|
+
|
520
|
+
The YAML environment source type allows for a clear separation of tooling between development workflow, and deployment workflow. Development workflow creates new commits in the version control system. Deployment workflow consumes them.
|
521
|
+
|
522
|
+
To use the YAML environment source, configure r10k's sources with at least one entry using the yaml type.
|
523
|
+
|
524
|
+
```yaml
|
525
|
+
# r10k.yaml
|
526
|
+
---
|
527
|
+
sources:
|
528
|
+
puppet:
|
529
|
+
type: yaml
|
530
|
+
basedir: /etc/puppetlabs/code/environments
|
531
|
+
config: /etc/puppetlabs/r10k/environments.yaml # default
|
532
|
+
```
|
533
|
+
|
534
|
+
When using the YAML source type, every environment is enumerated in a single yaml file. Each environment specifies a type, source, and version (typically a Git ref) to deploy. In the following example, two environments are defined, which are identical to each other.
|
535
|
+
|
536
|
+
```yaml
|
537
|
+
---
|
538
|
+
production:
|
539
|
+
type: git
|
540
|
+
remote: git@github.com:puppetlabs/control-repo.git
|
541
|
+
ref: 8820892
|
542
|
+
|
543
|
+
development:
|
544
|
+
type: git
|
545
|
+
remote: git@github.com:puppetlabs/control-repo.git
|
546
|
+
ref: 8820892
|
547
|
+
```
|
548
|
+
|
549
|
+
### YAMLdir Environment Source
|
550
|
+
|
551
|
+
Like the YAML environment source, but implemented as a conf.d pattern.
|
552
|
+
|
553
|
+
```yaml
|
554
|
+
# r10k.yaml
|
555
|
+
---
|
556
|
+
sources:
|
557
|
+
puppet:
|
558
|
+
type: yamldir
|
559
|
+
basedir: /etc/puppetlabs/code/environments
|
560
|
+
config: /etc/puppetlabs/r10k/environments.d # default
|
561
|
+
```
|
562
|
+
|
563
|
+
Each environment is defined in a yaml file placed in the configuration directory. The filename, without the .yaml extension, will be the name of the environment.
|
564
|
+
|
565
|
+
```
|
566
|
+
/etc/puppetlabs/r10k/environments.d
|
567
|
+
├── production.yaml
|
568
|
+
└── development.yaml
|
569
|
+
```
|
570
|
+
|
571
|
+
The contents of the file should be a hash specifying the enviornment type, and all other applicable environment options.
|
572
|
+
|
573
|
+
```yaml
|
574
|
+
# production.yaml
|
575
|
+
---
|
576
|
+
type: git
|
577
|
+
remote: git@github.com:puppetlabs/control-repo.git
|
578
|
+
ref: 8820892
|
579
|
+
```
|
580
|
+
|
581
|
+
### Exec environment Source
|
582
|
+
|
583
|
+
The exec environment source runs an external command which is expected to return on stdout content compatible with the YAML environment source data format. The command may return the data in JSON or YAML form. The exec environment source is similar in purpose to Puppet's exec node terminus, used to implement external node classifiers (ENCs). R10k's exec source type allows the the implementation of external environment sources.
|
584
|
+
|
585
|
+
```yaml
|
586
|
+
# r10k.yaml
|
587
|
+
---
|
588
|
+
sources:
|
589
|
+
puppet:
|
590
|
+
type: exec
|
591
|
+
basedir: /etc/puppetlabs/code/environments
|
592
|
+
command: /usr/local/bin/r10k-environments.sh
|
593
|
+
```
|
594
|
+
|
595
|
+
### Environment Modules
|
596
|
+
|
597
|
+
The environment modules feature allows module content to be attached to an environment at environment definition time. This happens before modules specified in a Puppetfile are attached to an environment, which does not happen until deploy time. Environment module implementation depends on the environment source type.
|
598
|
+
|
599
|
+
For the YAML environment source type, attach modules to an environment by specifying a modules key for the environment, and providing a hash of modules to attach. Each module accepts the same arguments accepted by the `mod` method in a Puppetfile.
|
600
|
+
|
601
|
+
The example below includes two Forge modules and one module sourced from a Git repository. The two environments are almost identical. However, a new version of the stdlib module has been deployed in development (6.2.0), that has not yet been deployed to production.
|
602
|
+
|
603
|
+
```yaml
|
604
|
+
---
|
605
|
+
production:
|
606
|
+
type: git
|
607
|
+
remote: git@github.com:puppetlabs/control-repo.git
|
608
|
+
ref: 8820892
|
609
|
+
modules:
|
610
|
+
puppetlabs-stdlib: 6.0.0
|
611
|
+
puppetlabs-concat: 6.1.0
|
612
|
+
reidmv-xampl:
|
613
|
+
git: https://github.com/reidmv/reidmv-xampl.git
|
614
|
+
ref: 62d07f2
|
615
|
+
|
616
|
+
development:
|
617
|
+
type: git
|
618
|
+
remote: git@github.com:puppetlabs/control-repo.git
|
619
|
+
ref: 8820892
|
620
|
+
modules:
|
621
|
+
puppetlabs-stdlib: 6.2.0
|
622
|
+
puppetlabs-concat: 6.1.0
|
623
|
+
reidmv-xampl:
|
624
|
+
git: https://github.com/reidmv/reidmv-xampl.git
|
625
|
+
ref: 62d07f2
|
626
|
+
```
|
627
|
+
|
628
|
+
An example of a single environment definition for the YAMLdir environment source type:
|
629
|
+
|
630
|
+
```yaml
|
631
|
+
# production.yaml
|
632
|
+
---
|
633
|
+
type: git
|
634
|
+
remote: git@github.com:puppetlabs/control-repo.git
|
635
|
+
ref: 8820892
|
636
|
+
modules:
|
637
|
+
puppetlabs-stdlib: 6.0.0
|
638
|
+
puppetlabs-concat: 6.1.0
|
639
|
+
reidmv-xampl:
|
640
|
+
git: https://github.com/reidmv/reidmv-xampl.git
|
641
|
+
ref: 62d07f2
|
642
|
+
```
|
643
|
+
|
644
|
+
### Bare Environment Type
|
645
|
+
|
646
|
+
A "control repository" typically contains a hiera.yaml, an environment.conf, a manifests/site.pp file, and a few other things. However, none of these are strictly necessary for an environment to be functional if modules can be deployed to it.
|
647
|
+
|
648
|
+
The bare environment type allows sources that support environment modules to operate without a control repo being required. Modules can be deployed directly.
|
649
|
+
|
650
|
+
```yaml
|
651
|
+
---
|
652
|
+
production:
|
653
|
+
type: bare
|
654
|
+
modules:
|
655
|
+
puppetlabs-stdlib: 6.0.0
|
656
|
+
puppetlabs-concat: 6.1.0
|
657
|
+
reidmv-xampl:
|
658
|
+
git: https://github.com/reidmv/reidmv-xampl.git
|
659
|
+
ref: 62d07f2
|
660
|
+
|
661
|
+
development:
|
662
|
+
type: bare
|
663
|
+
modules:
|
664
|
+
puppetlabs-stdlib: 6.0.0
|
665
|
+
puppetlabs-concat: 6.1.0
|
666
|
+
reidmv-xampl:
|
667
|
+
git: https://github.com/reidmv/reidmv-xampl.git
|
668
|
+
ref: 62d07f2
|
669
|
+
```
|