summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2018-08-02 09:16:22 -0500
committerMonty Taylor <mordred@inaugust.com>2018-08-02 13:11:29 -0500
commit24eb60b34df542d58aaab8bcb5b2bcbfd8964bcc (patch)
tree3beaf7636e3a3591d6a880edf94a21e034cc6766
parentf0cd27f06080172100665ec5831e7d9b9a3364de (diff)
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
Notes
Notes (review): Code-Review+2: Clark Boylan <cboylan@sapwetik.org> Code-Review+2: Jeremy Stanley <fungi@yuggoth.org> Code-Review+2: James E. Blair <corvus@inaugust.com> Workflow+1: Monty Taylor <mordred@inaugust.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Thu, 02 Aug 2018 19:24:47 +0000 Reviewed-on: https://review.openstack.org/588290 Project: openstack-infra/ansible-role-puppet Branch: refs/heads/master
-rw-r--r--library/puppet_get_hiera_file_list6
-rw-r--r--tasks/main.yml4
-rw-r--r--templates/hiera.yaml.j219
3 files changed, 16 insertions, 13 deletions
diff --git a/library/puppet_get_hiera_file_list b/library/puppet_get_hiera_file_list
index 79dbe54..c30ce91 100644
--- a/library/puppet_get_hiera_file_list
+++ b/library/puppet_get_hiera_file_list
@@ -51,9 +51,9 @@ def main():
51 ) 51 )
52 p = module.params 52 p = module.params
53 53
54 paths = ['group/%s.yaml' % f for f in p['groups'] ] 54 paths = ['group_vars/%s.yaml' % f for f in p['groups'] ]
55 paths.append('common.yaml') 55 paths.append('group_vars/all.yaml')
56 paths.append('fqdn/%s.yaml' % p['fqdn']) 56 paths.append('host_vars/%s.yaml' % p['fqdn'])
57 57
58 good_paths = [] 58 good_paths = []
59 for path in paths: 59 for path in paths:
diff --git a/tasks/main.yml b/tasks/main.yml
index 699013c..2c82b5d 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -44,8 +44,8 @@
44 group: root 44 group: root
45 mode: 0700 45 mode: 0700
46 with_items: 46 with_items:
47 - fqdn 47 - group_vars
48 - group 48 - host_vars
49 49
50 - name: make file list 50 - name: make file list
51 puppet_get_hiera_file_list: 51 puppet_get_hiera_file_list:
diff --git a/templates/hiera.yaml.j2 b/templates/hiera.yaml.j2
index 23395a2..496fb5a 100644
--- a/templates/hiera.yaml.j2
+++ b/templates/hiera.yaml.j2
@@ -1,15 +1,18 @@
1--- 1---
2:hierarchy: 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 # Puppet3 paths 5 # Puppet3 paths
5 - "hieradata/%{::environment}/fqdn/%{::fqdn}" 6 - "hieradata/%{::environment}/host_vars/%{::fqdn}"
6 - "hieradata/%{::environment}/group/%{group}" # no :: because group is set at nodescope 7 - "hieradata/%{::environment}/group_vars/%{group}" # no :: because group is set at nodescope
7 - "hieradata/%{::environment}/common" 8 - "hieradata/%{::environment}/group_vars/all"
8 # Puppet4 paths 9 # Puppet4 paths
9 - "%{::environment}/hieradata/fqdn/%{::fqdn}" 10 - "%{::environment}/hieradata/host_vars/%{::fqdn}"
10 - "%{::environment}/hieradata/group/%{group}" # no :: because group is set at nodescope 11 - "%{::environment}/hieradata/group_vars/%{group}" # no :: because group is set at nodescope
11 - "%{::environment}/hieradata/common" 12 - "%{::environment}/hieradata/group_vars/all"
12 # Use public hieradata second, also be environmentally aware 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 - "%{::environment}/hiera/fqdn/%{::fqdn}" 16 - "%{::environment}/hiera/fqdn/%{::fqdn}"
14 - "%{::environment}/hiera/group/%{group}" # no :: because group is set at nodescope 17 - "%{::environment}/hiera/group/%{group}" # no :: because group is set at nodescope
15 - "%{::environment}/hiera/common" 18 - "%{::environment}/hiera/common"