|
23 | 23 | # String specifying username for pkgurl |
24 | 24 | # @param pkgurl_pass |
25 | 25 | # String specifying password for pkgurl |
26 | | -# @param s3daemon |
27 | | -# Boolean, true to install s3daemon |
28 | | -# @param s3daemon_repo_url |
29 | | -# URL of the s3daemon repo |
30 | | -# @param s3daemon_repo_rev |
31 | | -# Git repository revision of s3daemon to install |
32 | | -# @param s3daemon_repo_directory |
33 | | -# String specifying s3daemon installation directory |
34 | | -# @param s3daemon_env_file |
35 | | -# String specifying s3daemon environment file |
36 | | -# @param s3daemon_env_url |
37 | | -# String giving s3daemon endpoint URL |
38 | | -# @param s3daemon_env_access |
39 | | -# String giving s3daemon access key |
40 | | -# @param s3daemon_env_secret |
41 | | -# String giving s3daemon secret key |
42 | 26 | # |
43 | 27 | class profile::ccs::file_transfer ( |
44 | | - Sensitive[String[1]] $s3daemon_env_access, |
45 | | - Sensitive[String[1]] $s3daemon_env_secret, |
46 | | - Boolean $s3daemon = true, |
47 | | - Stdlib::HTTPUrl $s3daemon_repo_url = 'https://github.com/lsst-dm/s3daemon', |
48 | | - Optional[String[1]] $s3daemon_repo_rev = undef, |
49 | | - String $s3daemon_repo_directory = '/home/ccs-ipa/s3daemon/git', |
50 | | - String $s3daemon_env_file = '/home/ccs-ipa/s3daemon/env', |
51 | | - String $s3daemon_env_url = 'https://s3dfrgw.slac.stanford.edu', |
52 | 28 | String $directory = '/home/ccs-ipa/bin', |
53 | 29 | String $user = 'ccs-ipa', |
54 | 30 | String $group = 'ccs-ipa', |
|
70 | 46 | mode => '0755', |
71 | 47 | }) |
72 | 48 |
|
73 | | - ## We expect that s3daemon will become the default (and only) method |
74 | | - ## some time soonish. |
75 | | - if $s3daemon { |
76 | | - case fact('os.release.major') { |
77 | | - '7': { |
78 | | - $pip_extra_packages = [ |
79 | | - 'aiosignal', |
80 | | - 'async-timeout', |
81 | | - 'attrs', |
82 | | - 'charset-normalizer', |
83 | | - 'multidict', |
84 | | - 'typing_extensions', |
85 | | - 'yarl', |
86 | | - 'idna_ssl', |
87 | | - ] |
88 | | - $yum_extra_packages = [] |
89 | | - } |
90 | | - '8': { |
91 | | - $pip_extra_packages = [ |
92 | | - 'aiosignal', |
93 | | - 'idna_ssl', |
94 | | - ] |
95 | | - $yum_extra_packages = [ |
96 | | - 'python3-async-timeout', |
97 | | - 'python3-attrs', |
98 | | - 'python3-charset-normalizer', |
99 | | - 'python3-multidict', |
100 | | - 'python3-typing-extensions', |
101 | | - 'python3-yarl', |
102 | | - ] |
103 | | - } |
104 | | - default: { |
105 | | - $pip_extra_packages = [] |
106 | | - $yum_extra_packages = [ |
107 | | - 'python3-aiosignal', |
108 | | - 'python3-async-timeout', |
109 | | - 'python3-attrs', |
110 | | - 'python3-charset-normalizer', |
111 | | - 'python3-multidict', |
112 | | - 'python3-typing-extensions', |
113 | | - 'python3-yarl', |
114 | | - ] |
115 | | - } |
116 | | - } |
117 | | - |
118 | | - $yum_packages = $yum_extra_packages + [ |
119 | | - 'python3', |
120 | | - 'python3-pip', |
121 | | - 'python3-devel', |
122 | | - ] |
123 | | - |
124 | | - $pip_packages = $pip_extra_packages + [ |
125 | | - 'aiobotocore', |
126 | | - ] |
127 | | - |
128 | | - ensure_packages($yum_packages) |
129 | | - |
130 | | - package { $pip_packages: |
131 | | - ensure => 'present', |
132 | | - provider => 'pip3', |
133 | | - require => Package['python3-pip'], |
134 | | - } |
135 | | - |
136 | | - $repo_parent = "${dirname($s3daemon_repo_directory)}" |
137 | | - $env_parent = "${dirname($s3daemon_env_file)}" |
138 | | - |
139 | | - $parents = [$repo_parent, $env_parent] |
140 | | - |
141 | | - $parents.unique.each | String $direc | { |
142 | | - file { $direc: |
143 | | - ensure => directory, |
144 | | - mode => '0755', |
145 | | - owner => $user, |
146 | | - group => $group, |
147 | | - } |
148 | | - } |
149 | | - |
150 | | - $envfile_epp_vars = { |
151 | | - url => $s3daemon_env_url, |
152 | | - access => $s3daemon_env_access, |
153 | | - secret => $s3daemon_env_secret, |
154 | | - } |
155 | | - |
156 | | - file { $s3daemon_env_file: |
157 | | - content => epp("${module_name}/ccs/file_transfer/s3daemon_envfile.epp", $envfile_epp_vars), |
158 | | - owner => $user, |
159 | | - group => $group, |
160 | | - mode => '0600', |
161 | | - require => File[$env_parent], |
162 | | - } |
163 | | - |
164 | | - vcsrepo { $s3daemon_repo_directory: |
165 | | - ensure => latest, |
166 | | - provider => git, |
167 | | - source => $s3daemon_repo_url, |
168 | | - revision => $s3daemon_repo_rev, |
169 | | - user => $user, |
170 | | - require => File[$repo_parent], |
171 | | - } |
172 | | - |
173 | | - $epp_vars = { |
174 | | - desc => 's3daemon file transfer service', |
175 | | - user => $user, |
176 | | - group => $group, |
177 | | - cmd => "/usr/bin/python3 ${s3daemon_repo_directory}/python/s3daemon/s3daemon.py", |
178 | | - workdir => "/home/${user}", |
179 | | - envfile => $s3daemon_env_file, |
180 | | - } |
181 | | - |
182 | | - systemd::unit_file { 's3daemon.service': |
183 | | - content => epp("${module_name}/ccs/service.epp", $epp_vars), |
184 | | - } |
185 | | - ~> service { 's3daemon': |
186 | | - ensure => 'running', |
187 | | - enable => true, |
188 | | - } |
189 | | - } # s3daemon |
190 | | - |
191 | 49 | file { $directory: |
192 | 50 | ensure => directory, |
193 | 51 | owner => $user, |
|
0 commit comments