added functionality to trigger ansibles from cli

This commit is contained in:
2021-08-08 00:21:44 +04:00
parent af4b129bee
commit 5ff6702d9c
12 changed files with 354 additions and 17 deletions

View File

@@ -144,4 +144,22 @@ func ReadTrackContainers(filename string) (*TrackContainers, error) {
}
return c, nil
}
// GetContainerInformation gets information about container based on
// container ID provided
func GetContainerInformation(ID string) (*TrackContainer, error) {
// Getting the current containers
err, CurrentContainers := ViewTrackedContainers()
if err != nil {
return nil, err
}
// Iterating through all tracked containers to get the container information
// of the ID passed through the function parameter
for _, container := range CurrentContainers.TrackcontianerList {
if container.Container.ID == ID {
return &container, nil
}
}
return nil, errors.New("Container not found. ")
}

View File

@@ -0,0 +1,41 @@
{
"TrackContainer": [
{
"ID": "858912730fb34f3cce38ef6d405e04519e44f50c2a496cd400e75aaa0def3c80",
"Container": {
"SSHUsername": "master",
"SSHPassword": "password",
"ID": "858912730fb34f3cce38ef6d405e04519e44f50c2a496cd400e75aaa0def3c80",
"TagName": "p2p-ubuntu",
"ImagePath": "/home/akilan/Documents/p2p-rendering-computation/server/docker/containers/docker-ubuntu-sshd/",
"Ports": {
"Port": [
{
"PortName": "SSH",
"InternalPort": 22,
"Type": "tcp",
"ExternalPort": 44269,
"Description": "SSH Port"
},
{
"PortName": "NoVNC",
"InternalPort": 5901,
"Type": "tcp",
"ExternalPort": 40725,
"Description": "NoVNC port"
},
{
"PortName": "NoVNC",
"InternalPort": 6081,
"Type": "tcp",
"ExternalPort": 40053,
"Description": "NoVNC port"
}
]
},
"GPU": "false"
},
"IpAddress": "0.0.0.0"
}
]
}