|
43 | 43 | # @param token_file |
44 | 44 | # File on disk containing an administrative token. This class will write the token generated as part of initial setup to this file. |
45 | 45 | # Note that functions or code run in Puppet server will not be able to use this file, so setting $token after setup is recommended. |
| 46 | +# @param repo_gpg_key_id |
| 47 | +# ID of the GPG signing key |
46 | 48 | # @param repo_url |
47 | 49 | # URL of the Package repository |
48 | 50 | # @param repo_gpg_key_url |
|
53 | 55 | Integer $port, |
54 | 56 | String $initial_org, |
55 | 57 | String $initial_bucket, |
| 58 | + String $repo_gpg_key_id, |
56 | 59 | String $repo_gpg_key_url, |
| 60 | + Boolean $manage_repo, |
57 | 61 |
|
58 | | - Boolean $manage_repo = true, |
59 | 62 | Boolean $manage_setup = true, |
60 | 63 |
|
61 | 64 | Optional[String] $repo_url = undef, |
|
81 | 84 | fail("Unable to manage InfluxDB installation on host ${facts['networking']['fqdn']}") |
82 | 85 | } |
83 | 86 |
|
| 87 | + # If managing SSL, install the package before managing files under /etc/influxdb in order to ensure the directory exists |
| 88 | + $package_before = if $use_ssl and $manage_ssl { |
| 89 | + [ |
| 90 | + File['/etc/influxdb/cert.pem', '/etc/influxdb/key.pem', '/etc/influxdb/ca.pem', '/etc/systemd/system/influxdb.service.d'], |
| 91 | + Service['influxdb'] |
| 92 | + ] |
| 93 | + } |
| 94 | + else { |
| 95 | + Service['influxdb'] |
| 96 | + } |
| 97 | + |
84 | 98 | # If we are managing the repository, set it up and install the package with a require on the repo |
85 | | - if $manage_repo and $facts['os']['family'] in ['Redhat'] { |
| 99 | + if $manage_repo { |
86 | 100 | #TODO: other distros |
87 | 101 | case $facts['os']['family'] { |
88 | 102 | 'RedHat': { |
|
96 | 110 | gpgcheck => '1', |
97 | 111 | target => '/etc/yum.repos.d/influxdb2.repo', |
98 | 112 | } |
| 113 | + $package_require = Yumrepo[$repo_name] |
| 114 | + } |
| 115 | + 'Debian': { |
| 116 | + include apt |
| 117 | + apt::source { $repo_name: |
| 118 | + ensure => 'present', |
| 119 | + comment => 'The InfluxDB2 repository', |
| 120 | + location => $repo_url, |
| 121 | + release => 'stable', |
| 122 | + repos => 'main', |
| 123 | + key => { |
| 124 | + 'id' => $repo_gpg_key_id, |
| 125 | + 'source' => $repo_gpg_key_url, |
| 126 | + }, |
| 127 | + } |
| 128 | + $package_require = Apt::Source[$repo_name] |
99 | 129 | } |
100 | 130 | default: { |
101 | 131 | notify { 'influxdb_repo_warn': |
|
105 | 135 | } |
106 | 136 | } |
107 | 137 |
|
108 | | - package { 'influxdb2': |
| 138 | + package {'influxdb2': |
109 | 139 | ensure => $version, |
110 | | - require => Yumrepo[$repo_name], |
111 | | - before => Service['influxdb'], |
| 140 | + require => $package_require, |
| 141 | + before => $package_before, |
112 | 142 | } |
113 | 143 | } |
114 | 144 | # If not managing the repo, install the package from archive source |
|
167 | 197 | else { |
168 | 198 | package { 'influxdb2': |
169 | 199 | ensure => installed, |
170 | | - before => Service['influxdb'], |
| 200 | + before => $package_before, |
171 | 201 | } |
172 | 202 | } |
173 | 203 |
|
|
0 commit comments