|
70 | 70 | # Reload pe-postgresql.service
|
71 | 71 | run_command('systemctl reload pe-postgresql.service', $primary_postgresql_target)
|
72 | 72 |
|
73 |
| - # Install the puppet agent making sure to specify an availability group letter, A or B, as an extension request. |
74 |
| - $dns_alt_names_flag = $dns_alt_names? { |
75 |
| - undef => [], |
76 |
| - default => ["main:dns_alt_names=${dns_alt_names}"], |
77 |
| - } |
78 |
| - |
79 |
| - # Check for and merge csr_attributes. |
80 |
| - run_plan('peadm::util::insert_csr_extension_requests', $compiler_target, |
81 |
| - extension_requests => { |
82 |
| - peadm::oid('pp_auth_role') => 'pe_compiler', |
83 |
| - peadm::oid('peadm_availability_group') => $avail_group_letter, |
84 |
| - } |
85 |
| - ) |
86 |
| - |
87 |
| - # we first assume that there is no agent installed on the node. If there is, nothing will happen. |
88 |
| - run_task('peadm::agent_install', $compiler_target, |
89 |
| - server => $primary_target.peadm::certname(), |
90 |
| - install_flags => $dns_alt_names_flag + [ |
91 |
| - '--puppet-service-ensure', 'stopped', |
92 |
| - "main:certname=${compiler_target.peadm::certname()}", |
93 |
| - ], |
94 |
| - ) |
95 |
| - |
96 |
| - # If necessary, manually submit a CSR |
97 |
| - # ignoring errors to simplify logic |
98 |
| - run_task('peadm::submit_csr', $compiler_target, { '_catch_errors' => true }) |
99 |
| - |
100 |
| - # On primary, if necessary, sign the certificate request |
101 |
| - run_task('peadm::sign_csr', $primary_target, { 'certnames' => [$compiler_target.peadm::certname()] }) |
102 |
| - |
103 |
| - # If there was already a signed cert, force the certificate extensions we want |
104 |
| - # TODO: update peadm::util::add_cert_extensions to take care of dns alt names |
105 |
| - run_plan('peadm::modify_certificate', $compiler_target, |
106 |
| - primary_host => $primary_target.peadm::certname(), |
107 |
| - add_extensions => { |
108 |
| - peadm::oid('pp_auth_role') => 'pe_compiler', |
109 |
| - peadm::oid('peadm_availability_group') => $avail_group_letter, |
110 |
| - }, |
| 73 | + # Install agent (if required) and regenerate agent certificate to add required data with peadm::subplans::component_install |
| 74 | + run_plan('peadm::subplans::component_install', $compiler_target, |
| 75 | + primary_host => $primary_target, |
| 76 | + avail_group_letter => $avail_group_letter, |
| 77 | + dns_alt_names => $dns_alt_names, |
| 78 | + role => 'pe_compiler', |
111 | 79 | )
|
112 | 80 |
|
113 | 81 | # Source the global hiera.yaml from Primary and synchronize to new compiler
|
|
120 | 88 | run_task('peadm::puppet_runonce', $compiler_target)
|
121 | 89 |
|
122 | 90 | # On <primary_postgresql_host> run the puppet agent
|
123 |
| - run_task('peadm::puppet_runonce', peadm::flatten_compact([ |
124 |
| - $primary_postgresql_target, |
125 |
| - $replica_puppetdb_target, |
126 |
| - ])) |
| 91 | + run_task('peadm::puppet_runonce', $primary_postgresql_target) |
| 92 | + |
| 93 | + # On replica puppetdb run the puppet agent |
| 94 | + run_task('peadm::puppet_runonce', $replica_puppetdb_target) |
127 | 95 |
|
128 | 96 | # On <primary_postgresql_host> start puppet.service
|
129 | 97 | run_command('systemctl start puppet.service', peadm::flatten_compact([
|
|
0 commit comments