puppet-ironic/manifests/db/sync.pp
ZhongShengping 1f694ff1a4 Add 'openstack-db' tag to db-sync Exec resource
In order to make easy orchestration on all OpenStack db-sync, add this
tag so people can use this tag in composition layer.
A use case it to set some orchestration to make sure MySQL Galera is
ready before running any Exec with this tag.

Change-Id: If6394558b373f85e61840f538a3e2e1105cfe98c
Closes-Bug: #1755102
2018-03-14 08:30:22 +08:00

47 lines
1.2 KiB
Puppet

#
# Class to execute ironic dbsync
#
# == Parameters
#
# [*extra_params*]
# (optional) String of extra command line parameters to append
# to the ironic-dbsync command.
# Defaults to undef
#
class ironic::db::sync(
$extra_params = undef,
) {
include ::ironic::deps
include ::ironic::params
# NOTE(dtantsur): previous ironic-dbsync was run as root. it will fail to run
# as "ironic" user, if there is an old log file owned by root. Let's fix it.
# To be removed in Rocky.
file { '/var/log/ironic/ironic-dbsync.log':
ensure => 'present',
owner => 'ironic',
group => 'ironic',
# /var/log/ironic comes from ironic-common
require => Anchor['ironic::install::end']
}
exec { 'ironic-dbsync':
command => "${::ironic::params::dbsync_command} ${extra_params}",
path => '/usr/bin',
user => 'ironic',
refreshonly => true,
try_sleep => 5,
tries => 10,
logoutput => on_failure,
subscribe => [
Anchor['ironic::install::end'],
Anchor['ironic::config::end'],
Anchor['ironic::dbsync::begin']
],
notify => Anchor['ironic::dbsync::end'],
require => File['/var/log/ironic/ironic-dbsync.log'],
tag => 'openstack-db',
}
}