/ansible_advance_homework

Fork The Repo for completing Ansible Advance Homework

Ansible Tower Config

Table 1. List of Playbooks
Files or dir Purpose

app-tier

Install application server role

db-tier

Install postgressql server for database role

lb-tier

Install HA proxy role

base-config

Setup yum repo and base packages role

setup-workstation

Setup workstation, create network, ssh keypair, security group etc. role

osp-servers

Provision OSP Instances role

osp-instance-delete

Delete OSP Instances role

osp-facts

Genrate in-memory inventory for OSP instances role

roles/config-tower/vars/main.yml

Very important file to review. All the variable values are set there. Please do not make any changes in the file

config-tower

Role to configure ansible tower job templates and workflow

aws_creds.yml

Fetch GUIDkey.pem from bastion of Three tier application env and create machine credential to connect to AWS instances

aws_provision.yml

Use order_svc.sh script to provision env

aws_status_check.yml

Check aws instances are up or not

site-3tier-app.yml

Playbook to deploy three tier app

site-install-isolated-node.yml

Playbook to install isolated node

site-config-tower.yml

Playbook to call role config-tower

site-osp-delete.yml

Playbook to call role

site-osp-instances.yml

Playbook to call role

site-setup-workstation.yml

Playbook to call role

site-smoke-osp.yml

Playbook to test three tier app on OSP

site-smoketest-aws.yml

Playbook to test three tier app on AWS

grading-script.yml

Self grading script

roles/config-tower/tasks/ec2_dynamic.yml

For creating Dynamic inventory in Ansible tower. Use AWS Access Key for credential

roles/config-tower/tasks/job_template.yml

For creating job templates

roles/config-tower/tasks/pre-config-tower.yml

Any pre config tasks needed

roles/config-tower/tasks/workflow_template.yml

genrate workflow from workflow.yml file

roles/config-tower/tasks/post-config-tower.yml

any post config jobs

  • Upload your opentlc ssh private key to /root/.ssh/mykey.pem on the bastion node and set it 400 permissions

[bastion]$ sudo -i
[bastion]# vi /root/.ssh/mykey.pem
[bastion]# chmod 400 /root/.ssh/mykey.pem
  • From the cloned repo run site-setup-workstation.yml playbook to setup workstation as an isolated node, provide vault pass for repo_vars.yml

[bastion]$ sudo -i
[bastion]# git clone https://github.com/manurodriguez/ansible_advance_homework.git
[bastion]# cd ansible_advance_homework
[bastion]# OSP_GUID=<Openstack for Ansible GUID from mail>
[bastion]# ansible-playbook site-setup-workstation.yml -e OSP_GUID=${OSP_GUID} -e @repo_vars.yml \
--private-key=/root/.ssh/mykey.pem -u <username-company.com> --ask-vault-pass
  • From the cloned repo run site-config-tower.yml playbook to create job templates and workflow template.

[bastion]$ sudo -i
[bastion]# cd ansible_advance_homework
[bastion]# TOWER_GUID=<Ansible Tower Homework GUID from mail>
[bastion]# OSP_GUID=<Openstack for Ansible GUID from mail>
[bastion]# OPENTLC_LOGIN=<username-company.com>
[bastion]# OPENTLC_PASSWORD=<your openlc account password>
[bastion]# GITHUB_REPO=https://github.com/<githubhandler>/ansible_advance_homework
[bastion]# JQ_REPO_BASE=http://www.opentlc.com/download/ansible_bootcamp
[bastion]# REGION=<enter region name example us-east-1>
[bastion]# RH_MAIL_ID=<your mail id for dynamic inventory tag>
[bastion]# ansible-playbook site-config-tower.yml -e tower_GUID=${TOWER_GUID} \
 -e osp_GUID=${OSP_GUID} -e opentlc_login=${OPENTLC_LOGIN} -e path_to_opentlc_key=/root/.ssh/mykey.pem \
 -e param_repo_base=${JQ_REPO_BASE} -e opentlc_password=${OPENTLC_PASSWORD} -e REGION_NAME=${REGION} \
 -e EMAIL=${RH_MAIL_ID} -e github_repo=${GITHUB_REPO}
  • From your web browser, connect to tower console using the admin username and known password

  • Navigate to Templates menu from the side panel and select the launch button of the cicd_workflow template.

  • Wait for the cicd_workflow to finish and finally grade your work

[bastion]# OSP_GUID=<Openstack GUID>
[bastion]# ANSIBLE_ADVANCED_GUID=<Prod Tier Three App GUID>
[bastion]# ansible-playbook grading-script.yml -e OSP_GUID=${OSP_GUID} -e ANSIBLE_ADVANCE_GUID=${ANSIBLE_ADVANCED_GUID}