Skip to content

Instantly share code, notes, and snippets.

@glarizza
Created August 15, 2013 21:38
Show Gist options
  • Save glarizza/5a81e45f2f489d87d464 to your computer and use it in GitHub Desktop.
Save glarizza/5a81e45f2f489d87d464 to your computer and use it in GitHub Desktop.
========/etc/r10k.yaml==========
:sources:
puppet:
remote: "http://github.com/glarizza/puppet_repository.git"
basedir: /etc/puppetlabs/puppet/environments
hiera:
remote: "https://github.com/glarizza/hiera_environment.git"
basedir: /etc/puppetlabs/puppet/hieradata
:purgedirs:
- /etc/puppetlabs/puppet/environments
- /etc/puppetlabs/puppet/hieradata
=======Deploying=============
[root@master puppet]# r10k deploy environment -v 2
[R10K::Git::Cache - DEBUG1] Execute: "git branch, args: {:git_dir=>\"/var/cache/r10k/https---github.com-glarizza-hiera_environment.git\"}"
[R10K::Git::Cache - DEBUG1] Execute: "git branch, args: {:git_dir=>\"/var/cache/r10k/http---github.com-glarizza-puppet_repository.git\"}"
[R10K::Task::Deployment::DeployEnvironments - INFO] Loading environments from all sources
[R10K::Git::Cache - DEBUG1] Execute: "git fetch --prune, args: {:git_dir=>\"/var/cache/r10k/https---github.com-glarizza-hiera_environment.git\"}"
[R10K::Git::Cache - DEBUG1] Execute: "git branch, args: {:git_dir=>\"/var/cache/r10k/https---github.com-glarizza-hiera_environment.git\"}"
[R10K::Git::Cache - DEBUG1] Execute: "git fetch --prune, args: {:git_dir=>\"/var/cache/r10k/http---github.com-glarizza-puppet_repository.git\"}"
[R10K::Git::Cache - DEBUG1] Execute: "git branch, args: {:git_dir=>\"/var/cache/r10k/http---github.com-glarizza-puppet_repository.git\"}"
[R10K::Task::Environment::Deploy - NOTICE] Deploying environment master
[R10K::Git::WorkingDir - DEBUG1] Execute: "git remote -v, args: {:path=>\"/etc/puppetlabs/puppet/environments/master\"}"
[R10K::Git::WorkingDir - DEBUG1] Git repo /etc/puppetlabs/puppet/environments/master cache remote already set correctly
[R10K::Git::WorkingDir - DEBUG1] Execute: "git fetch --prune cache, args: {:path=>\"/etc/puppetlabs/puppet/environments/master\"}"
[R10K::Git::Cache - DEBUG1] Execute: "git rev-parse master^{commit}, args: {:git_dir=>\"/var/cache/r10k/http---github.com-glarizza-puppet_repository.git\"}"
[R10K::Git::WorkingDir - DEBUG1] Execute: "git rev-parse HEAD^{commit}, args: {:path=>\"/etc/puppetlabs/puppet/environments/master\"}"
[R10K::Git::WorkingDir - DEBUG1] Git repo /etc/puppetlabs/puppet/environments/master is already at a632b58f1b6c19b456de0715d25100209adf16a2, no need to reset
[R10K::Task::Environment::Deploy - NOTICE] Deploying environment development
[R10K::Git::WorkingDir - DEBUG1] Execute: "git remote -v, args: {:path=>\"/etc/puppetlabs/puppet/environments/development\"}"
[R10K::Git::WorkingDir - DEBUG1] Git repo /etc/puppetlabs/puppet/environments/development cache remote already set correctly
[R10K::Git::WorkingDir - DEBUG1] Execute: "git fetch --prune cache, args: {:path=>\"/etc/puppetlabs/puppet/environments/development\"}"
[R10K::Git::Cache - DEBUG1] Execute: "git rev-parse development^{commit}, args: {:git_dir=>\"/var/cache/r10k/http---github.com-glarizza-puppet_repository.git\"}"
[R10K::Git::WorkingDir - DEBUG1] Execute: "git rev-parse HEAD^{commit}, args: {:path=>\"/etc/puppetlabs/puppet/environments/development\"}"
[R10K::Git::WorkingDir - DEBUG1] Git repo /etc/puppetlabs/puppet/environments/development is already at 2dd2464af2bec4fdc6a844234a3841a8947002b7, no need to reset
[R10K::Task::Deployment::PurgeEnvironments - DEBUG] No stale environments in /etc/puppetlabs/puppet/hieradata
[R10K::Task::Deployment::PurgeEnvironments - DEBUG] No stale environments in /etc/puppetlabs/puppet/environments
=========List Directory==========
[root@master puppet]# ls -la /etc/puppetlabs/puppet
total 52
drwxr-xr-x 7 root root 4096 Aug 15 21:37 .
drwxr-xr-x 12 root root 4096 Aug 15 16:03 ..
-rw-r--r-- 1 root root 619 Aug 15 16:02 auth.conf
drwxr-xr-x 4 root root 4096 Aug 15 21:29 environments
drwxr-xr-x 2 root pe-puppet 4096 Jun 21 17:10 files
-rw-r--r-- 1 root pe-puppet 384 Jun 21 17:08 fileserver.conf
-rw-r--r-- 1 root root 314 Jun 11 22:21 hiera.yaml
drwxr-xr-x 2 root pe-puppet 4096 Aug 15 16:01 manifests
drwxr-xr-x 5 root pe-puppet 4096 Aug 15 21:18 modules
-rw------- 1 pe-puppet pe-puppet 965 Aug 15 16:04 puppet.conf
-rw-r--r-- 1 root root 36 Aug 15 16:04 puppetdb.conf
-rw-r--r-- 1 pe-puppet pe-puppet 133 Aug 15 16:04 routes.yaml
drwxrwx--x 8 pe-puppet root 4096 Aug 15 16:01 ssl
@glarizza
Copy link
Author

It worked after awhile....as it turned out, I had only one branch in my hiera_repository.git but I had two branches in my puppet_repository.git. The Hiera repo had a branch called 'master' - so did Puppet. I'm thinking it got confused with branch names? It worked sometimes, and sometimes it didn't. The second I added a unique branch name to the Hiera repository, everything worked smashingly. I'm wondering if there are issues with handling multiple sources and the uniqueness of the environment/branch name among them? Will be something to chase down...

@glarizza
Copy link
Author

Sure enough, check this out:

[root@master puppet]# rm -Rf hiera
[root@master puppet]# r10k deploy environment
ls -la
[root@master puppet]# ls -la
total 56
drwxr-xr-x  8 root      root      4096 Aug 15 21:49 .
drwxr-xr-x 12 root      root      4096 Aug 15 16:03 ..
-rw-r--r--  1 root      root       619 Aug 15 16:02 auth.conf
drwxr-xr-x  4 root      root      4096 Aug 15 21:29 environments
drwxr-xr-x  2 root      pe-puppet 4096 Jun 21 17:10 files
-rw-r--r--  1 root      pe-puppet  384 Jun 21 17:08 fileserver.conf
drwxr-xr-x  3 root      root      4096 Aug 15 21:49 hiera
-rw-r--r--  1 root      root       314 Jun 11 22:21 hiera.yaml
drwxr-xr-x  2 root      pe-puppet 4096 Aug 15 16:01 manifests
drwxr-xr-x  5 root      pe-puppet 4096 Aug 15 21:18 modules
-rw-------  1 pe-puppet pe-puppet  965 Aug 15 16:04 puppet.conf
-rw-r--r--  1 root      root        36 Aug 15 16:04 puppetdb.conf
-rw-r--r--  1 pe-puppet pe-puppet  133 Aug 15 16:04 routes.yaml
drwxrwx--x  8 pe-puppet root      4096 Aug 15 16:01 ssl
[root@master puppet]# tree hiera
hiera
└── testing
    ├── hieradata
    │   ├── development.yaml
    │   ├── gary.puppetlabs.vm.yaml
    │   ├── global.yaml
    │   ├── production.yaml
    │   └── testing.yaml
    └── hiera.yaml
[root@master puppet]# r10k deploy environment
[root@master puppet]# tree hiera
hiera
├── master
│   ├── hieradata
│   │   ├── development.yaml
│   │   ├── gary.puppetlabs.vm.yaml
│   │   ├── global.yaml
│   │   └── production.yaml
│   └── hiera.yaml
└── testing
    ├── hieradata
    │   ├── development.yaml
    │   ├── gary.puppetlabs.vm.yaml
    │   ├── global.yaml
    │   ├── production.yaml
    │   └── testing.yaml
    └── hiera.yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment