Browse Source

Reorganize hieradata to match ansible variables

We are already organizing our hiera content basically the same way as
ansible needs for variables to be provided. If we reorganize the
directories slightly (to be coordinated with dirs on puppetmaster)
then we can have a single directory do double-duty.

Change-Id: I6ac90a7439ed8a5d9433d9526f37e44668b360ff
Monty Taylor 8 months ago
parent
commit
24eb60b34d
No account linked to committer's email address
3 changed files with 16 additions and 13 deletions
  1. 3
    3
      library/puppet_get_hiera_file_list
  2. 2
    2
      tasks/main.yml
  3. 11
    8
      templates/hiera.yaml.j2

+ 3
- 3
library/puppet_get_hiera_file_list View File

@@ -51,9 +51,9 @@ def main():
51 51
     )
52 52
     p = module.params
53 53
 
54
-    paths = ['group/%s.yaml' % f for f in p['groups'] ]
55
-    paths.append('common.yaml')
56
-    paths.append('fqdn/%s.yaml' % p['fqdn'])
54
+    paths = ['group_vars/%s.yaml' % f for f in p['groups'] ]
55
+    paths.append('group_vars/all.yaml')
56
+    paths.append('host_vars/%s.yaml' % p['fqdn'])
57 57
 
58 58
     good_paths = []
59 59
     for path in paths:

+ 2
- 2
tasks/main.yml View File

@@ -44,8 +44,8 @@
44 44
       group: root
45 45
       mode: 0700
46 46
     with_items:
47
-    - fqdn
48
-    - group
47
+      - group_vars
48
+      - host_vars
49 49
 
50 50
   - name: make file list
51 51
     puppet_get_hiera_file_list:

+ 11
- 8
templates/hiera.yaml.j2 View File

@@ -1,15 +1,18 @@
1 1
 ---
2 2
 :hierarchy:
3
-  # Use private hieradata first
3
+  # Use private hieradata first. Align naming with ansible so that the private
4
+  # data can exist in a single copy for both ansible and puppet
4 5
   # Puppet3 paths
5
-  - "hieradata/%{::environment}/fqdn/%{::fqdn}"
6
-  - "hieradata/%{::environment}/group/%{group}" # no :: because group is set at nodescope
7
-  - "hieradata/%{::environment}/common"
6
+  - "hieradata/%{::environment}/host_vars/%{::fqdn}"
7
+  - "hieradata/%{::environment}/group_vars/%{group}" # no :: because group is set at nodescope
8
+  - "hieradata/%{::environment}/group_vars/all"
8 9
   # Puppet4 paths
9
-  - "%{::environment}/hieradata/fqdn/%{::fqdn}"
10
-  - "%{::environment}/hieradata/group/%{group}" # no :: because group is set at nodescope
11
-  - "%{::environment}/hieradata/common"
12
-  # Use public hieradata second, also be environmentally aware
10
+  - "%{::environment}/hieradata/host_vars/%{::fqdn}"
11
+  - "%{::environment}/hieradata/group_vars/%{group}" # no :: because group is set at nodescope
12
+  - "%{::environment}/hieradata/group_vars/all"
13
+  # Use public hieradata second, also be environmentally aware. Keep this
14
+  # in the old structure so that we don't have to do a dance. There isn't much
15
+  # here, and it can be transferred piecemeal.
13 16
   - "%{::environment}/hiera/fqdn/%{::fqdn}"
14 17
   - "%{::environment}/hiera/group/%{group}" # no :: because group is set at nodescope
15 18
   - "%{::environment}/hiera/common"

Loading…
Cancel
Save