This example creates a Power Systems Virtual Server running AIX or IBM i. The server is configured to allow incoming SSH connections through a publicly accessible IP address and authenticated using the provided SSH key.
The following infrastructure resources will be created (Ansible modules in parentheses):
- SSH Key (ibm_pi_key)
- Virtual Server Instance (ibm_pi_instance)
The following parameters can be set by the user:
pi_name
: Name assigned to Virtual Server Instancesys_type
: The type of system on which to create the VM (s922/e880/any)pi_image
: VM image name (retrieve available images)proc_type
: The type of processor mode in which the VM will run (shared/dedicated)processors
: The number of vCPUs to assign to the VM (as visibile within the guest operating system)memory
: The amount of memory (GB) to assign to the VMpi_cloud_instance_id
: The cloud_instance_id for this accountssh_public_key
: The value of the ssh public key to be authorized for SSH access
Note: Alternate install path is to use 'examples/install_modules.yml' playbook.
-
Download IBM Cloud Ansible modules from release page.
-
Extract module archive.
unzip ibmcloud_ansible_modules.zip
-
Add modules and module_utils to the [Ansible search path]. E.g.:
cp build/modules/* $HOME/.ansible/plugins/modules/. cp build/module_utils/* $HOME/.ansible/plugins/module_utils/.
-
[Obtain an IBM Cloud API key].
-
Export your API key to the
IC_API_KEY
environment variable:export IC_API_KEY=<YOUR_API_KEY_HERE>
Note: Modules also support the 'ibmcloud_api_key' parameter, but it is recommended to only use this when encrypting your API key value.
-
Export desired IBM Cloud region to the 'IC_REGION' environment variable:
export IC_REGION=<REGION_NAME_HERE>
Note: Modules also support the 'ibmcloud_region' parameter.
-
To create all resources and test public SSH connection to the VM, run the 'create' playbook:
ansible-playbook create.yml
-
To list available images run the 'list_pi_images' playbook. *note: Images are specific to a PI instance, and thus the 'pi_cloud_instance_id' var must be set before running this playbook.:
ansible-playbook list_pi_images.yml