https://github.com/hrmeetsingh/opsbootcamp
Repo for Bootcamp material
https://github.com/hrmeetsingh/opsbootcamp
Last synced: 3 months ago
JSON representation
Repo for Bootcamp material
- Host: GitHub
- URL: https://github.com/hrmeetsingh/opsbootcamp
- Owner: hrmeetsingh
- Created: 2019-04-09T13:49:57.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-04-10T03:26:44.000Z (about 6 years ago)
- Last Synced: 2025-01-03T08:31:24.418Z (5 months ago)
- Language: Dockerfile
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# OpsBootcamp
QA Bootcamp repo.## What's covered
- Docker container setup
- Ansible setup for installation and configuration of webserver on target systems
- Ansible tests for verifying installation and configuration works## Setup
### Setup Docker container
- Use the following command while in parent folder -
`docker build -t "bootcampImage" .`
- Confirm new image is created by following command -
`docker images`
- Bring up Docker container
`docker run -it -p 2222:22 -p 8081:80 `### Setup an Ubuntu VM
- Use virtualbox to bring up a VM of Ubuntu
- Create root user password -
`passwd root`
- Install openssh-server on the VM (ansible needs ssh) -
`apt-get install openssh-server`
- Edit '/etc/ssh/sshd_config' to change the value of 'PermitRootLogin' to 'yes'
- Start ssh service -
`service ssh start`### Establish secure passwordless SSH connection between Ansible master and target machines
Ansible requires a passwordless connection between systems or it will keep asking passwords when running configurations. These steps are common for docker image and VM
- Create ssh keys for your machine if already not there using `ssh-keygen` command
- Copy ssh keys to destination systems -For VM - `ssh-copy-id -i root@`
Provide root password set for VM when asked to
For container - `ssh-copy-id -i -p 2222 [email protected]`
#### Troubleshooting tip
If while doing an ssh for the first time, you get an error saying something like *'someone might be doing an MITM'*, one of the IPs you are trying to connect this time matches an IP your system already associates with a different machine signature - edit /.ssh/known_hosts file to remove any existing entries for the IP and try again### Test everything is up for Ansible to take over
- Update `hosts` file with IP for VM
- Use `ping` command to confirm Ansible is ready -
`ansible -i hosts -m ping local`
### Run Ansible role on all target systems
- Use this command to get things done `ansible-playbook -i hosts playbook.yml`