This code repository contains examples from the video course Hands-On DevOps with Ansible by Alan Hohn, published by Packt Publishing.
These prerequisites are needed to get the primary example working, including deploying the infrastructure to build the containerized version of the application.
-
Install Ansible. This can be done using
pip
. -
Install required roles:
ansible-galaxy install geerlingguy.gitlab
ansible-galaxy install riemers.gitlab-runner
ansible-galaxy install geerlingguy.nodejs
ansible-galaxy install geerlingguy.docker
ansible-galaxy install andrewrothstein.kubectl
-
Update
infrastructure/group_vars/gitlab-runner/vault.yaml
with your own content (and then encrypt with Ansible Vault). Alternatively you can modify thegitlab-runner-config
role to point to your own preferred or private Docker registry. -
Update the
infrastructure/inventory
file as appropriate for your environment, or configure your SSH config, DNS, or hosts file to match the servers in the inventory. -
Update the
playbook.yaml
andapp.yaml
files intodo/deployment
to reflect the correct name for your Docker image based on your DockerHub login or preferred registry.
Sample content for infrastructure/group_vars/gitlab-runner/vault.yaml
:
---
docker_user: "sekhar4536"
docker_password: "Sekhar.1"
docker_email: "[email protected]"
This repository contains the following content. Also see the README.md
file in each subdirectory for more information.
deploy
: Contains samples for testing with and deploying to Amazon Web Services (AWS).infrastructure
: Contains Ansible playbooks to set up a DevOps infrastructure (Gitlab and Jenkins). This can be set up on physical, virtual, or cloud machines.kubernetes
: Contains an Ansible playbook that demonstrates running an integration test in Kubernetes.todo
: Contains a "Todo" Javascript application. Within that directory is aDockerfile
for building a Docker container and adeployment
directory for deploying the built image to Kubernetes.