Skip to content

Commit 5c4ca13

Browse files
authored
Merge pull request #490 from mattbator/main
Initial pattern docs for ansible-edge-gitops-kasten
2 parents 89b1de8 + 2455fb5 commit 5c4ca13

File tree

58 files changed

+1664
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1664
-1
lines changed

.wordlist.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ additionalimages
1414
addon
1515
addons
1616
addr
17-
addr
17+
addr
1818
adoc
1919
ae
2020
aeg
@@ -502,6 +502,8 @@ kafkatopic
502502
kafkatopics
503503
kam
504504
kamelet
505+
kasten
506+
kastendr
505507
keycloak
506508
keypair
507509
keypairs
@@ -1025,6 +1027,7 @@ vdjtkgams
10251027
vdvkgdtuxkeqf
10261028
vectordb
10271029
vectorized
1030+
veeam
10281031
vfio
10291032
vhjpkievife
10301033
virtualmachine
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
title: Ansible Edge GitOps with Veeam Kasten
3+
date: 2024-10-28
4+
tier: sandbox
5+
summary: This pattern uses OpenShift Virtualization to simulate an edge environment for VMs, protected by Veeam Kasten.
6+
rh_products:
7+
- Red Hat OpenShift Container Platform
8+
- Red Hat Ansible Automation Platform
9+
- Red Hat OpenShift Virtualization
10+
- Red Hat Enterprise Linux
11+
- Red Hat OpenShift Data Foundation
12+
other_products:
13+
- Veeam Kasten
14+
industries:
15+
- Chemical
16+
aliases: /ansible-edge-gitops-kasten/
17+
pattern_logo: veeam-kasten.png
18+
links:
19+
install: getting-started
20+
help: https://groups.google.com/g/validatedpatterns
21+
bugs: https://github.com/validatedpatterns/ansible-edge-gitops/issues
22+
# ci: aegitops
23+
---
24+
25+
# Ansible Edge GitOps with Veeam Kasten
26+
27+
## Background
28+
29+
Organizations are interested in accelerating their deployment speeds and improving delivery quality in their Edge environments, where many devices may not fully or even partially embrace the GitOps philosophy. Further, there are VMs and other devices that can and should be managed with Ansible. This pattern explores some of the possibilities of using an OpenShift-based Ansible Automated Platform deployment and managing edge devices, based on work done with a partner in the Chemical space.
30+
31+
This pattern uses **OpenShift Virtualization** (the productization of KubeVirt) to provision VMs alongside Kubernetes-native workloads on the cluster. As VMs are inherently stateful workloads, a GitOps approach alone is not sufficient to recover an environment in the event of accidental data loss, malware attack, or infrastructure failure - especially in edge environments where infrastructure may be less resilient or subject to harsh environments. This example extends the standard [Ansible Edge GitOps pattern](https://validatedpatterns.io/patterns/ansible-edge-gitops/) to include automated deployment and configuration of [Veeam Kasten](https://www.veeam.com/products/cloud/kubernetes-data-protection.html), the #1 Kubernetes data protection and mobility solution.
32+
33+
### Solution elements
34+
35+
- How to use a GitOps approach to manage virtual machines, either in public clouds (limited to AWS for technical reasons) or on-prem OpenShift installations
36+
- How to integrate AAP into OpenShift
37+
- How to manage Edge devices using AAP hosted in OpenShift
38+
- How to protect OpenShift Virtualzation VMs
39+
40+
### Red Hat Technologies
41+
42+
- Red Hat OpenShift Container Platform (Kubernetes)
43+
- Red Hat Ansible Automation Platform (formerly known as "Ansible Tower")
44+
- Red Hat OpenShift GitOps (ArgoCD)
45+
- OpenShift Virtualization (KubeVirt)
46+
- Red Hat Enterprise Linux 8
47+
48+
### Other Technologies this Pattern Uses
49+
50+
- Veeam Kasten
51+
- Hashicorp Vault
52+
- External Secrets Operator
53+
- Inductive Automation Ignition
54+
55+
## Architecture
56+
57+
Similar to other patterns, this pattern starts with a central management hub, which hosts the AAP and Vault components. Veeam Kasten is deployed on each cluster it protects, providing a self-contained solution ideal for edge deployments without dependencies on external infrastructure or SaaS management plane.
58+
59+
### Logical architecture
60+
61+
![Ansible-Edge-Gitops-Architecture](/images/ansible-edge-gitops/ansible-edge-gitops-arch.png)
62+
63+
### Physical Architecture
64+
65+
![Ansible-Edge-GitOps-Physical-Architecture](/images/ansible-edge-gitops-kasten/aeg-arch-schematic.png)
66+
67+
## Other Presentations Featuring this Pattern
68+
69+
### Registration Required
70+
71+
[![Ansible-Automates-June-2022-Deck](/images/ansible-edge-gitops/automates-june-2022-deck-thumb.png)](https://tracks.redhat.com/c/validated-patterns_i?x=5wCWYS&lx=lT1ZfK)
72+
73+
[![Ansible-Automates-June-2022-Video](/images/ansible-edge-gitops/automates-june-2022-video-thumb.png)](https://tracks.redhat.com/c/preview-42?x=5wCWYS&lx=lT1ZfK)
74+
75+
## What's Next
76+
77+
- [Getting Started: Deploying and Validating the Pattern](getting-started)
Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
---
2+
title: Ansible Automation Platform
3+
weight: 40
4+
aliases: /ansible-edge-gitops-kasten/ansible-automation-platform/
5+
---
6+
7+
# Ansible Automation Platform
8+
9+
# How it's installed
10+
11+
See the installation details [here](/patterns/ansible-edge-gitops/installation-details/#ansible-automation-platform-aap-formerly-known-as-ansible-tower).
12+
13+
# How to Log In
14+
15+
The default login user is `admin` and the password is generated randomly at install time; you will need the password to login in to the AAP interface. You do not have to log in to the interface - the pattern will configure the AAP instance; the pattern retrieves the password using the same technique as the `ansible_get_credentials.sh` script described below. If you want to inspect the AAP instance, or change any aspects of its configuration, there are two ways to login and look at it. Both mechanisms are equivalent; you get the same password to the same instance using either technique.
16+
17+
## Via the OpenShift Console
18+
19+
In the OpenShift console, navigate to Workloads > Secrets and select the "ansible-automation-platform" project if you want to limit the number of Secrets you can see.
20+
21+
[![secrets-navigation](/images/ansible-edge-gitops/ocp-console-secrets-aap-admin-password.png)](/images/ansible-edge-gitops/ocp-console-secrets-aap-admin-password.png)
22+
23+
The Secret you are looking for is in the `ansible-automation-platform` project and is named `controller-admin-password`. If you click on it, you can see the Data.password field. It is shown revealed below to show that it is the same as what is shown by the script method of retrieving it below:
24+
25+
[![secrets-detail](/images/ansible-edge-gitops/ocp-console-aap-admin-password-detail.png)](/images/ansible-edge-gitops/ocp-console-aap-admin-password-detail.png)
26+
27+
## Via [ansible_get_credentials.sh](https://github.com/validatedpatterns/ansible-edge-gitops/blob/main/scripts/ansible_get_credentials.sh)
28+
29+
With your KUBECONFIG set, you can run `./scripts/ansible-get-credentials.sh` from your top-level pattern directory. This will use your OpenShift cluster admin credentials to retrieve the URL for your Ansible Automation Platform instance, as well as the password for its `admin` user, which is auto-generated by the AAP operator by default. The output of the command looks like this (your password will be different):
30+
31+
```text
32+
./scripts/ansible_get_credentials.sh
33+
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match
34+
'all'
35+
36+
PLAY [Install manifest on AAP controller] ******************************************************************************
37+
38+
TASK [Retrieve API hostname for AAP] ***********************************************************************************
39+
ok: [localhost]
40+
41+
TASK [Set ansible_host] ************************************************************************************************
42+
ok: [localhost]
43+
44+
TASK [Retrieve admin password for AAP] *********************************************************************************
45+
ok: [localhost]
46+
47+
TASK [Set admin_password fact] *****************************************************************************************
48+
ok: [localhost]
49+
50+
TASK [Report AAP Endpoint] *********************************************************************************************
51+
ok: [localhost] => {
52+
"msg": "AAP Endpoint: https://controller-ansible-automation-platform.apps.mhjacks-aeg.blueprints.rhecoeng.com"
53+
}
54+
55+
TASK [Report AAP User] *************************************************************************************************
56+
ok: [localhost] => {
57+
"msg": "AAP Admin User: admin"
58+
}
59+
60+
TASK [Report AAP Admin Password] ***************************************************************************************
61+
ok: [localhost] => {
62+
"msg": "AAP Admin Password: CKollUjlir0EfrQuRrKuOJRLSQhi4a9E"
63+
}
64+
65+
PLAY RECAP *************************************************************************************************************
66+
localhost : ok=7 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
67+
```
68+
69+
# Pattern AAP Configuration Details
70+
71+
In this section, we describe the details of the AAP configuration we apply as part of installing the pattern. All of the configuration discussed in this section is applied by the [ansible_load_controller.sh](https://github.com/validatedpatterns/ansible-edge-gitops/blob/main/scripts/ansible_load_controller.sh) script.
72+
73+
## Loading a Manifest
74+
75+
After validating that AAP is ready to be configured, the first thing the script does is to install the manifest you specify in the `values-secret.yaml` file in the `files.manifest` setting. The value of this setting is expected to be a fully-pathed file that represents a Red Hat Satellite manifest file with a valid entitlement for AAP. The *only* thing this manifest is used for is entitling AAP.
76+
77+
Instructions for creating a suitable manifest file can be found [here](https://www.redhat.com/en/blog/how-create-and-use-red-hat-satellite-manifest).
78+
79+
While it is absolutely possible to entitle AAP via a username/password on first login, the automated mechanisms for entitling only support manifests, that is the technique the pattern uses.
80+
81+
## Organizations
82+
83+
The pattern installs an Organization called `HMI Demo` is installed. This makes it a bit easier to separate what the pattern is doing versus the default configuration of AAP. The other resources created in AAP as part of the load process are associated with this Organization.
84+
85+
## Credential Types (and their Credentials)
86+
87+
### Kubeconfig (Kubeconfig)
88+
89+
The Kubeconfig credential is for holding the OpenShift cluster admin kubeconfig file. This is used to query the `edge-gitops-vms` namespace for running VM instances. Since the kubeconfig is necessary for installing the pattern and must be available when the load script is running, the load script pulls it into an AAP secret and stores it for later use (and calls it `Kubeconfig`).
90+
91+
The template for creating the Credential Type was taken from [here](https://blog.networktocode.com/post/kubernetes-collection-ansible/).
92+
93+
### RHSMcredential (rhsm_credential)
94+
95+
This credential is required to register the RHEL VMs and configure them for Kiosk mode. The registration process allows them to install packages from the Red Hat Content Delivery Network.
96+
97+
### Machine (kiosk-private-key)
98+
99+
This is a standard AAP Machine type credential. `kiosk-private-key` is created with the username and private key from your `values-secret.yaml` file in the `kiosk-ssh.username` and `kiosk-ssh.privatekey` fields.
100+
101+
### KioskExtraParams (kiosk_container_extra_params)
102+
103+
This CredentialType is considered "secret" because it includes the admin login password for the Ignition application. This passed to the provisioning playbook(s) as extra_vars.
104+
105+
## Inventory
106+
107+
The pattern installs an Inventory (HMI Demo), but no inventory sources. This is due to the way that OpenShift Virtualization provides access to virtual machines. The IP address associated with the SSH service that a given VM is running is associated with the Service object on the VM. This is not the way the Kubernetes inventory plugin expects to work. So to make inventory dynamic, we are instead using a play to discover VMs and add them to inventory "on the fly". What is unusual about DNS inside a Kubernetes cluster is that resources outside the namespace must use the cluster FQDN - which is `resource-name.resource-namespace.svc`.
108+
109+
It is also possible to define a static inventory - an example of how this would like is preserved in the pattern repository as [hosts](https://github.com/validatedpatterns/ansible-edge-gitops/blob/main/ansible/inventory/hosts).
110+
111+
A standard dynamic inventory script is available [here](https://github.com/validatedpatterns/ansible-edge-gitops/blob/main/ansible/inventory/openshift_cluster.yml). This will retrieve the object names, but it will not (currently) map the FQDN properly. Because of this limitation, we moved to using the inventory pre-play method.
112+
113+
## Templates (key playbooks in the pattern)
114+
115+
### [Dynamic Provision Kiosk Playbook](https://github.com/validatedpatterns/ansible-edge-gitops/blob/main/ansible/dynamic_kiosk_provision.yml)
116+
117+
This combines all three key workflows in this pattern:
118+
119+
* Dynamic inventory (inventory preplay)
120+
* Kiosk Mode
121+
* Podman Playbook
122+
123+
It is safe to run multiple times on the same system. It is run on a schedule, every 10 minutes, to demonstrate this.
124+
125+
### [Kiosk Mode Playbook](https://github.com/validatedpatterns/ansible-edge-gitops/blob/main/ansible/kiosk_playbook.yml)
126+
127+
This playbook runs the [kiosk_mode role](/patterns/ansible-edge-gitops/ansible-automation-platform/#roles-included-in-the-pattern).
128+
129+
### [Podman Playbook](https://github.com/validatedpatterns/ansible-edge-gitops/blob/main/ansible/podman_playbook.yml)
130+
131+
This playbook runs the [container_lifecycle role](/patterns/ansible-edge-gitops/ansible-automation-platform/#roles-included-in-the-pattern) with overrides suitable for the Ignition application container.
132+
133+
### [Ping Playbook](https://github.com/validatedpatterns/ansible-edge-gitops/blob/main/ansible/ping.yml)
134+
135+
This playbook is for testing basic connectivity - making sure that you can reach the nodes you wish to manage, and that the credentials you have given will work on them. It will not change anything on the VMs - just gather facts from them (which requires elevating to root).
136+
137+
## Schedules
138+
139+
### Update Project AEG GitOps
140+
141+
This job runs every 5 minutes to update the GitOps repository associated with the project. This is necessary when any of the Ansible code (for example, the playbooks or roles associated with the pattern) changes, so that the new code is available to the AAP instance.
142+
143+
### Dynamic Provision Kiosk Playbook
144+
145+
This job runs every 10 minutes to provision and configure any kiosks it finds to run the Ignition application in a podman container, and configure firefox in kiosk mode to display that application. The playbook is designed to be idempotent, so it is safe to run multiple times on the same targets; it will not make user-visible changes to those targets unless it must.
146+
147+
This playbook combines the [inventory_preplay](/patterns/ansible-edge-gitops/ansible-automation-platform/#extra-playbooks-in-the-pattern) and the [Provision Kiosk Playbook](/patterns/ansible-edge-gitops/ansible-automation-platform/#extra-playbooks-in-the-pattern).
148+
149+
## Execution Environment
150+
151+
The pattern includes an execution environment definition that can be found [here](https://github.com/validatedpatterns/ansible-edge-gitops/tree/main/ansible/execution_environment).
152+
153+
The execution environment includes some additional collections beyond what is provided in the Default execution environment, including:
154+
155+
* [fedora.linux_system_roles](https://linux-system-roles.github.io/)
156+
* [containers.podman](https://galaxy.ansible.com/containers/podman)
157+
* [community.okd](https://docs.ansible.com/ansible/latest/collections/community/okd/index.html)
158+
159+
The execution environment definition is provided if you want to customize or change it; if so, you should also change the Execution Environment attributes of the Templates (in the [load script](https://github.com/validatedpatterns/ansible-edge-gitops/blob/main/scripts/ansible_load_controller.sh), those attributes are set by the variables `aap_execution_environment` and `aap_execution_environment_image`).
160+
161+
## Roles included in the pattern
162+
163+
### [kiosk_mode](https://github.com/validatedpatterns/ansible-edge-gitops/tree/main/ansible/roles/kiosk_mode)
164+
165+
This role is responsible does the following:
166+
167+
* RHEL node registration
168+
* Installation of GUI packages
169+
* Installation of Firefox
170+
* Configuration of Firefox kiosk mode
171+
172+
### [container_lifecycle](https://github.com/validatedpatterns/ansible-edge-gitops/tree/main/ansible/roles/container_lifecycle)
173+
174+
This role is responsible for:
175+
176+
* Downloading and running a podman image on the system (and configure it to auto-update)
177+
* Setting the container up to run at boot time
178+
* Passing any other runtime arguments to the container. In this container's case, that includes specifying an admin password override.
179+
180+
## Extra Playbooks in the Pattern
181+
182+
### [inventory_preplay.yml](https://github.com/validatedpatterns/ansible-edge-gitops/blob/main/ansible/inventory_preplay.yml)
183+
184+
This playbook is designed to be included in other plays; its purpose is to discover the desired inventory and add those hosts to inventory at runtime. It uses a kubernetes query via the cluster-admin kube config file.
185+
186+
### [Provision Kiosk Playbook](https://github.com/validatedpatterns/ansible-edge-gitops/blob/main/ansible/provision_kiosk.yml)
187+
188+
This does the work of provisioning the kiosk, which configures kiosk mode, and also installs Ignition and configures it to start at boot. It runs the [kiosk_mode](/patterns/ansible-edge-gitops/ansible-automation-platform/#roles-included-in-the-pattern) and [container_lifecycle](/patterns/ansible-edge-gitops/ansible-automation-platform/#roles-included-in-the-pattern) roles.
189+
190+
# Next Steps
191+
192+
## [Help & Feedback](https://groups.google.com/g/validatedpatterns)
193+
## [Report Bugs](https://github.com/validatedpatterns/ansible-edge-gitops/issues)

0 commit comments

Comments
 (0)