Details

Result

Field Value
changed
True
cmd
[
    "/usr/local/bin/galera_secure_node"
]
delta
0:00:12.061906
end
2020-01-31 16:00:51.960860
rc
0
start
2020-01-31 16:00:39.898954
stderr
STOP_MYSQL=false

if ! systemctl status mariadb; then
  STOP_MYSQL=true
  systemctl set-environment MYSQLD_OPTS="--bind-address=127.0.0.1"
  systemctl start mariadb
  sleep 10
  systemctl status mariadb
fi

if mysqladmin --no-defaults --port=3306 --socket=/var/run/mysqld/mysqld.sock --host=127.0.0.1 --user=root password "9deee2dfb498c00cc91713e046635c01f8fa574f2628b5beabe51fa6"; then
  mysql -u root -h localhost -e "UPDATE mysql.user SET Password=PASSWORD('$rootpass') WHERE User='root';"
  mysql -u root -h localhost -e "DELETE FROM mysql.user WHERE user='';"
  mysql -u root -h localhost -e "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('%', 'localhost', '127.0.0.1', '::1');"
  mysql -u root -h localhost -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%';"
  mysql -u root -h localhost -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '9deee2dfb498c00cc91713e046635c01f8fa574f2628b5beabe51fa6' WITH GRANT OPTION;"
  mysql -u root -h localhost -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'127.0.0.1' IDENTIFIED BY '9deee2dfb498c00cc91713e046635c01f8fa574f2628b5beabe51fa6' WITH GRANT OPTION;"
  mysql -u root -h localhost -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'::1' IDENTIFIED BY '9deee2dfb498c00cc91713e046635c01f8fa574f2628b5beabe51fa6' WITH GRANT OPTION;"
  mysql -u root -h localhost -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '9deee2dfb498c00cc91713e046635c01f8fa574f2628b5beabe51fa6' WITH GRANT OPTION;"
  mysql -u root -h localhost -e "FLUSH PRIVILEGES;"
fi

if [ "${STOP_MYSQL}" = true ]; then
  systemctl stop mariadb
fi

# Create a marker file to ensure this script is not run again
systemctl unset-environment MYSQLD_OPTS
touch "/var/lib/mysql/osa_default_secured"
stderr_lines
[
    "",
    "STOP_MYSQL=false",
    "",
    "if ! systemctl status mariadb; then",
    "  STOP_MYSQL=true",
    "  systemctl set-environment MYSQLD_OPTS=\"--bind-address=127.0.0.1\"",
    "  systemctl start mariadb",
    "  sleep 10",
    "  systemctl status mariadb",
    "fi",
    "",
    "if mysqladmin --no-defaults --port=3306 --socket=/var/run/mysqld/mysqld.sock --host=127.0.0.1 --user=root password \"9deee2dfb498c00cc91713e046635c01f8fa574f2628b5beabe51fa6\"; then",
    "  mysql -u root -h localhost -e \"UPDATE mysql.user SET Password=PASSWORD('$rootpass') WHERE User='root';\"",
    "  mysql -u root -h localhost -e \"DELETE FROM mysql.user WHERE user='';\"",
    "  mysql -u root -h localhost -e \"DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('%', 'localhost', '127.0.0.1', '::1');\"",
    "  mysql -u root -h localhost -e \"DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';\"",
    "  mysql -u root -h localhost -e \"GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '9deee2dfb498c00cc91713e046635c01f8fa574f2628b5beabe51fa6' WITH GRANT OPTION;\"",
    "  mysql -u root -h localhost -e \"GRANT ALL PRIVILEGES ON *.* TO 'root'@'127.0.0.1' IDENTIFIED BY '9deee2dfb498c00cc91713e046635c01f8fa574f2628b5beabe51fa6' WITH GRANT OPTION;\"",
    "  mysql -u root -h localhost -e \"GRANT ALL PRIVILEGES ON *.* TO 'root'@'::1' IDENTIFIED BY '9deee2dfb498c00cc91713e046635c01f8fa574f2628b5beabe51fa6' WITH GRANT OPTION;\"",
    "  mysql -u root -h localhost -e \"GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '9deee2dfb498c00cc91713e046635c01f8fa574f2628b5beabe51fa6' WITH GRANT OPTION;\"",
    "  mysql -u root -h localhost -e \"FLUSH PRIVILEGES;\"",
    "fi",
    "",
    "if [ \"${STOP_MYSQL}\" = true ]; then",
    "  systemctl stop mariadb",
    "fi",
    "",
    "# Create a marker file to ensure this script is not run again",
    "systemctl unset-environment MYSQLD_OPTS",
    "touch \"/var/lib/mysql/osa_default_secured\""
]
stdout
● mariadb.service - MariaDB 10.3.18 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─environment.conf, limits.conf, migrated-from-my.cnf-settings.conf, restart.conf, slice.conf, timeout.conf, without-privatedevices.conf
   Active: inactive (dead)
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
● mariadb.service - MariaDB 10.3.18 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─environment.conf, limits.conf, migrated-from-my.cnf-settings.conf, restart.conf, slice.conf, timeout.conf, without-privatedevices.conf
   Active: active (running) since Fri 2020-01-31 16:00:40 UTC; 10s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 24603 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 24562 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
  Process: 24560 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
 Main PID: 24572 (mysqld)
   Status: "Taking your SQL requests now..."
    Tasks: 30 (limit: 4915)
      CPU: 261ms
   CGroup: /galera.slice/mariadb.service
           └─24572 /usr/sbin/mysqld --bind-address=127.0.0.1

Jan 31 16:00:40 aio1 mysqld[24572]: 2020-01-31 16:00:40 0 [Note] InnoDB: 10.3.18 started; log sequence number 1630815; transaction id 21
Jan 31 16:00:40 aio1 mysqld[24572]: 2020-01-31 16:00:40 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
Jan 31 16:00:40 aio1 mysqld[24572]: 2020-01-31 16:00:40 0 [Note] Plugin 'FEEDBACK' is disabled.
Jan 31 16:00:40 aio1 mysqld[24572]: 2020-01-31 16:00:40 0 [Note] InnoDB: Buffer pool(s) load completed at 200131 16:00:40
Jan 31 16:00:40 aio1 mysqld[24572]: 2020-01-31 16:00:40 0 [Note] Server socket created on IP: '127.0.0.1'.
Jan 31 16:00:40 aio1 mysqld[24572]: 2020-01-31 16:00:40 0 [Note] Reading of all Master_info entries succeeded
Jan 31 16:00:40 aio1 mysqld[24572]: 2020-01-31 16:00:40 0 [Note] Added new Master_info '' to hash table
Jan 31 16:00:40 aio1 mysqld[24572]: 2020-01-31 16:00:40 0 [Note] /usr/sbin/mysqld: ready for connections.
Jan 31 16:00:40 aio1 mysqld[24572]: Version: '10.3.18-MariaDB'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MariaDB Server
Jan 31 16:00:40 aio1 systemd[1]: Started MariaDB 10.3.18 database server.
stdout_lines
[
    "\u25cf mariadb.service - MariaDB 10.3.18 database server",
    "   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)",
    "  Drop-In: /etc/systemd/system/mariadb.service.d",
    "           \u2514\u2500environment.conf, limits.conf, migrated-from-my.cnf-settings.conf, restart.conf, slice.conf, timeout.conf, without-privatedevices.conf",
    "   Active: inactive (dead)",
    "     Docs: man:mysqld(8)",
    "           https://mariadb.com/kb/en/library/systemd/",
    "\u25cf mariadb.service - MariaDB 10.3.18 database server",
    "   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)",
    "  Drop-In: /etc/systemd/system/mariadb.service.d",
    "           \u2514\u2500environment.conf, limits.conf, migrated-from-my.cnf-settings.conf, restart.conf, slice.conf, timeout.conf, without-privatedevices.conf",
    "   Active: active (running) since Fri 2020-01-31 16:00:40 UTC; 10s ago",
    "     Docs: man:mysqld(8)",
    "           https://mariadb.com/kb/en/library/systemd/",
    "  Process: 24603 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)",
    "  Process: 24562 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)",
    "  Process: 24560 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)",
    " Main PID: 24572 (mysqld)",
    "   Status: \"Taking your SQL requests now...\"",
    "    Tasks: 30 (limit: 4915)",
    "      CPU: 261ms",
    "   CGroup: /galera.slice/mariadb.service",
    "           \u2514\u250024572 /usr/sbin/mysqld --bind-address=127.0.0.1",
    "",
    "Jan 31 16:00:40 aio1 mysqld[24572]: 2020-01-31 16:00:40 0 [Note] InnoDB: 10.3.18 started; log sequence number 1630815; transaction id 21",
    "Jan 31 16:00:40 aio1 mysqld[24572]: 2020-01-31 16:00:40 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool",
    "Jan 31 16:00:40 aio1 mysqld[24572]: 2020-01-31 16:00:40 0 [Note] Plugin 'FEEDBACK' is disabled.",
    "Jan 31 16:00:40 aio1 mysqld[24572]: 2020-01-31 16:00:40 0 [Note] InnoDB: Buffer pool(s) load completed at 200131 16:00:40",
    "Jan 31 16:00:40 aio1 mysqld[24572]: 2020-01-31 16:00:40 0 [Note] Server socket created on IP: '127.0.0.1'.",
    "Jan 31 16:00:40 aio1 mysqld[24572]: 2020-01-31 16:00:40 0 [Note] Reading of all Master_info entries succeeded",
    "Jan 31 16:00:40 aio1 mysqld[24572]: 2020-01-31 16:00:40 0 [Note] Added new Master_info '' to hash table",
    "Jan 31 16:00:40 aio1 mysqld[24572]: 2020-01-31 16:00:40 0 [Note] /usr/sbin/mysqld: ready for connections.",
    "Jan 31 16:00:40 aio1 mysqld[24572]: Version: '10.3.18-MariaDB'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MariaDB Server",
    "Jan 31 16:00:40 aio1 systemd[1]: Started MariaDB 10.3.18 database server."
]