This repository contains executable code that is meant to serve as examples for the DevOps lecture as part of the master's studies.
make
openssh
terraform
- r/w supporting DigitalOcean API token (
./.credentials/do-api-token
)
-
make init
- generates an ssh key pair
- initializes terraform within the project
-
make allocate
- spins up a virtual machine
-
make connect
- opens ssh connection to the virtual machine
-
make clean
- destroys all allocated resources on DigitalOcean
- removes all terraform files created during runtime
make
openssh
vagrant
- VirtualBox (+ Extension Pack and Guest Additions)
-
make vm-prerequisites
- installs depending vagrant plugins
-
make vm-allocate
- spins up and prepares a local virtual machine
-
make vm-status
- shows the current state of the local virtual machine
-
make vm-connect
- opens ssh connection to the virtual machine
-
make vm-clean
- destroys the local virtual machine
- removes all vagrant files and logs created during runtime
make
ansible
v2.8.x- per default the target host is the one provisioned in Example: Vagrant, so unless another host has been added in the inventory, it is required to allocate the local virtual machine first before applying the environment configuration with Ansible
./environments/local/inventory
contains all arguments for the local environment./cm-ansible/roles
contains the whole state definition and logic./cm-ansible/playbooks
-
make vm
(optional, if not already done)- spins up the local virtual machine
-
make local
- applies configuration for the local environment
-
make test-local
- executes all tests defined in the respective roles
Please note that the Makefile
contains some more "sub-commands" (aka target)
worth checking out regarding Ansible, like facts
, vars
or check
.
Please refer to Example: Ansible
See cm-ansible/roles/jenkins/README.md
for mor information. Examples for pipelines can be found in ./cicd
- Install Jenkins with the help of Ansible (see playbook
main.yaml
)
-
Create a node via Jenkins UI: Manage Jenkins > Manage Nodes > New Node > Node name:
agent_name
(Ansible variable) + Permanent Agent > Launch method: Launch agent by connecting it to the master > Save -
Obtain agent secret by selecting node from list & set
agent_secret
in Jenkins inventory file accordingly -
Apply changes via Ansible