2 - Jenkins and AWX Deployment
Prerequisites
AWS Account
Terraform Cloud Account
Preconfigured access in
~/.terraformrc
. Get the token from https://app.terraform.io by going to Settings → Teams → Team API Token. Generate a new token and create the file~/.terraformrc
credentials "app.terraform.io" { token = "iz5o8MNxgBBPwQ...." }
# | Step | |
---|---|---|
1 | Setup |
Make sure there are no other credentials in the |
2 | Create IAM User & Role |
The script creates:
|
3 | Create Ops Kubernetes Cluster |
The script creates:
|
4 | Import the Kubernetes Cluster connection config | Make sure you have an AWS profile set in your ~/ ~/.aws/config [profile tf-user] region = us-east-2 external_id = terraform [profile tf-role] external_id = terraform source_profile = tf-user role_arn = arn:aws:iam::<aws-account-number>:role/tf_automation region = us-east-2 ~/.aws/credentials [tf-user] aws_access_key_id = AKI... aws_secret_access_key = r3AB... Find the name of the Kubernetes cluster and update the local config with it export AWS_PROFILE=tf-role aws eks update-kubeconfig --name ops-k8s |
5 | Install Nginx |
It is possible that the nginx LB will not be assigned DNS and IP due to the security group for the cluster and the nodes tagged with the same annotation. To fix that find the security group for the nodes (e.g. ops-k8s-node) and remove the owned tag. |
6 | Install Jenkins | Use the helm chart for installing Jenkins onto the Kubernetes cluster created above. cd <devops-repo>/jenkins kubectl create ns jenkins helm repo add jenkins https://charts.jenkins.io helm upgrade --install -n jenkins jenkins jenkins/jenkins --values values.yaml Wait for Jenkins to start up. To view the Jenkins admin password: kubectl exec --namespace jenkins -it svc/jenkins -c jenkins -- /bin/cat /run/secrets/additional/chart-admin-password && echo Set up a cloud-provisioned Jenkins node as defined in the Kubernetes plugin config in Jenkins. |
7 | Install Ansible Tower (AWX) | Create the AWX DB by connecting to the RDS PostgreSQL instance created via Terraform.
Install AWX with the Kustomize command. cd awx-operator helm repo add awx-operator https://ansible.github.io/awx-operator/ kustomize build . | kubectl apply -f - Watch for the script failing and if it does run it again (timing issue due to the creation of the AWX RBAC) |
8 | Update DNS record (optional) |
Now Jenkins and AWX should be available via http://ops.d1.test.openidl-org-test.net/ and http://ops.d1.test.openidl-org-test.net/jenkins. |