Control where automation runs with container groups
Ansible Automation Platform supports container groups, which enable you to run jobs in automation controller regardless of whether automation controller is installed as a standalone, in a virtual environment, or in a container.
Container groups act as a pool of resources within a virtual environment.
You can create instance groups to point to an OpenShift container. These are job environments that are provisioned on-demand as a pod that exists only for the duration of the playbook run. This is known as the ephemeral execution model and ensures a clean environment for every job run.
In some cases, you might want to set container groups to be "always-on", which you can configure through the creation of an instance.
Container groups upgraded from versions before automation controller 4.0 revert back to default and remove the old pod definition, clearing out all custom pod definitions in the migration.
Container groups are different from execution environments in that execution environments are container images and do not use a virtual environment. For more information, seeDefine, create, and build execution environments in the Related Links section.
Create a container group Copy linkLink copied!
You can create a ContainerGroup in automation controller to run jobs in containers on an OpenShift or Kubernetes cluster.
Before you begin Copy linkLink copied!
- A namespace that you can launch into. Every cluster has a "default" namespace, but you can use a specific namespace.
- A service account that has the roles that enable it to launch and manage pods in this namespace. For more information, see Creating a service account in OpenShift Container Platform or Kubernetes.
- If you are using execution environments in a private registry, and have a container registry credential associated with them in automation controller, the service account also needs the roles to get, create, and delete secrets in the namespace. If you do not want to give these roles to the service account, you can pre-create the
ImagePullSecretsand specify them on the pod spec for theContainerGroup. In this case, the execution environment must not have a container registry credential associated, or automation controller attempts to create the secret for you in the namespace. - A token associated with that service account. An OpenShift or Kubernetes Bearer Token.
- A CA certificate associated with the cluster.
About this task Copy linkLink copied!
A ContainerGroup is a type of InstanceGroup that has an associated credential you can use to connect to an OpenShift cluster.
Procedure Copy linkLink copied!
- From the navigation panel, select .
- Click and select Create container group.
- Enter a name for your new container group and select the credential you created before to associate it to the container group.
- Click .
- Check the Customize pod spec box and edit the Pod spec override to include the namespace and service account name that you used in the previous steps.
Create a service account in OpenShift Container Platform or Kubernetes Copy linkLink copied!
Use service accounts in an OpenShift cluster or Kubernetes to run jobs in a container group through automation controller. After the service account is created, its credentials are provided to automation controller in the form of an OpenShift or Kubernetes API Bearer Token credential.
Procedure Copy linkLink copied!
Customize the pod specification Copy linkLink copied!
Ansible Automation Platform provides a simple default pod specification, however, you can provide a custom YAML or JSON document that overrides the default pod specification.
About this task Copy linkLink copied!
This field uses any custom fields such as ImagePullSecrets, that can be "serialized" as valid pod JSON or YAML. A full list of options can be found in the Pods and Services section of the OpenShift documentation.
Procedure Copy linkLink copied!
Verify the container group functions Copy linkLink copied!
Verify the deployment and termination of your container.
Procedure Copy linkLink copied!
Results Copy linkLink copied!
You can see in the Jobs details view that the container was reached successfully by using one of the ad hoc jobs.
If you have an OpenShift UI, you can see pods appear and disappear as they deploy and end. You can also use the CLI to perform a get pod operation on your namespace to watch these same events occurring in real-time.
Container capacity limits Copy linkLink copied!
When using container groups in automation controller, you can set capacity limits for the containers that run the jobs.
Capacity limits and quotas for containers are defined by objects in the Kubernetes API:
- To set limits on all pods within a given namespace, use the
LimitRangeobject. For more information see the Quotas and Limit Ranges section of the OpenShift documentation. - To set limits directly on the pod definition launched by automation controller, see Customizing the pod specification and the Compute Resources section of the OpenShift documentation.
Container groups do not use the capacity algorithm that normal nodes use. You need to set the number of forks at the job template level. If you configure forks in automation controller, that setting is passed along to the container.



