A multi-tier application pattern might require a database. This task creates a service that installs and configures a MySQL server on a Linux virtual machine.

Procedure

  1. Log in to the vRealize Automation Rainpole portal.
    1. Open a Web browser and go to https://vra01svr01.rainpole.local/vcac/org/rainpole.
    2. Log in using the following credentials.

      Setting

      Value

      User name

      vra-admin-rainpole

      Password

      vra-admin-rainpole_password

      Domain

      rainpole.local

  2. Click New to create a new software component.
  3. Under General enter the following values and click Next.

    Setting

    Value

    Name

    MySQL

    Description

    MySQL Service Installation and Configuration

    Container

    Machine

  4. Under Properties click New, enter the following values, click OK, and then click Next.

    Setting

    Value

    Name

    dbpassword

    Description

    Root Password

    Type

    String

    Value

    gogo123

    Encrypted

    Yes

    Overridable

    Yes

    Required

    No

    Computed

    No





  5. Click OK and click Next.
  6. Set the actions for this service in the Actions pane.
    1. In the Install row, select Bash as the Script Type.




    2. Still in the Install row, select Click Here to edit and paste the following code into the Edit Script text box.
      #!/bin/bash
      /usr/bin/yum -y install mysql-server mysql-client
      /sbin/chkconfig mysqld on
      /sbin/service mysqld start
    3. In the Configure row, select Click here to Edit and paste the following code into the text box.
      #!/bin/bash
      /usr/bin/mysql -e "UPDATE mysql.user SET Password=PASSWORD('$dbpassword') WHERE User='root';"
      /usr/bin/mysql -e "DELETE FROM mysql.user WHERE User='';"
      /usr/bin/mysql -e "DROP DATABASE test;"
      /usr/bin/mysql -e "FLUSH PRIVILEGES;"
  7. Click Next and click Finish.
  8. Select the new MySQL service and click Publish.