dev/provisioning/modules/sysconfig/manifests/handle.pp
changeset 153 338bcc78d431
parent 150 cb4c47eda2db
equal deleted inserted replaced
152:dd6b3adde73b 153:338bcc78d431
     3     $hdl_user           = hiera('sysconfig::params::hdl_user', $sysconfig::params::hdl_user),
     3     $hdl_user           = hiera('sysconfig::params::hdl_user', $sysconfig::params::hdl_user),
     4     $hdl_srv_port       = hiera('sysconfig::params::hdl_srv_port', $sysconfig::params::hdl_srv_port),
     4     $hdl_srv_port       = hiera('sysconfig::params::hdl_srv_port', $sysconfig::params::hdl_srv_port),
     5     $hdl_web_port       = hiera('sysconfig::params::hdl_web_port', $sysconfig::params::hdl_web_port),
     5     $hdl_web_port       = hiera('sysconfig::params::hdl_web_port', $sysconfig::params::hdl_web_port),
     6     $hdl_key_pswd       = hiera('sysconfig::params::hdl_key_pswd', $sysconfig::params::hdl_key_pswd),
     6     $hdl_key_pswd       = hiera('sysconfig::params::hdl_key_pswd', $sysconfig::params::hdl_key_pswd),
     7     $hdl_prefix         = hiera('sysconfig::params::hdl_prefix', $sysconfig::params::hdl_prefix),
     7     $hdl_prefix         = hiera('sysconfig::params::hdl_prefix', $sysconfig::params::hdl_prefix),
       
     8     $hdl_test_prefix    = hiera('sysconfig::params::hdl_test_prefix', $sysconfig::params::hdl_test_prefix),
     8     $hdl_prefix_admin   = hiera('sysconfig::params::hdl_prefix_admin', $sysconfig::params::hdl_prefix_admin),
     9     $hdl_prefix_admin   = hiera('sysconfig::params::hdl_prefix_admin', $sysconfig::params::hdl_prefix_admin),
     9     $hdl_db_name        = hiera('sysconfig::params::hdl_db_name', $sysconfig::params::hdl_db_name),
    10     $hdl_db_name        = hiera('sysconfig::params::hdl_db_name', $sysconfig::params::hdl_db_name),
    10     $db_user            = hiera('sysconfig::params::db_user', $sysconfig::params::db_user),
    11     $db_user            = hiera('sysconfig::params::db_user', $sysconfig::params::db_user),
    11     $db_pw              = hiera('sysconfig::params::db_pw', $sysconfig::params::db_pw),
    12     $db_pw              = hiera('sysconfig::params::db_pw', $sysconfig::params::db_pw),
    12     $db_host            = hiera('sysconfig::params::db_host', $sysconfig::params::db_host)
    13     $db_host            = hiera('sysconfig::params::db_host', $sysconfig::params::db_host)
   105         provider => 'shell',
   106         provider => 'shell',
   106         creates => "/var/lib/handle/corpusadmpriv.bin",
   107         creates => "/var/lib/handle/corpusadmpriv.bin",
   107         user => $hdl_user,
   108         user => $hdl_user,
   108         notify => Exec['rm-tmp-handle-corpus-admin-key'],
   109         notify => Exec['rm-tmp-handle-corpus-admin-key'],
   109         require => [Archive["handle-8.1"], Package['java-install'], Package['expect']]
   110         require => [Archive["handle-8.1"], Package['java-install'], Package['expect']]
       
   111     }
       
   112 
       
   113     exec { "convert-handle-corpus-admin-keys-priv":
       
   114         command => "/opt/handle/bin/hdl-convert-key /var/lib/handle/corpusadmpriv.bin -o /var/lib/handle/corpusadmpriv.pem",
       
   115         cwd => "/opt/handle/bin",
       
   116         creates => "/var/lib/handle/corpusadmpriv.pem",
       
   117         user => $hdl_user,
       
   118         require => [Archive["handle-8.1"], Package['java-install'], Exec['init-handle-corpus-admin-keys']]
       
   119     }
       
   120 
       
   121     exec { "convert-handle-corpus-admin-keys-pub":
       
   122         command => "/opt/handle/bin/hdl-convert-key /var/lib/handle/corpusadmpub.bin -o /var/lib/handle/corpusadmpub.pem",
       
   123         cwd => "/opt/handle/bin",
       
   124         creates => "/var/lib/handle/corpusadmpub.pem",
       
   125         user => $hdl_user,
       
   126         require => [Archive["handle-8.1"], Package['java-install'], Exec['init-handle-corpus-admin-keys']]
       
   127     }
       
   128     
       
   129     # create handle admin handle dsa keys
       
   130     file { "/tmp/handle/handle_script_corpus_admin_dsa_keys.exp":
       
   131         ensure => file,
       
   132         source => "puppet:///modules/sysconfig/handle/handle_script_corpus_admin_dsa_keys.exp",
       
   133         owner => "$hdl_user",
       
   134         group => "$hdl_user",
       
   135         mode => "0750"
       
   136     }->
       
   137     exec { "init-handle-corpus-admin-dsa-keys":
       
   138         command => "/tmp/handle/handle_script_corpus_admin_dsa_keys.exp",
       
   139         cwd => "/opt/handle/bin",
       
   140         provider => 'shell',
       
   141         creates => "/var/lib/handle/corpusadmdsapriv.bin",
       
   142         user => $hdl_user,
       
   143         notify => Exec['rm-tmp-handle-corpus-admin-dsa-key'],
       
   144         require => [Archive["handle-8.1"], Package['java-install'], Package['expect']]
       
   145     }
       
   146 
       
   147 
       
   148     exec { "convert-handle-corpus-admin-dsa-keys-pub":
       
   149         command => "/opt/handle/bin/hdl-convert-key /var/lib/handle/corpusadmdsapub.bin -o /var/lib/handle/corpusadmdsapub.pem",
       
   150         cwd => "/opt/handle/bin",
       
   151         creates => "/var/lib/handle/corpusadmdsapub.pem",
       
   152         user => $hdl_user,
       
   153         require => [Archive["handle-8.1"], Package['java-install'], Exec['init-handle-corpus-admin-dsa-keys']]
       
   154     }
       
   155 
       
   156     exec { "convert-handle-corpus-admin-dsa-keys-priv":
       
   157         command => "/opt/handle/bin/hdl-convert-key /var/lib/handle/corpusadmdsapriv.bin -o /var/lib/handle/corpusadmdsapriv.pem",
       
   158         cwd => "/opt/handle/bin",
       
   159         creates => "/var/lib/handle/corpusadmdsapriv.pem",
       
   160         user => $hdl_user,
       
   161         require => [Archive["handle-8.1"], Package['java-install'], Exec['init-handle-corpus-admin-dsa-keys']]
       
   162     }  
       
   163 
       
   164     
       
   165     exec { "convert-handle-corpus-admin-cert":
       
   166         command => "/usr/bin/openssl req -pubkey -x509 -new -sha256 -subj \"/CN=300:${hdl_prefix}\\/${hdl_prefix_admin}\" -key /var/lib/handle/corpusadmpriv.pem | /usr/bin/openssl x509 -inform PEM -out /var/lib/handle/corpusadmcrt.pem",
       
   167         creates => "/var/lib/handle/corpusadmcrt.pem",
       
   168         user => $hdl_user,
       
   169         require => Exec["convert-handle-corpus-admin-keys-priv"]
       
   170     }->
       
   171     exec { "concat-handle-corpus-admin-pkey-cert":
       
   172     	 command => "/usr/bin/cat /var/lib/handle/corpusadmpriv.pem /var/lib/handle/corpusadmcrt.pem > /var/lib/handle/corpusadmpkeycrt.pem",
       
   173 	 creates => "/var/lib/handle/corpusadmpkeycrt.pem",
       
   174 	 user => $hdl_user
       
   175     }
       
   176 
       
   177     exec { "convert-handle-corpus-admin-test-cert":
       
   178         command => "/usr/bin/openssl req -pubkey -x509 -new -sha256 -subj \"/CN=300:${hdl_test_prefix}\\/${hdl_prefix_admin}\" -key /var/lib/handle/corpusadmpriv.pem | /usr/bin/openssl x509 -inform PEM -out /var/lib/handle/corpusadmcrttest.pem",
       
   179         creates => "/var/lib/handle/corpusadmcrttest.pem",
       
   180         user => $hdl_user,
       
   181         require => Exec["convert-handle-corpus-admin-keys-priv"]
   110     }
   182     }
   111 
   183 
   112     file { '/tmp/handle/handle_data.sql.sh':
   184     file { '/tmp/handle/handle_data.sql.sh':
   113         ensure => file,
   185         ensure => file,
   114         content => template("sysconfig/handle/handle_data.sql.sh.erb"),
   186         content => template("sysconfig/handle/handle_data.sql.sh.erb"),
   206     exec { "rm-tmp-handle-corpus-admin-key":
   278     exec { "rm-tmp-handle-corpus-admin-key":
   207         command => "/usr/bin/rm -f /tmp/handle/handle_script_corpus_admin_keys.exp",
   279         command => "/usr/bin/rm -f /tmp/handle/handle_script_corpus_admin_keys.exp",
   208         refreshonly => true
   280         refreshonly => true
   209     }
   281     }
   210 
   282 
       
   283     exec { "rm-tmp-handle-corpus-admin-dsa-key":
       
   284         command => "/usr/bin/rm -f /tmp/handle/handle_script_corpus_admin_dsa_keys.exp",
       
   285         refreshonly => true
       
   286     }
       
   287     
   211     exec { "open-handle-web-port":
   288     exec { "open-handle-web-port":
   212         command => "firewall-cmd --permanent --add-port=8000/tcp",
   289         command => "firewall-cmd --permanent --add-port=8000/tcp",
   213         path => [ '/bin', '/usr/bin', '/usr/local/bin' ]
   290         path => [ '/bin', '/usr/bin', '/usr/local/bin' ]
   214     }->
   291     }->
   215     exec { "open-handle-srv-port":
   292     exec { "open-handle-srv-port":