Skip to content
This repository was archived by the owner on Mar 31, 2020. It is now read-only.

Commit 9d77e18

Browse files
committed
FIRST COMMIT
0 parents  commit 9d77e18

File tree

13 files changed

+130
-0
lines changed

13 files changed

+130
-0
lines changed

README.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#BUILD IMAGE
2+
3+
#docker build <Dockerfile> .
4+
5+
#START DOCKER:
6+
$ docker run --name <name> -d <image> tail -f /dev/null
7+
8+
#STOP DOCKER:
9+
$ docker stop <docker_id>
10+
11+
#USING COMPOSE:
12+
#START:
13+
$ docker-compose up -d
14+
15+
#STOP
16+
$ docker-compose down
17+
============================
18+
#Check
19+
20+
docker ps
21+
22+
===========================
23+
#CONFIG ANSIBLE (control host):
24+
25+
touch /etc/ansible/ansible.cfg

control/Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM ansible/ubuntu14.04-ansible:stable
2+
CMD touch /etc/ansible/ansible.cfg
3+
CMD tail -f /dev/null

control/connect

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker exec -it ansible bash -c "echo 'PS1='\''control# '\' >> /root/.bashrc; bash";

control/inventory/hosts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[loadbalancer]
2+
load1
3+
4+
[webserver]
5+
app01
6+
7+
[database]
8+
db01
9+
10+
[control]
11+
ansible

db/Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM mysql:latest
2+
CMD tail -f /dev/null

db/connect

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker exec -it db_01 bash -c "echo 'PS1='\''mysql# '\' >> /root/.bashrc; bash";

docker-compose.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: '3.0'
2+
services:
3+
load01:
4+
build: loadbalancer
5+
hostname: load01
6+
container_name: load01
7+
app01:
8+
build: webserver
9+
hostname: app01
10+
container_name: app01
11+
db01:
12+
build: db
13+
hostname: mysql01
14+
container_name: mysql01
15+
environment:
16+
MYSQL_ROOT_PASSWORD: 123456
17+
MYSQL_DATABASE: auth
18+
MYSQL_USER: admin
19+
MYSQL_PASSWORD: admin
20+
ansible:
21+
build: control
22+
hostname: ansible
23+
container_name: ansible
24+
volumes:
25+
- ./control/inventory:/etc/ansible
26+
11.5 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
# README
5+
#
6+
# Getting Started:
7+
# 1. vagrant plugin install vagrant-hostmanager
8+
# 2. vagrant up
9+
# 3. vagrant ssh
10+
#
11+
# This should put you at the control host
12+
# with access, by name, to other vms
13+
Vagrant.configure(2) do |config|
14+
config.hostmanager.enabled = true
15+
16+
config.vm.box = "ubuntu/trusty64"
17+
18+
config.vm.define "control", primary: true do |h|
19+
h.vm.network "private_network", ip: "192.168.135.10"
20+
h.vm.provision :shell, :inline => <<'EOF'
21+
if [ ! -f "/home/vagrant/.ssh/id_rsa" ]; then
22+
ssh-keygen -t rsa -N "" -f /home/vagrant/.ssh/id_rsa
23+
fi
24+
cp /home/vagrant/.ssh/id_rsa.pub /vagrant/control.pub
25+
26+
cat << 'SSHEOF' > /home/vagrant/.ssh/config
27+
Host *
28+
StrictHostKeyChecking no
29+
UserKnownHostsFile=/dev/null
30+
SSHEOF
31+
32+
chown -R vagrant:vagrant /home/vagrant/.ssh/
33+
EOF
34+
end
35+
36+
config.vm.define "lb01" do |h|
37+
h.vm.network "private_network", ip: "192.168.135.101"
38+
h.vm.provision :shell, inline: 'cat /vagrant/control.pub >> /home/vagrant/.ssh/authorized_keys'
39+
end
40+
41+
config.vm.define "app01" do |h|
42+
h.vm.network "private_network", ip: "192.168.135.111"
43+
h.vm.provision :shell, inline: 'cat /vagrant/control.pub >> /home/vagrant/.ssh/authorized_keys'
44+
end
45+
46+
config.vm.define "app02" do |h|
47+
h.vm.network "private_network", ip: "192.168.135.112"
48+
h.vm.provision :shell, inline: 'cat /vagrant/control.pub >> /home/vagrant/.ssh/authorized_keys'
49+
end
50+
51+
config.vm.define "db01" do |h|
52+
h.vm.network "private_network", ip: "192.168.135.121"
53+
h.vm.provision :shell, inline: 'cat /vagrant/control.pub >> /home/vagrant/.ssh/authorized_keys'
54+
end
55+
end

loadbalancer/Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM ubuntu:latest
2+
CMD tail -f /dev/null

loadbalancer/connect

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker exec -it load01 bash -c "echo 'PS1='\''loadbalance# '\' >> /root/.bashrc; bash";

webserver/Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM ubuntu:latest
2+
CMD tail -f /dev/null

webserver/connect

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker exec -it app01 bash -c "echo 'PS1='\''webserver# '\' >> /root/.bashrc; bash";

0 commit comments

Comments
 (0)