LKSN 2022 - Module C - Infrastructure Programmability & Automation
LKSN 2022 - Module C - Infrastructure Programmability & Automation
MODULE C
IT NETWORK SYSTEMS
ADMINISTRATION
KELOMPOK INFORMATION AND COMMUNICATION TECHNOLOGY
Deskripsi
A small UMKM in Indonesia just procured a lot of servers to support their containerized
online services. They are hiring for new engineers to help manage the servers. This is the
sample of their technical test for recruitment. You will need to utilize many tools to configure,
manage, and deploy the infrastructure.
Credentials
Ubuntu
username : competitor/root
password : Skills39
Preconfigure
Already installed : ansible, python3.8, docker, nginx
Documentation
- https://docs.python.org/
- https://docs.ansible.com/
- https://docs.docker.com/
Notes
if server ubuntu cannot access internet please run command
# dhcp.sh
Network Programmability
Scripted Configuration
● Prepare all other servers to be able managed by the deployer server.
○ Configure IP Address of all other servers and routers on the network
according to the addressing table.
○ Create username admin with password cisco privilege 15 in router
○ Enable restconf on router
API url :
GET https:://<iprouter>/restconf/data/Cisco-IOS-XE-native:native/interface/Loopback=100
Response json :
Automation tools
/roles/nginx/templates/loadbalancer.conf
---
upstream backend {
server 172.16.20.10:8081;
server 172.16.20.20:8082;
}
server {
listen 80;
server_name www.artemis.local;
location / {
proxy_pass http://backend;
}
}
Containerized Services
Local Registry
● Access srv1.artemis.local to do tasks in this section
● Container Name : proteus-registry
● Use image registry:2.7.0 from docker hub
● Volume mounts : /mnt/registry to /var/lib/registry
● Expose container port 1234
● Enable https by using local self-signed CA
○ Generate CA using openssl
○ Common name : srv1.artemis.local
○ Country : ID
○ Organizational : ITNSA-CA
● Enable basic authentication with following credentials:
○ Username: devops
○ Password : lksn2022
● Make sure it’s accessible from srv2.artemis.local server
sample = Flask(__name__)
@sample.route("/")
def main():
return render_template("index.html", hostname=node())
if __name__ == "__main__":
sample.run(host="0.0.0.0", port=8080)
○ index.html
<html>
<head>
<title>Sample app</title>
</head>
<body>
<h1>You are calling me from
{{hostname}}</h1> </body>
</html>
Running Containers
● Running webserver on container based on srv1 and srv2
○ Get the images httpd:base from local registry and run it as container
■ Container name : web-httpd
■ Make it accessible via http://{container_ip_address}
■ Do not expose any port on the host.
■ Save the following code in directory /home/competitor/httpd
● httpd.html
<html>
<head>
<title>HTTPD website</title>
</head>
<body>
<h1>Welcome to LKSN 2022</h1></body>
</html>
○ Get the images nginx:base from local registry and run it as container
■ Container name : web-nginx
■ Make it accessible via http://{container_ip_address}
■ Do not expose any port on the host.
■ Save the following code in directory /home/competitor/nginx
● nginx.html
<html>
<head>
<title>NGINX website</title>
</head>
<body>
<h1>Welcome to LKSN 2022</h1></body>
</html>
Appendix
Device IP Address OS
Topology