|
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 | # |
|
89 | 111 | run_task('peadm::puppet_runonce', $compiler_target) |
90 | 112 |
|
91 | 113 | # On <primary_postgresql_host> run the puppet agent |
92 | | - run_task('peadm::puppet_runonce', $primary_postgresql_target) |
| 114 | + run_task('peadm::puppet_runonce', peadm::flatten_compact([ |
| 115 | + $primary_postgresql_target, |
| 116 | + $replica_puppetdb_target |
| 117 | + ])) |
93 | 118 |
|
94 | 119 | # On <primary_postgresql_host> start puppet.service |
95 | 120 | run_command('systemctl start puppet.service', peadm::flatten_compact([ |
96 | 121 | $primary_postgresql_target, |
| 122 | + $replica_puppetdb_target, |
97 | 123 | $compiler_target, |
98 | 124 | ])) |
99 | 125 |
|
|
0 commit comments