Expert Session on Ansible by Redhat
I learn many things from the session and understand the concept of ansible tower and many more...
CASE 1: Provisioning instance over AWS using Pre-created Template.
- Write Playbook including aws_instance module and defining the region, VPC, subnet, route-table, security groups, keys, OS to be provisioned in the instance i.e. AMI and other required attributes.
- Create a credential-type if not there in your ansible-tower subscription then create your credential using fingerprint, user-id, tenancy, tokens, key file.
- Create a Template importing those playbook and credential-file.
- Run that template for getting desired infrastructure over cloud. Now you can deploy any application over your instance by connecting using SSH from your Controller node.
USE CASE 2: Using ChatOPS create a notify job using modern messaging platform like Slack.
- Create a workspace in slack. Then create channels for your DEVOPS teams.
- Now over RHVT (RedHat Virtualization Tooling) Platform we would create a VM as per our scaling automation workflow, and for this we would create a Job over Workflow Visualizer.
- Ansible-tower will do the analysis of Workflow and get the task done. We have imported various playbooks for out work process. One of them is create_task_vm.yml which would create a VM according to our desire.
- Workflow is as follows:
5. Clicking Start button would help to run the Workflow and Notify on Slack Channel and Ask for Approval then after approval when job completes then another message is sent over the Slack Channel.
USE CASE 3: Creating Python Virtual Environment in some directory using Ansible-Tower
- install venv command to deploy the playbook for establishing python over a target node.
- command would be like:
> python3 -m venv <directory name>
USE CASE 4: Creating instance over OCI (Oracle Cloud Infrastructure)
- Check ansible collection if any certified collection is available for creating roles for instance over OCI.
- Create Credential using oracle-oci-credential type. (If credential type not available then you can create one custom credential for any technology using credential tab in AWX) for this you need user-name, key file, fingerprint and tenancy.
- deploy the Template after attaching both the Credential and collection.
- Make sure your Ansible-Tower license must support for the number of instance you want to create spontaneously using ansible-tower.
- Nodes you would manage from Ansible-tower depends on your valid subscription. Example: 2 storage device, 16 host device, for the community AWX subscription.
- Now you may connect to any of the instance over oracle cloud using:
> ssh -i ./ssh/id-oraclecloud-rsa opc@←ip —
Additional Information provided by our instructor
- Minimum requirements to install Ansible Tower over our systems are 4GiB RAM, 2 CPUs and 20 GB Hard disk.
- We can import or export playbooks over our AWX WebUI
- Ansible galaxy roles are not certified from RedHat.
- We can upload inventory file in ansible tower using ansible-tower command.
- Pre-requisite for establishing ansible tower is your Base OS must be Linux as ansible is designed to work on Linux Architecture.