You can add a cloudConfig section to vRealize Automation Cloud Assembly blueprint code, in which you add machine initialization commands that run at deployment time.

  • Linux—initialization commands follow the open cloud-init standard.
  • Windows—initialization commands use Cloudbase-init.

You use initialization commands to automate the application of user data or settings at instance creation time. For example:

  • Setting a hostname
  • Generating and setting up SSH private keys
  • Installing packages

In vRealize Automation Cloud Assembly, you can also add initialization commands to a machine image when configuring infrastructure.

Important: You might have an image map and a blueprint where both contain initialization commands. At deployment time, the commands merge, and vRealize Automation Cloud Assembly runs the consolidated commands. For details about what happens when a blueprint image mapping and the blueprint itself contain a cloud configuration script, see Learn more about image mappings in vRealize Automation Cloud Assembly.

When the same command appears in both places but includes different parameters, only the image map command is run.

The following example cloudConfig section is taken from the WordPress use case blueprint code for the Linux-based MySQL server.

      cloudConfig: |
        #cloud-config
        repo_update: true
        repo_upgrade: all
        packages:
         - apache2
         - php
         - php-mysql
         - libapache2-mod-php
         - php-mcrypt
         - mysql-client
        runcmd:
         - mkdir -p /var/www/html/mywordpresssite && cd /var/www/html && wget https://wordpress.org/latest.tar.gz && tar -xzf /var/www/html/latest.tar.gz -C /var/www/html/mywordpresssite --strip-components 1
         - i=0; while [ $i -le 5 ]; do mysql --connect-timeout=3 -h ${DBTier.networks[0].address} -u root -pmysqlpassword -e "SHOW STATUS;" && break || sleep 15; i=$((i+1)); done
         - mysql -u root -pmysqlpassword -h ${DBTier.networks[0].address} -e "create database wordpress_blog;"
         - mv /var/www/html/mywordpresssite/wp-config-sample.php /var/www/html/mywordpresssite/wp-config.php
         - sed -i -e s/"define( 'DB_NAME', 'database_name_here' );"/"define( 'DB_NAME', 'wordpress_blog' );"/ /var/www/html/mywordpresssite/wp-config.php && sed -i -e s/"define( 'DB_USER', 'username_here' );"/"define( 'DB_USER', 'root' );"/ /var/www/html/mywordpresssite/wp-config.php && sed -i -e s/"define( 'DB_PASSWORD', 'password_here' );"/"define( 'DB_PASSWORD', 'mysqlpassword' );"/ /var/www/html/mywordpresssite/wp-config.php && sed -i -e s/"define( 'DB_HOST', 'localhost' );"/"define( 'DB_HOST', '${DBTier.networks[0].address}' );"/ /var/www/html/mywordpresssite/wp-config.php
         - service apache2 reload