-
Notifications
You must be signed in to change notification settings - Fork 1
/
Ansible_Practice.sh
executable file
·55 lines (43 loc) · 2.16 KB
/
Ansible_Practice.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
# Travis Michette <[email protected]>
## Needs to be run with SUDO
printf '\e[1;34m%-6s\e[m' "================================================================"
echo ""
printf '\e[1;34m%-6s\e[m' "Verifying Container Image Exists ....."
echo ""
printf '\e[1;34m%-6s\e[m' "================================================================"
echo ""
sudo podman pull ghcr.io/tmichett/ansible-practice/systemd-ansible-server:latest
printf '\e[1;34m%-6s\e[m' "================================================================"
echo ""
printf '\e[1;34m%-6s\e[m' "Launching Servers now ....."
echo ""
printf '\e[1;34m%-6s\e[m' "================================================================"
echo ""
## Create Podman Network
sudo podman network create ansiblenet
## ServerA Launching
sudo podman run --cap-add AUDIT_WRITE -P -d -p 2222:22 --network ansiblenet --name servera ghcr.io/tmichett/ansible-practice/systemd-ansible-server:latest
## ServerB Launching
sudo podman run --cap-add AUDIT_WRITE -P -d -p 2322:22 --network ansiblenet --name serverb ghcr.io/tmichett/ansible-practice/systemd-ansible-server:latest
## ServerC Launching
sudo podman run --cap-add AUDIT_WRITE -P -d -p 2422:22 --network ansiblenet --name serverc ghcr.io/tmichett/ansible-practice/systemd-ansible-server:latest
printf '\e[1;34m%-6s\e[m' "================================================================"
echo ""
printf '\e[1;34m%-6s\e[m' "Servers launched and ready to use!!!"
echo ""
printf '\e[1;34m%-6s\e[m' "================================================================"
echo ""
printf '\e[1;34m%-6s\e[m' "================================================================"
echo ""
printf '\e[1;31m%-6s\e[m' "Server A IP Address: "
sudo podman inspect -f '{{.NetworkSettings.Networks.ansiblenet.IPAddress}}' servera
echo ""
printf '\e[1;32m%-6s\e[m' "Server B IP Address: "
sudo podman inspect -f '{{.NetworkSettings.Networks.ansiblenet.IPAddress}}' serverb
echo ""
printf '\e[1;36m%-6s\e[m' "Server C IP Address: "
sudo podman inspect -f '{{.NetworkSettings.Networks.ansiblenet.IPAddress}}' serverc
echo ""
printf '\e[1;34m%-6s\e[m' "================================================================"
echo ""