Add mysql command to host

This commit is contained in:
Micke Nordin 2024-10-04 10:00:50 +02:00
parent b79eb5d4bf
commit f2c31c79cd
2 changed files with 9 additions and 0 deletions

View file

@ -90,6 +90,11 @@ define sunetdrive::db_type(
ok_criteria => ['exit_status=0','max_age=2d'],
warn_criteria => ['exit_status=1','max_age=3d'],
}
file { '/usr/local/bin/mysql':
ensure => present,
content => template('sunetdrive/mariadb/mysql.erb.sh'),
mode => '0744',
}
file { '/usr/local/bin/size-test':
ensure => present,
content => template('sunetdrive/mariadb/size-test.erb'),

View file

@ -0,0 +1,4 @@
#!/bin/bash
pw=$(yq -r '.services.db.environment[0]' /opt/mariadb/docker-compose.yml | awk -F '=' '{print $2}')
docker exec -ti mariadb_db_1 mysql -u root -p"${pw}" -e "${@}"