|
14 | 14 | Peadm::SingleTargetSpec $compiler_host,
|
15 | 15 | Peadm::SingleTargetSpec $primary_host,
|
16 | 16 | Peadm::SingleTargetSpec $primary_postgresql_host,
|
17 |
| -){ |
| 17 | +) { |
18 | 18 | $compiler_target = peadm::get_targets($compiler_host, 1)
|
19 | 19 | $primary_target = peadm::get_targets($primary_host, 1)
|
20 | 20 | $primary_postgresql_target = peadm::get_targets($primary_postgresql_host, 1)
|
21 | 21 |
|
| 22 | + # Get current peadm config to determine where to setup additional rules for |
| 23 | + # compiler's secondary PuppetDB instances |
| 24 | + $peadm_config = run_task('peadm::get_peadm_config', $primary_target).first.value |
| 25 | + |
| 26 | + # Return the opposite server than the compiler to be added so it can be |
| 27 | + # configured with the appropriate rules for Puppet Server access from |
| 28 | + # compiler |
| 29 | + $replica_avail_group_letter = $avail_group_letter ? { 'A' => 'B', 'B' => 'A' } |
| 30 | + $replica_puppetdb = $peadm_config['role-letter']['server'][$replica_avail_group_letter] |
| 31 | + |
| 32 | + $replica_puppetdb_target = peadm::get_targets($replica_puppetdb, 1) |
| 33 | + |
22 | 34 | # Stop puppet.service
|
23 |
| - run_command('systemctl stop puppet.service', $primary_postgresql_target) |
| 35 | + run_command('systemctl stop puppet.service', peadm::flatten_compact([ |
| 36 | + $primary_postgresql_target, |
| 37 | + $replica_puppetdb_target |
| 38 | + ])) |
| 39 | + |
| 40 | + apply($replica_puppetdb_target) { |
| 41 | + file_line { 'pe-puppetdb-compiler-cert-allow': |
| 42 | + path => '/etc/puppetlabs/puppetdb/certificate-allowlist', |
| 43 | + line => $compiler_target.peadm::certname(), |
| 44 | + } |
| 45 | + } |
24 | 46 |
|
25 | 47 | # Add the following two lines to /opt/puppetlabs/server/data/postgresql/11/data/pg_ident.conf
|
26 | 48 | #
|
|
85 | 107 | },
|
86 | 108 | )
|
87 | 109 |
|
| 110 | + # Source the global hiera.yaml from Primary and synchronize to new compiler |
| 111 | + run_plan('peadm::util::sync_global_hiera', $compiler_target, |
| 112 | + primary_host => $primary_target |
| 113 | + ) |
| 114 | + |
88 | 115 | # On <compiler-host>, run the puppet agent
|
89 | 116 | run_task('peadm::puppet_runonce', $compiler_target)
|
90 | 117 |
|
91 | 118 | # On <primary_postgresql_host> run the puppet agent
|
92 |
| - run_task('peadm::puppet_runonce', $primary_postgresql_target) |
| 119 | + run_task('peadm::puppet_runonce', peadm::flatten_compact([ |
| 120 | + $primary_postgresql_target, |
| 121 | + $replica_puppetdb_target |
| 122 | + ])) |
93 | 123 |
|
94 | 124 | # On <primary_postgresql_host> start puppet.service
|
95 | 125 | run_command('systemctl start puppet.service', peadm::flatten_compact([
|
96 | 126 | $primary_postgresql_target,
|
| 127 | + $replica_puppetdb_target, |
97 | 128 | $compiler_target,
|
98 | 129 | ]))
|
99 | 130 |
|
|
0 commit comments