0

I have setup Puppet Enterprise server on CentOS Linux 7 (Core).

# /opt/puppetlabs/bin/puppetserver --version
puppetserver version: 2016.5.0.11

I have different client-specific projects and they all have multiple environments (QA, Staging, Prod). I will be using my Puppet server for managing all these projects. I know Puppet provides environments for isolating code but i'm not sure how to implement the kind of design i am thinking of. This is what i would like to have:

puppet_root/
    - code/
        - environments
            - prod/
                - project_A
                    - environment.conf
                    - hieradata/
                    - manifests/
                    - modules/
                - project_B
                    - environment.conf
                    - hieradata/
                    - manifests/
                    - modules/
            - staging
                - project_A
                    - environment.conf
                    - hieradata/
                    - manifests/
                    - modules/
                - project_B
                    - environment.conf
                    - hieradata/
                    - manifests/
                    - modules/
            - dev
                ...
                ...
        - modules
    - custom_scripts/

Had there been a single client, i know it would have worked without any issue but with multiple clients inside a sub-dir (as shown above), i'm not sure how Puppet will come to know which path to traverse.

UPDATE:

New model i came up with:

puppet_root/
    - client_A/
        - code/
            - modules/
            - environments/
                - prod/
                    - environment.conf
                    - manifests/
                    - hieradata/
                        - common.yaml
                        ...
                        ...
                - uat/
                    ...
                    ...

    - client_B/
        - code/
            - modules/
            - environments/
                - prod/
                    - environment.conf
                    - manifests/
                    - hieradata/
                        - common.yaml
                        ...
                        ...
                - uat/
                    ...
                    ...
    - custom_scripts/

Any help will be appreciated.

Technext
  • 7,887
  • 9
  • 48
  • 76
  • There is nothing inside an `environment.conf`, `hieradata/`, or `manifests/` that would give added value by being at lower than the environment level (or, in the case of `hieradata/`, at above the module level as well; see this: https://docs.puppet.com/puppet/latest/lookup_quick_module.html). – Matthew Schuchard Jan 04 '17 at 16:04
  • So only `modules` dir is something that should be within any given project's dir? But in my case, since projects are of different clients, is it a better approach to follow what you suggested? Also, I didn't get the second point (keeping `hieradata` at above the module level). – Technext Jan 04 '17 at 16:33
  • I am just stating that in your theoretical design pattern, you would have no added value from placing those three components at a lower level than an environment directory (or higher than a module for the data). There would be some organizational value in having modules there. If you redo your design pattern so only modules are located at the lower level, than the problem becomes simpler for you to solve. – Matthew Schuchard Jan 04 '17 at 17:32
  • 1
    Also, once you do simplify the problem that way, it becomes easier to see that your problem can be solved by making each project a profile in the roles and profiles design pattern: https://docs.puppet.com/pe/2016.5/r_n_p_intro.html. – Matthew Schuchard Jan 04 '17 at 17:36
  • Thanks for the details. I went through the role and profile model. Looks good. I will prefer using that approach but it might take some time for me to be comfortable as i have started learning Puppet recently. I have come up with the new model which i have updated in my post. This new model will contain separate repos for each project. That way, i feel work on any project's code will have better isolation. Any thoughts? – Technext Jan 05 '17 at 12:45
  • Your original idea will cause you fewer problems. – Matthew Schuchard Jan 05 '17 at 12:54

0 Answers0