r10k 3.3.2 → 3.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/pull_request_template.md +1 -0
- data/.github/workflows/docker.yml +56 -0
- data/.github/workflows/release.yml +36 -0
- data/.travis.yml +23 -8
- data/CHANGELOG.mkd +60 -4
- data/CODEOWNERS +1 -0
- data/Gemfile +1 -1
- data/README.mkd +4 -3
- data/azure-pipelines.yml +9 -3
- data/bin/r10k +1 -1
- data/doc/dynamic-environments/configuration.mkd +160 -2
- data/doc/dynamic-environments/git-environments.mkd +1 -1
- data/doc/dynamic-environments/master-configuration.mkd +28 -58
- data/doc/faq.mkd +6 -1
- data/doc/puppetfile.mkd +2 -0
- data/docker/Gemfile +5 -2
- data/docker/Makefile +41 -18
- data/docker/r10k/Dockerfile +36 -15
- data/docker/r10k/adduser.sh +13 -0
- data/docker/r10k/docker-entrypoint.d/10-analytics.sh +1 -1
- data/docker/r10k/release.Dockerfile +54 -0
- data/docker/spec/dockerfile_spec.rb +4 -3
- data/docker/spec/fixtures/Puppetfile +1 -1
- data/integration/Rakefile +2 -2
- data/lib/r10k/action/deploy/environment.rb +7 -3
- data/lib/r10k/action/deploy/module.rb +5 -1
- data/lib/r10k/action/runner.rb +4 -4
- data/lib/r10k/cli/deploy.rb +1 -1
- data/lib/r10k/environment.rb +30 -0
- data/lib/r10k/environment/bare.rb +16 -0
- data/lib/r10k/environment/git.rb +6 -5
- data/lib/r10k/environment/svn.rb +2 -0
- data/lib/r10k/environment/with_modules.rb +139 -0
- data/lib/r10k/logging/terminaloutputter.rb +1 -1
- data/lib/r10k/module/base.rb +5 -0
- data/lib/r10k/module/forge.rb +5 -1
- data/lib/r10k/puppetfile.rb +6 -0
- data/lib/r10k/source.rb +4 -0
- data/lib/r10k/source/exec.rb +51 -0
- data/lib/r10k/source/hash.rb +182 -0
- data/lib/r10k/source/yaml.rb +20 -0
- data/lib/r10k/source/yamldir.rb +32 -0
- data/lib/r10k/util/attempt.rb +1 -1
- data/lib/r10k/version.rb +4 -1
- data/locales/r10k.pot +65 -22
- data/r10k.gemspec +7 -3
- data/spec/unit/action/deploy/environment_spec.rb +1 -0
- data/spec/unit/action/deploy/module_spec.rb +13 -0
- data/spec/unit/action/puppetfile/install_spec.rb +3 -1
- data/spec/unit/action/runner_spec.rb +2 -2
- data/spec/unit/source/exec_spec.rb +81 -0
- data/spec/unit/source/hash_spec.rb +54 -0
- data/spec/unit/source/yaml_spec.rb +42 -0
- metadata +66 -24
- data/MAINTAINERS +0 -18
- data/docker/distelli-manifest.yml +0 -9
- data/integration/scripts/README.mkd +0 -86
- data/integration/scripts/setup_r10k_env_centos5.sh +0 -23
- data/integration/scripts/setup_r10k_env_centos6.sh +0 -23
- data/integration/scripts/setup_r10k_env_rhel7.sh +0 -23
- data/integration/scripts/setup_r10k_env_sles11.sh +0 -23
- data/integration/scripts/setup_r10k_env_sles12.sh +0 -23
- data/integration/scripts/setup_r10k_env_ubuntu1004.sh +0 -23
- data/integration/scripts/setup_r10k_env_ubuntu1204.sh +0 -23
- data/integration/scripts/setup_r10k_env_ubuntu1404.sh +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2f2418e73622a4149507cc7e2dde74b68a448689da2a7287b19107fbef0e184e
|
4
|
+
data.tar.gz: 95acaeb5cb7ad0969ec3f2a3545ab82490bafb9d0fca5da444125bbe780b9836
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd666a18fe5df938ab5a151cf411ac335e0f3f151428fe8589010ff699b832609fc58e189c46f52894d9d6b9d8e63156ed928bd14d2ed02d5d9a113fc0c5feb0
|
7
|
+
data.tar.gz: 40307661c96a21d00595271fa21836175c993dc937504b82b449218e39cd3804000a7c24c32a52aa570098b450fd35417573190dd9d603ac087e217f391aacb4
|
@@ -0,0 +1 @@
|
|
1
|
+
Please add all notable changes to the "Unreleased" section of the CHANGELOG.
|
@@ -0,0 +1,56 @@
|
|
1
|
+
name: Docker test and publish
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
build-and-publish:
|
10
|
+
env:
|
11
|
+
PUPPERWARE_ANALYTICS_STREAM: production
|
12
|
+
IS_LATEST: true
|
13
|
+
# Still need these env vars for README publishing
|
14
|
+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
15
|
+
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
|
16
|
+
|
17
|
+
runs-on: ubuntu-latest
|
18
|
+
|
19
|
+
steps:
|
20
|
+
- uses: actions/checkout@master
|
21
|
+
- uses: azure/docker-login@v1
|
22
|
+
with: # This doesn't seem to work unless we point directly to the secrets
|
23
|
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
24
|
+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
25
|
+
- name: Set up Ruby 2.6
|
26
|
+
uses: actions/setup-ruby@v1
|
27
|
+
with:
|
28
|
+
ruby-version: 2.6.x
|
29
|
+
- run: gem install bundler
|
30
|
+
- name: Build container
|
31
|
+
working-directory: docker
|
32
|
+
run: make lint build test
|
33
|
+
- name: Publish container
|
34
|
+
working-directory: docker
|
35
|
+
run: |
|
36
|
+
make publish
|
37
|
+
- name: Build release container
|
38
|
+
env:
|
39
|
+
IS_RELEASE: true
|
40
|
+
working-directory: docker
|
41
|
+
run: |
|
42
|
+
if make prep; then
|
43
|
+
make lint build test
|
44
|
+
else
|
45
|
+
echo "Skipping release container building and testing"
|
46
|
+
fi
|
47
|
+
- name: Publish release container
|
48
|
+
env:
|
49
|
+
IS_RELEASE: true
|
50
|
+
working-directory: docker
|
51
|
+
run: |
|
52
|
+
if make prep; then
|
53
|
+
make publish
|
54
|
+
else
|
55
|
+
echo "Skipping release container publishing"
|
56
|
+
fi
|
@@ -0,0 +1,36 @@
|
|
1
|
+
name: Tag and release
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
paths:
|
8
|
+
- 'lib/r10k/version.rb'
|
9
|
+
|
10
|
+
jobs:
|
11
|
+
release:
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v2
|
15
|
+
with:
|
16
|
+
fetch-depth: '0'
|
17
|
+
- name: Bump version and push tag
|
18
|
+
uses: anothrNick/github-tag-action@1.17.2
|
19
|
+
env:
|
20
|
+
GITHUB_TOKEN: ${{ secrets.PUPPET_RELEASE_GH_TOKEN }}
|
21
|
+
DEFAULT_BUMP: patch
|
22
|
+
WITH_V: false
|
23
|
+
# Uncomment this if the tag and version file become out-of-sync and
|
24
|
+
# you need to tag at a specific version.
|
25
|
+
# CUSTOM_TAG:
|
26
|
+
- name: Build gem
|
27
|
+
uses: scarhand/actions-ruby@master
|
28
|
+
with:
|
29
|
+
args: build *.gemspec
|
30
|
+
- name: Publish gem
|
31
|
+
uses: scarhand/actions-ruby@master
|
32
|
+
env:
|
33
|
+
RUBYGEMS_AUTH_TOKEN: ${{ secrets.RUBYGEMS_AUTH_TOKEN }}
|
34
|
+
with:
|
35
|
+
args: push *.gem
|
36
|
+
|
data/.travis.yml
CHANGED
@@ -1,17 +1,19 @@
|
|
1
1
|
---
|
2
2
|
language: ruby
|
3
|
-
services:
|
4
|
-
- docker
|
5
3
|
bundler_args: "--without system"
|
6
4
|
script: "bundle exec rspec --color --format documentation spec/unit"
|
7
5
|
notifications:
|
8
6
|
email: false
|
9
7
|
sudo: false
|
10
8
|
jdk:
|
11
|
-
-
|
9
|
+
- openjdk11
|
12
10
|
before_install: gem install bundler -v '< 2' --no-document
|
13
11
|
matrix:
|
14
12
|
include:
|
13
|
+
- stage: r10k tests
|
14
|
+
rvm: 2.7.0
|
15
|
+
- stage: r10k tests
|
16
|
+
rvm: 2.6.5
|
15
17
|
- stage: r10k tests
|
16
18
|
rvm: 2.5.0
|
17
19
|
- stage: r10k tests
|
@@ -21,10 +23,23 @@ matrix:
|
|
21
23
|
- stage: r10k tests
|
22
24
|
rvm: jruby
|
23
25
|
- stage: r10k container tests
|
26
|
+
dist: focal
|
24
27
|
language: ruby
|
25
|
-
|
28
|
+
services:
|
29
|
+
- docker
|
30
|
+
rvm: 2.6.6
|
31
|
+
env:
|
32
|
+
- DOCKER_COMPOSE_VERSION=1.25.5
|
33
|
+
# necessary to prevent overwhelming TravisCI build output limits
|
34
|
+
- DOCKER_BUILD_FLAGS="--progress plain"
|
35
|
+
before_install:
|
36
|
+
- sudo rm /usr/local/bin/docker-compose
|
37
|
+
- curl --location https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname --kernel-name`-`uname --machine` > docker-compose
|
38
|
+
- chmod +x docker-compose
|
39
|
+
- sudo mv docker-compose /usr/local/bin
|
26
40
|
script:
|
27
|
-
-
|
28
|
-
|
29
|
-
|
30
|
-
|
41
|
+
- set -e
|
42
|
+
- cd docker
|
43
|
+
- make lint
|
44
|
+
- make build
|
45
|
+
- make test
|
data/CHANGELOG.mkd
CHANGED
@@ -1,6 +1,46 @@
|
|
1
1
|
CHANGELOG
|
2
2
|
=========
|
3
3
|
|
4
|
+
Unreleased
|
5
|
+
----
|
6
|
+
|
7
|
+
3.5.1
|
8
|
+
-----
|
9
|
+
|
10
|
+
- Upgrade Rugged Gemfile dependency for local development to ~> 1.0
|
11
|
+
|
12
|
+
|
13
|
+
3.5.0
|
14
|
+
-----
|
15
|
+
|
16
|
+
- Add exec environment source type. The exec source type allows for the
|
17
|
+
implementation of external environment sources
|
18
|
+
[#1042](https://github.com/puppetlabs/r10k/pull/1042).
|
19
|
+
- Improve atomicity of .r10k-deploy.json writes. Fixes
|
20
|
+
[#813](https://github.com/puppetlabs/r10k/issues/813)
|
21
|
+
|
22
|
+
3.4.1
|
23
|
+
-----
|
24
|
+
|
25
|
+
- Add support for Ruby 2.7
|
26
|
+
- (RK-357) Restrict gettext and fast_gettext versions for compatibility with Ruby 2.4
|
27
|
+
- Bump cri to 2.15.10
|
28
|
+
- (RK-360) Allow overriding the cachedir in `deploy module`
|
29
|
+
- Bump puppet_forge to 2.3.0
|
30
|
+
|
31
|
+
3.4.0
|
32
|
+
-----
|
33
|
+
|
34
|
+
- Switch to supported `colored2` gem
|
35
|
+
- Add YAML environment source types [#983](https://github.com/puppetlabs/r10k/pull/983), [#1002](https://github.com/puppetlabs/r10k/pull/1002). YAML source types use configuration files to define environments, rather than VCS branches, and support deploying modules to an environment without modifying a control-repo. YAML environment source types are experimental in this release
|
36
|
+
|
37
|
+
3.3.3
|
38
|
+
-----
|
39
|
+
|
40
|
+
### Changes
|
41
|
+
|
42
|
+
- Update minitar version to 0.9, to match the version installed with puppet-agent
|
43
|
+
|
4
44
|
3.3.2
|
5
45
|
-----
|
6
46
|
|
@@ -131,6 +171,22 @@ Ruby >= 2.3 official and documented.
|
|
131
171
|
- Unable to parse Puppetfile
|
132
172
|
- Various perfomance improvements
|
133
173
|
|
174
|
+
2.6.8
|
175
|
+
----
|
176
|
+
|
177
|
+
### Changes
|
178
|
+
|
179
|
+
(RK-357) Restrict gettext and fast_gettext versions for compatibility with Ruby 2.4.
|
180
|
+
(RK-358) Update puppet_forge to ~> 2.3.0.
|
181
|
+
|
182
|
+
2.6.7
|
183
|
+
----
|
184
|
+
|
185
|
+
### Changes
|
186
|
+
|
187
|
+
(CDPE-1813) Add module deploy info to .r10k-deploy.json.
|
188
|
+
(RK-351) Update minitar to ~> 0.9.0.
|
189
|
+
|
134
190
|
2.6.6
|
135
191
|
----
|
136
192
|
|
@@ -343,7 +399,7 @@ Puppetfile should be installed to. See the [Puppetfile documentation](https://gi
|
|
343
399
|
|
344
400
|
You can now configure how r10k purges unmanaged content after a deployment. The
|
345
401
|
default behavior should be unchanged but there is a new "purge\_levels" configuration
|
346
|
-
option that can be used to enable new behavior or de-activate certain existing
|
402
|
+
option that can be used to enable new behavior or de-activate certain existing
|
347
403
|
behaviors. See the relevant [configuration documentation](https://github.com/puppetlabs/r10k/blob/master/doc/dynamic-environments/configuration.mkd#purge_levels) for more details.
|
348
404
|
|
349
405
|
(RK-223) Ability to track control repo branch from content declarations.
|
@@ -390,7 +446,7 @@ fix.)
|
|
390
446
|
Previously, r10k only supported the use of HTTP proxies for connecting to the Puppet
|
391
447
|
Forge. With these changes, r10k can now be configured to use an HTTP proxy for both
|
392
448
|
Forge and Git operations. Configuration can be specified globally, for Forge or Git
|
393
|
-
only, or on a per-Git repository basis. See [configuration documentation](https://github.com/puppetlabs/r10k/blob/master/doc/dynamic-environments/configuration.mkd)
|
449
|
+
only, or on a per-Git repository basis. See [configuration documentation](https://github.com/puppetlabs/r10k/blob/master/doc/dynamic-environments/configuration.mkd)
|
394
450
|
for more details.
|
395
451
|
|
396
452
|
### Bug Fixes
|
@@ -411,9 +467,9 @@ for SSH.
|
|
411
467
|
(RK-241) "deploy display" action does not properly format wrapped exceptions
|
412
468
|
|
413
469
|
The "deploy display" action was not capturing and logging exceptions in the same way as
|
414
|
-
other related actions. This meant that in many cases, when an error occurred, the
|
470
|
+
other related actions. This meant that in many cases, when an error occurred, the
|
415
471
|
underlying cause was not being shown. Specifically, the "deploy display" action was
|
416
|
-
not benefitting from the improved error messaging for unreadable SSH keys which was
|
472
|
+
not benefitting from the improved error messaging for unreadable SSH keys which was
|
417
473
|
added in r10k 2.2.0 as part of RK-220.
|
418
474
|
|
419
475
|
2.2.1
|
data/CODEOWNERS
CHANGED
data/Gemfile
CHANGED
data/README.mkd
CHANGED
@@ -8,16 +8,17 @@ Puppet environment and module deployment
|
|
8
8
|
Description
|
9
9
|
-----------
|
10
10
|
|
11
|
-
[workflow]:
|
11
|
+
[workflow]: https://puppet.com/docs/puppet/latest/environments_about.html
|
12
12
|
|
13
13
|
R10k provides a general purpose toolset for deploying Puppet environments and
|
14
14
|
modules. It implements the [Puppetfile](doc/puppetfile.mkd) format and provides a native
|
15
|
-
implementation of Puppet [
|
15
|
+
implementation of Puppet [environments][workflow].
|
16
16
|
|
17
17
|
Requirements
|
18
18
|
------------
|
19
19
|
|
20
|
-
R10k supports the Ruby versions `>= 2.3.0`.
|
20
|
+
R10k supports the Ruby versions `>= 2.3.0`. It's tested on Ruby 2.3.0 up to
|
21
|
+
Ruby 2.6.0 + Jruby.
|
21
22
|
|
22
23
|
R10k requires additional components, depending on how you plan on managing
|
23
24
|
environments and modules.
|
data/azure-pipelines.yml
CHANGED
@@ -17,7 +17,8 @@ variables:
|
|
17
17
|
NAMESPACE: puppet
|
18
18
|
CONTAINER_NAME: r10k
|
19
19
|
CONTAINER_BUILD_PATH: .
|
20
|
-
LINT_IGNORES:
|
20
|
+
LINT_IGNORES:
|
21
|
+
DOCKER_BUILDKIT: 1
|
21
22
|
|
22
23
|
workspace:
|
23
24
|
clean: resources
|
@@ -31,26 +32,30 @@ steps:
|
|
31
32
|
$gempath = Join-Path -Path (Get-Location) -ChildPath 'docker/.bundle/gems'
|
32
33
|
bundle config --local gemfile $gemfile
|
33
34
|
bundle config --local path $gempath
|
34
|
-
bundle install
|
35
|
+
bundle install --with test
|
35
36
|
displayName: Fetch Dependencies
|
37
|
+
timeoutInMinutes: 1
|
36
38
|
name: fetch_deps
|
37
39
|
|
38
40
|
- powershell: |
|
39
41
|
. "$(bundle show pupperware)/ci/build.ps1"
|
40
42
|
Write-HostDiagnostics
|
41
43
|
displayName: Diagnostic Host Information
|
44
|
+
timeoutInMinutes: 2
|
42
45
|
name: hostinfo
|
43
46
|
|
44
47
|
- powershell: |
|
45
48
|
. "$(bundle show pupperware)/ci/build.ps1"
|
46
49
|
Lint-Dockerfile -Name $ENV:CONTAINER_NAME -Ignore ($ENV:LINT_IGNORES -split ' ')
|
47
50
|
displayName: Lint $(CONTAINER_NAME) Dockerfile
|
51
|
+
timeoutInMinutes: 1
|
48
52
|
name: lint_dockerfile
|
49
53
|
|
50
54
|
- powershell: |
|
51
55
|
. "$(bundle show pupperware)/ci/build.ps1"
|
52
56
|
Build-Container -Name $ENV:CONTAINER_NAME -Namespace $ENV:NAMESPACE -PathOrUri $ENV:CONTAINER_BUILD_PATH
|
53
57
|
displayName: Build $(CONTAINER_NAME) Container
|
58
|
+
timeoutInMinutes: 5
|
54
59
|
name: build_container
|
55
60
|
|
56
61
|
- powershell: |
|
@@ -63,6 +68,7 @@ steps:
|
|
63
68
|
. "$(bundle show pupperware)/ci/build.ps1"
|
64
69
|
Invoke-ContainerTest -Name $ENV:CONTAINER_NAME -Namespace $ENV:NAMESPACE
|
65
70
|
displayName: Test $(CONTAINER_NAME)
|
71
|
+
timeoutInMinutes: 5
|
66
72
|
name: test_container
|
67
73
|
|
68
74
|
- task: PublishTestResults@2
|
@@ -76,5 +82,5 @@ steps:
|
|
76
82
|
. "$(bundle show pupperware)/ci/build.ps1"
|
77
83
|
Clear-BuildState -Name $ENV:CONTAINER_NAME -Namespace $ENV:NAMESPACE
|
78
84
|
displayName: Container Cleanup
|
79
|
-
timeoutInMinutes:
|
85
|
+
timeoutInMinutes: 4
|
80
86
|
condition: always()
|
data/bin/r10k
CHANGED
@@ -48,7 +48,7 @@ cachedir: '/var/cache/r10k'
|
|
48
48
|
|
49
49
|
|
50
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`](
|
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
52
|
setting and will set the cachedir default to `/root/.r10k`.
|
53
53
|
|
54
54
|
### proxy
|
@@ -263,7 +263,7 @@ After Puppetfile content for a given environment is deployed, r10k will
|
|
263
263
|
recursively remove any content found in a directory managed by the Puppetfile
|
264
264
|
which is not also declared in that Puppetfile. Directories considered to be
|
265
265
|
managed by a Puppetfile include the configured `moduledir` (which defaults to
|
266
|
-
"modules") as well as alternate directories specified as an `
|
266
|
+
"modules") as well as alternate directories specified as an `install_path`
|
267
267
|
option to any Puppetfile content declarations.
|
268
268
|
|
269
269
|
#### purge\_whitelist
|
@@ -509,3 +509,161 @@ This will create the following directory structure:
|
|
509
509
|
|-- app1_production # app1 data repository, production branch
|
510
510
|
|-- app1_develop # app1 data repository, develop branch
|
511
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
|
+
```
|