VCP-CMA 2024 Question 233
Select 2A cloud administrator is tasked with customizing a virtual machine deployment in VMware Aria Automation using CloudConfig. The administrator needs to ensure that a specific package is installed, a custom user is created, and a service is enabled on the deployed virtual machine. Which of the following CloudConfig/Cloud-Init configurations should the administrator use to achieve these requirements?
- A
Write a CloudConfig script to install the package, add the user, and enable the service under the 'runcmd' module.
- B
Use the 'packages' module in CloudConfig to install the package, the 'users' module to create the user, and the 'runcmd' module to enable the service.
- C
Configure all required tasks under the 'bootcmd' module in CloudConfig to ensure execution during the early boot process.
- D
Use the 'write_files' module to create a script file that installs the package, creates the user, and enables the service, and then execute it via 'runcmd'.
- E
Leverage the 'final_message' module to define the tasks since it executes at the end of the configuration process.
Show answer and explanation
Correct answers: B, D
Explanation
CloudConfig in VMware Aria Automation allows for modular configurations using Cloud-Init. The most efficient and recommended approach is to use dedicated modules like 'packages' for installing software, 'users' for creating users, and 'runcmd' for enabling services, as in option 2. Alternatively, option 4 is valid, where a script is created using 'write_files' and executed via 'runcmd'. These approaches ensure flexibility and clarity in the configuration process.
- A. Incorrect.
Using the 'runcmd' module alone is not the most efficient or correct approach. While it can execute commands, it's better to use dedicated modules such as 'packages' and 'users' for specific tasks, as they are purpose-built for those operations.
- B. Correct.
This is a correct approach. The 'packages' module is designed to install software packages, the 'users' module is for creating users, and the 'runcmd' module can handle tasks like enabling a service. This method leverages the modular capabilities of CloudConfig effectively.
- C. Incorrect.
The 'bootcmd' module is executed during the early stages of boot, typically before networking is configured, making it unsuitable for tasks like package installation or service enablement which require network access.
- D. Correct.
This is another correct approach. The 'write_files' module can create a script to handle all tasks, and the 'runcmd' module can execute that script. While slightly less modular than option 2, this approach is still valid and commonly used.
- E. Incorrect.
The 'final_message' module is used to display a message after the configuration is complete. It is not intended for task execution and cannot perform the required tasks.