writed for job application homework. this homework mainly test your devops and learning skills. keywords: terraform, aws, ansible
License GNU GPL v3
- all project objects must run on the aws
- wordpress must run on aws Ec2
- there must be have load balancer in front of server
- database must be aws Rds
git clone https://github.com/ysfduzgun/devopsHw
devopsHw/terraform/credential
cp your_key.epm devopsHw/ansible/your_key.pem
chmod 400 devopsHw/ansible/your_key.pem
cd devopsHw/terraform/
terraform init
terraform plan
terraform apply
yes
now our architecture is preparing. we can check server with ping.
ping $(terraform output ubuntuIp)
when server answer to request we can go next step.
we must solve ssh fingerprint ask problem
- connect to server with ssh
cd devopsHw/ansible
ssh -i your_key.pem ubuntu@ip
The authenticity of host 'ip (ip)' can't be established.
ECDSA key fingerprint is SHA256:xyzxyzxyzxyzxyzxyzxyzxyzxyz.
Are you sure you want to continue connecting (yes/no)? yes
exit
- or disable check
touch ~/.ssh/config
echo "Host *" > ~/.ssh/config
echo " StrictHostKeyChecking no" >> ~/.ssh/config
cd devopsHw/terraform
./preAnsible.sh
cd devopsHw/ansible/
ansible-playbook playbook.yml -i hosts.inf --private-key=./your_key.pem
lets request ip:6868 port, loadbalancer should have redirect to server:80
cat devopsHw/terraform/elbIp.txt
cd devopsHw/terraform
terraform destroy