### Install and Start Podman (Intel Macs) Source: https://github.com/redhat-cop/agnosticd/blob/development/docs/Deploying_Using_Execution_Environments.adoc Installs Podman using Homebrew, initializes the Podman machine, starts it, and then pulls the AgnosticD execution environment image. This is an alternative to Docker for Intel Macs. ```sh brew install podman podman machine init podman machine start podman pull quay.io/agnosticd/ee-multicloud:latest ``` -------------------------------- ### Configure InstructLab Installation Variables (Shell) Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/collections/ansible_collections/agnosticd/ai/roles/setup_instructlab/README.adoc This snippet shows shell commands to set variables that control the InstructLab installation. These variables define repository URLs, user, installation paths, CUDA environment variables, and developer packages required for the setup. ```sh setup_instructlab_repo_url: "https://github.com/instructlab/instructlab" setup_instructlab_taxonomy_repo_url: "https://github.com/instructlab/taxonomy" setup_instructlab_user: "instruct" setup_instructlab_install_path_base: "/home/{{ setup_instructlab_user }}" # Change this to your path setup_instructlab_cuda_home: "/usr/local/cuda" setup_instructlab_cuda_lib_path: "/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64" setup_instructlab_developer_packages: - g++ - gcc - git - make - python3.11 ``` -------------------------------- ### Start Environment with Ansible Playbook Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/configs/satellite-vm/README.adoc This example shows how to start a managed environment using the Ansible playbook (`start.yml`). It includes passing configuration variables from a sample file (`sample_vars.yml`), secrets, and a `guid` to specify the target environment. The `ansible` command-line tool is a prerequisite. ```bash [user@desktop ~]$ cd agnosticd/ansible [user@desktop ~]$ ansible-playbook ./configs/satellite-vm/start.yml \ -e @./configs/satellite-vm/sample_vars.yml \ -e @~/secrets.yml \ -e guid=defaultguid ``` -------------------------------- ### Example OC Client Output Source: https://github.com/redhat-cop/agnosticd/blob/development/training/04_Middleware_on_OpenShift/05_01_Simple_Example_Lab.adoc This represents the typical output when the 'oc' command is executed after installation. It provides a brief overview of the client's capabilities and includes example commands for logging in, creating projects, and deploying applications. ```text OpenShift Client This client helps you develop, build, deploy, and run your applications on any OpenShift or Kubernetes cluster. It also includes the administrative commands for managing a cluster under the 'adm' subcommand. To familiarize yourself with OpenShift, login to your cluster and try creating a sample application: oc login mycluster.mycompany.com oc new-project my-example oc new-app django-psql-example oc logs -f bc/django-psql-example (...) ``` -------------------------------- ### MacOS Workstation Setup for OSP Sandbox Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/configs/osp-sandbox/README.adoc Instructions for setting up a MacOS workstation to deploy the OSP Sandbox. This involves installing Python via Homebrew, configuring the PATH, installing virtualenv and virtualenvwrapper, and setting up a Python virtual environment. ```bash # Install python brew install python # Make sure your path has this in it: PATH="/usr/local/opt/python/libexec/bin:/usr/local/bin:$PATH" # Make sure virtualenv and virtualenvwrapper are installed system wide pip install virtualenv pip install virtualenvwrapper # Add this to your .bashrc export WORKON_HOME=~/.virtualenvs [ -f /usr/local/bin/virtualenvwrapper.sh ] && source /usr/local/bin/virtualenvwrapper.sh # To start a new python virtual env mkvirtualenv venv-openstack # Activate virtual env workon venv-openstack # Clone repo and install python libraries git clone https://github.com/redhat-cop/agnosticd.git cd agnosticd pip install -r ./ansible/configs/ocp4-disconnected-ha-lab/files/macos_requirements.txt ``` -------------------------------- ### RHEL Workstation Setup for OSP Sandbox Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/configs/osp-sandbox/README.adoc Steps to prepare a Red Hat Enterprise Linux (RHEL) host for OSP Sandbox deployment. This includes system updates, package installations, cloning the repository, and setting up a Python virtual environment. ```bash sudo subscription-manager register sudo subscription-manager attach --pool= sudo subscription-manager repos --disable=* --enable rhel-7-server-optional-rpms \ --enable rhel-7-server-rpms --enable rhel-7-server-extras-rpms sudo yum update -y sudo yum install python-virtualenv git gcc git clone https://github.com/redhat-cop/agnosticd.git cd agnosticd git checkout disco-ocp4 virtualenv ~/venv-openstack source ~/venv-openstack/bin/activate pip install -r ./ansible/configs/ocp4-disconnected-ha-lab/files/admin_host_requirements.txt ``` -------------------------------- ### Example Playbook for Satellite Installation Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/roles/satellite-installation/README.adoc This example shows a playbook that utilizes the satellite-install role. It demonstrates how to specify variables either through a separate file (sample_vars.yml) or directly via the command line using the -e flag. The playbook also includes a dependency on the 'satellite-public-hostname' role. ```yaml - hosts: satellite.example.com vars_files: - sample_vars.yml roles: - satellite-public-hostname - satellite-install ``` -------------------------------- ### Example Satellite Configuration Variables Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/roles/satellite-installation/README.adoc This example demonstrates how to define variables for the satellite installation role. It includes required parameters like satellite version, administrator username, and password, along with optional firewall configurations for services and ports. It also shows how to control package updates and enable remote execution. ```yaml satellite_version: 6.7 satellite_admin: admin satellite_admin_password: password firewall_services: - ssh - RH-Satellite-6 firewall_ports: - 22/tcp - 80/tcp - 443/tcp update_packages: true ``` -------------------------------- ### Install Gitea on VM using Ansible Role Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/roles/gitea_vm_setup/README.md Example playbook demonstrating how to include and configure the `gitea_vm_setup` role. It specifies the role name and provides a variable for the Gitea database password, noting its irrelevance for SQLite. ```yaml - name: Install and configure Gitea on VM include_role: name: gitea_vm_setup vars: gitea_db_pasword: "{{ student_password }}" # shouldn't matter for sqlite3 ``` -------------------------------- ### Example Ansible Playbook for NVIDIA CUDA Setup Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/collections/ansible_collections/agnosticd/ai/roles/setup_nvidia_cuda/README.adoc An example Ansible playbook demonstrating how to include and execute the ai_setup_nvidia_cuda role. This playbook targets localhost, enables fact gathering, and uses privilege escalation (become: true) to run the role. ```yaml --- - name: Test EDA dispatcher hosts: localhost gather_facts: true become: true roles: - ai_setup_nvidia_cuda ``` -------------------------------- ### InstructLab Role Usage Example (YAML) Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/roles/ai_setup_ilab/README.adoc An example Ansible playbook demonstrating how to include and use the ai_setup_ilab role. This playbook targets localhost, enables gathering facts, requires privileged execution (become: true), and lists 'ai_setup_ilab' under the roles to be executed. ```yaml --- - name: Test EDA dispatcher hosts: localhost gather_facts: true become: true roles: - ai_setup_ilab ``` -------------------------------- ### InstructLab Role Inclusion Example (YAML) Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/roles/ai_setup_instructlab/README.adoc An example Ansible playbook demonstrating how to include and run the 'setup_instructlab' role. This playbook targets localhost, enables fact gathering, and uses privilege escalation (become: true) for the role execution. ```yaml --- - name: Test EDA dispatcher hosts: localhost gather_facts: true become: true roles: - setup_instructlab ``` -------------------------------- ### Deploy Configuration with Ansible Playbook Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/configs/smart-management/README.adoc This example shows how to deploy a configuration using an Ansible playbook. It utilizes the `ansible-playbook` command with `-e` flags to pass variable files for configuration and secrets, along with a GUID. Ensure you are in the `agnosticd/ansible` directory. ```bash [user@desktop ~]$ cd agnosticd/ansible [user@desktop ~]$ ansible-playbook main.yml \ -e @./configs/smart-management/sample_vars_osp.yml \ -e @~/secrets.yml \ -e guid= ``` -------------------------------- ### Install Ansible Navigator Prerequisites Source: https://github.com/redhat-cop/agnosticd/blob/development/docs/Deploying_Using_Execution_Environments.adoc This command installs the required Python packages for Ansible Builder, Ansible Runner, and Ansible Navigator using pip within the activated virtual environment. ```bash (ansible-navigator) [user@localhost venvs]$ pip3 install ansible-builder ansible-runner ansible-navigator ... Requirement already satisfied: lockfile>=0.10 in ./venvs/ansible-navigator/lib64/python3.11/site-packages (from python-daemon->ansible-runner) (0.12.2) Requirement already satisfied: types-setuptools>=57.0.0 in ./venvs/ansible-navigator/lib64/python3.11/site-packages (from requirements-parser->ansible-builder) (67.7.0.1) Requirement already satisfied: pycparser in ./venvs/ansible-navigator/lib64/python3.11/site-packages (from cffi>=1->onigurumacffi<2,>=1.1.0->ansible-navigator) (2.21) ``` -------------------------------- ### Example RC File for ClientVM Creation with wrapper.sh Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/configs/amq-messaging-foundations/README.adoc This is an example of an RC (resource configuration) file used with the `wrapper.sh` script to create a ClientVM. It defines core variables like GUID, region, and keyname, and includes an `ENVTYPE_ARGS` array to pass specific deployment arguments such as repository version, OS release, custom repository paths, and instance types. ```bash GUID=myclient REGION=us-east-1 KEYNAME=ocpkey ENVTYPE=ocp-clientvm HOSTZONEID='Z3IHLWJZOU9SRT' ENVTYPE_ARGS=( -e repo_version=3.9 -e osrelease=3.9.14 -e own_repo_path=http://admin.example.com/repos/ocp/3.9.14 -e docker_version=1.13.1 -e "clientvm_instance_type=t2.large" -e "subdomain_base_suffix=.example.opentlc.com" ) ``` -------------------------------- ### Pre-Software Tasks: SSH Key Creation and Host Configuration Source: https://github.com/redhat-cop/agnosticd/blob/development/training/03_Infrastructure/02_Advanced/03_Understanding_Main_File.adoc This section covers the initial setup before software deployment. It includes creating SSH keys, ensuring Windows hosts are excluded, configuring repositories and common files, setting environment keys, and configuring bastion hosts. ```yaml - name: PreSoftware flight-check hosts: localhost connection: local gather_facts: false become: false tags: - presoftware_flight_check tasks: - debug: msg: "Pre-Software checks completed successfully" - name: Configure all hosts with Repositories, Common Files and Set environment key hosts: - all:!windows become: true gather_facts: false tags: - common_tasks roles: - role: set-repositories when: repo_method is defined - role: common when: install_common | bool - role: set_env_authorized_key when: set_env_authorized_key | bool - name: Configuring Bastion Hosts hosts: bastions become: true gather_facts: false roles: - role: bastion when: install_bastion | bool tags: - bastion_tasks ``` -------------------------------- ### Install RHODS via OLM Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/roles_ocp_workloads/ocp4_workload_rhods_handson/files/README.md Installs a RHODS instance in an OpenShift cluster using the Operator Lifecycle Manager (OLM). It requires a specific catalog image URI. The default admin user is set to $USER, which can be customized in the setup script. ```shell ./setup.sh quay.io/modh/rhods-catalog:v1.1.1-58 ``` -------------------------------- ### Step 000: Pre Infrastructure Tasks Example Source: https://github.com/redhat-cop/agnosticd/blob/development/training/03_Infrastructure/02_Advanced/03_Understanding_Main_File.adoc Example of a 'Pre Infrastructure' step, which runs on localhost and gathers no facts. Its primary purpose is to set up essential elements before infrastructure provisioning, such as generating environment keys. ```yaml - name: Step 000 Pre Infrastructure hosts: localhost gather_facts: false become: false tags: - step001 - pre_infrastructure - generate_env_keys tasks: - debug: msg: "Step 000 Pre Infrastructure" ``` -------------------------------- ### Install OpenShift Pipelines Workload with AgnosticD Source: https://github.com/redhat-cop/agnosticd/blob/development/docs/Setup AgnosticD on Mac.adoc This script installs the OpenShift Pipelines workload onto an existing cluster. It requires the cluster's GUID, sandbox identifier, and the workload name. ```sh aad_workload create myguid sandboxXXXX.opentlc.com ocp4_workload_pipelines ``` -------------------------------- ### OC Client Installation using wget and tar Source: https://github.com/redhat-cop/agnosticd/blob/development/training/04_Middleware_on_OpenShift/05_01_Simple_Example_Lab.adoc This sequence of shell commands downloads the OpenShift OC client from a specified URL, extracts the archive, and makes the client available. It's a standard method for setting up the command-line interface for interacting with OpenShift clusters on Linux systems. ```sh mkdir .local cd .local mkdir bin cd bin wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-linux.tar.gz tar xvfz openshift-client-linux.tar.gz oc ``` -------------------------------- ### Example Ansible Playbook to Use setup_instructlab Role (YAML) Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/collections/ansible_collections/agnosticd/ai/roles/setup_instructlab/README.adoc This YAML playbook demonstrates how to include and run the 'setup_instructlab' Ansible role. It sets up a local host, enables fact gathering, and utilizes root privileges to execute the role, assuming the role is available in the expected Ansible path. ```yaml --- - name: Test EDA dispatcher hosts: localhost gather_facts: true become: true roles: - setup_instructlab ``` -------------------------------- ### Prepare RHEL 9 Image for PostgreSQL Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/roles_ocp_workloads/ocp4_workload_mad_roadshow_v2/postgresql-vm.md Commands to register a RHEL 9 system, install PostgreSQL, initialize the database, configure it for remote access, and set up a superuser and database. This involves using subscription-manager, dnf, systemctl, and psql. ```bash sudo subscription-manager register --org --activationkey sudo dnf install postgresql-server postgresql-setup --initdb sudo systemctl start postgresql.service sudo systemctl enable postgresql.service sudo -u postgres psql postgres CREATE USER redhat WITH SUPERUSER PASSWORD 'redhat'; CREATE DATABASE customers; \q sudo vi /var/lib/pgsql/data/postgresql.conf listen_addresses = '*' sudo vi /var/lib/pgsql/data/pg_hba.conf host all all 0.0.0.0/0 md5 host all all ::/0 md5 sudo systemctl restart postgresql.service history -c ``` -------------------------------- ### Ansible: Install and Start Nginx on Frontend Servers Source: https://context7.com/redhat-cop/agnosticd/llms.txt This Ansible playbook installs and starts the Nginx web server on frontend servers. It uses the 'yum' module for installation and the 'service' module to manage the Nginx service state. ```yaml --- - name: Install software on frontend servers hosts: frontend become: true tasks: - name: Install nginx yum: name: nginx state: present - name: Start nginx service: name: nginx state: started enabled: true ``` -------------------------------- ### Step 003: Pre Software Deploy Tasks Source: https://github.com/redhat-cop/agnosticd/blob/development/training/03_Infrastructure/02_Advanced/03_Understanding_Main_File.adoc This step outlines tasks to be performed before any software is deployed. It imports a pre-software configuration playbook based on the defined environment type. ```yaml - name: Pre Software import_playbook: "./configs/{{ env_type }}/pre_software.yml" tags: - step003 - pre_software - pre_software_tasks ``` -------------------------------- ### Environment Variables for Ansible Playbook Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/roles_ocp_workloads/ocp4_workload_integreatly/readme.adoc Example of environment variables required to execute the ocp4_workload_integreatly Ansible role. These variables define the target host, OpenShift username, Ansible user, workload name, and a unique identifier (GUID). ```sh TARGET_HOST="bastion.dev.openshift.opentlc.com" OCP_USERNAME="pamccart-redhat.com" ANSIBLE_USER="ec2-user" WORKLOAD="ocp4_workload_integreatly" GUID=1001 ``` -------------------------------- ### Step 005: Post Software Deploy Tasks Source: https://github.com/redhat-cop/agnosticd/blob/development/training/03_Infrastructure/02_Advanced/03_Understanding_Main_File.adoc This snippet defines tasks to be executed after the software deployment is complete. It imports a post-software configuration playbook for the current environment type and a completion callback playbook. ```yaml - import_playbook: "./configs/{{ env_type }}/post_software.yml" tags: - step005 - post_software - post_software_tasks - import_playbook: completion_callback.yml ``` -------------------------------- ### Software Deployment: Role Provisioning (Webservers) Source: https://github.com/redhat-cop/agnosticd/blob/development/training/03_Infrastructure/02_Advanced/03_Understanding_Main_File.adoc This snippet details the process of deploying roles onto webserver hosts. It checks if 'infra_workloads' are defined and then iterates through them, applying the specified roles with a 'provision' action. ```yaml --- - name: Step 004 Environment specific Software hosts: localhost gather_facts: false become: false tasks: - debug: msg: "Software tasks Started" - name: Deploy Roles if infra_workloads defined hosts: - webservers gather_facts: false run_once: false become: true tags: - infra_workloads tasks: - name: apply infra workloads roles on nodes when: - infra_workloads | default("") | length > 0 block: - name: Apply role "{{ workload_loop_var }}" on webservers include_role: name: "{{ workload_loop_var }}" vars: ACTION: "provision" loop: "{{ infra_workloads }}" loop_control: loop_var: workload_loop_var - name: Software flight-check hosts: localhost connection: local gather_facts: false become: false tags: - post_flight_check tasks: - debug: msg: "Software checks completed successfully" ``` -------------------------------- ### Setup AgnosticD Directory and Clone Repository Source: https://github.com/redhat-cop/agnosticd/blob/development/docs/Deploying_Using_Execution_Environments.adoc These commands create the necessary directories for AgnosticD's development environment and then clone the AgnosticD Git repository into the '~/development/' directory. ```bash # Set up AgnosticD mkdir -p ~/development/{tmp,secrets,vars} cd ~/development/ git clone git@github.com:redhat-cop/agnosticd.git cd agnosticd ``` -------------------------------- ### Main Deployment Playbook Examples (Bash) Source: https://context7.com/redhat-cop/agnosticd/llms.txt Execute the main AgnosticD deployment playbook using ansible-playbook. This allows for full infrastructure-to-application deployments with a five-phase workflow. It requires specifying variable files, environment type, cloud provider, and a unique identifier for the deployment. ```bash ansible-playbook ansible/main.yml \ -e @configs/base-infra/my_vars.yml \ -e @~/secrets/secrets-sandbox01.yaml \ -e env_type=base-infra \ -e guid=demo-01 \ -e cloud_provider=ec2 \ -e output_dir=/tmp/output_dir/demo-01 ansible-playbook ansible/main.yml \ -e @configs/ocp4-cluster/sample_vars_ec2.yml \ -e @~/secrets.yml \ -e env_type=ocp4-cluster \ -e cloud_provider=ec2 \ -e guid=ocp4-prod-01 ansible-playbook ansible/main.yml \ -e @configs/just-a-bunch-of-nodes/my_vars.yml \ -e @~/secret.yml \ -e env_type=just-a-bunch-of-nodes \ -e cloud_provider=osp \ -e guid=nodes-test-01 ``` -------------------------------- ### Ansible Debug Task Example (workload.yml) Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/roles_ocp_workloads/ocp4_workload_integreatly/readme.adoc Example debug task for the workload installation phase. It prints a confirmation message upon successful completion of the workload tasks. ```yaml debug: msg: "workload Tasks completed successfully." ``` -------------------------------- ### Destroy Environment with Ansible Playbook Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/configs/satellite-vm/README.adoc This example illustrates the process of destroying a managed environment using the Ansible playbook (`destroy.yml`). It requires passing configuration variables from `sample_vars.yml`, secrets, and a `guid` to identify the environment for destruction. The `ansible` command-line tool must be installed. ```bash [user@desktop ~]$ cd agnosticd/ansible [user@desktop ~]$ ansible-playbook ./configs/satellite-vm/destroy.yml \ -e @./configs/satellite-vm/sample_vars.yml \ -e @~/secrets.yml \ -e guid=defaultguid ``` -------------------------------- ### Example Ansible Playbook for Zabbix Client Role Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/roles/zabbix-client/README.adoc This playbook demonstrates how to apply the 'zabbix-client' role to specified hosts. It includes setting essential variables for Zabbix auto-registration and hostname configuration. The role handles the installation and setup of the Zabbix agent. ```yaml - name: Zabbix for nodes hosts: - nodes - infranodes gather_facts: true become: yes vars: zabbix_auto_registration_keyword: OCP Node #pass variable should be setup in env_secret_vars.yml: #zabbix_auto_registration_pass: PASS_SETUP_IN_ZABBIX_ACTIONS zabbix_hostname: "OCP {{ repo_version }} {{ guid }} - {{ ansible_hostname }}" roles: - { role: "zabbix-client" } tags: - env-specific - install_zabbix ``` -------------------------------- ### Install Ollama and Setup Systemd Service (YAML) Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/collections/ansible_collections/agnosticd/ai/roles/service_vm_ollama/README.adoc An example Ansible playbook demonstrating how to include and utilize the 'service_vm_ollama' role. This playbook shows the basic structure for setting up Ollama, including the systemd service, on a target host. ```yaml --- - name: Setup Ollama including systemd service hosts: localhost gather_facts: true become: true roles: - service_vm_ollama ``` -------------------------------- ### Set up Workstation for Ansible Builder Source: https://github.com/redhat-cop/agnosticd/blob/development/tools/execution_environments/readme.adoc This sequence sets up a Python virtual environment and installs necessary dependencies for using `ansible-builder`. It ensures that the build process has the required tools and libraries. ```shell mkdir -p ~/virtualenvs/ansible-builder python3 -mvenv ~/virtualenvs/ansible-builder . ~/virtualenvs/ansible-builder/bin/activate pip install --upgrade pip pip install -r requirements-ee.txt ``` -------------------------------- ### Install Docker Driver with pip (Bash) Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/roles/azure_ansible_execution_env/molecule/rhel/INSTALL.rst Installs the Molecule Docker driver using pip, a package installer for Python. This command requires Python 3 and pip to be installed on the system. It installs the 'molecule' package with the 'docker' extra, which includes the necessary components for the Docker driver. ```bash $ python3 -m pip install 'molecule[docker]' ``` -------------------------------- ### Example Workload Variables Configuration Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/roles_ocp_workloads/ocp4_workload_migration_training/readme.adoc This YAML snippet defines the necessary variables for configuring a workload deployment. It includes `cloud_provider`, `env_type`, `target_host`, a list of `ocp_workloads`, and optionally `ocp_username`, `guid`, and `become_override`. This file, typically named `workload_vars.yaml`, is used as input for the Ansible playbook. ```yaml cloud_provider: none env_type: ocp-workloads target_host: bastion.dev4.openshift.opentlc.com ocp_workloads: - ocp4_workload_migration_training #become_override: false # If the ocp-workload supports it, you should specify the OCP user: ocp_username: system:admin # Usually the ocp-workloads want a GUID also: guid: changeme ``` -------------------------------- ### Cloning AgnosticD Repository Source: https://github.com/redhat-cop/agnosticd/blob/development/training/02_Getting_Started/configure_your_mac.adoc Clones the AgnosticD project repository from GitHub to the local machine. This command fetches all project files, including playbooks and configurations, needed for local execution. ```shell $ git clone https://github.com/redhat-cop/agnosticd.git Cloning into 'agd-training'... remote: Enumerating objects: 20, done. remote: Counting objects: 100% (20/20), done. remote: Compressing objects: 100% (18/18), done. remote: Total 65811 (delta 4), reused 8 (delta 2), pack-reused 65791 Receiving objects: 100% (65811/65811), 67.32 MiB | 9.02 MiB/s, done. Resolving deltas: 100% (44708/44708), done. ``` -------------------------------- ### Example Playbook for AWX Deployment with awx_pod Role Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/roles/awx_pod/README.md This playbook demonstrates how to use the 'awx_pod' Ansible role to install and run an AWX server. It sets essential variables such as admin credentials, Podman directory, host port, and container state before importing the role. ```ansible - name: run AWX on host hosts: all tasks: - name: import awx_pod role to install it all vars: admin_user: admin admin_password: foobar awx_podman_dir: /tmp awx_host_port: 8052 container_state: running import_role: name: awx_pod ``` -------------------------------- ### Step 004: Software Deployment Source: https://github.com/redhat-cop/agnosticd/blob/development/training/03_Infrastructure/02_Advanced/03_Understanding_Main_File.adoc This section handles the deployment of software. It includes two import statements: one for environment-specific software configuration and another for a specific software playbook, dynamically chosen by the 'software_to_deploy' variable. ```yaml - name: Environment '{{ env_type }}' specific software playbook import_playbook: "./configs/{{ env_type }}/software.yml" tags: - step004 - deploy_software - name: Software Playbook '{{ software_to_deploy | d('none') }}' import_playbook: "./software_playbooks/{{ software_to_deploy | d('none') }}.yml" tags: - step004 - deploy_software ``` -------------------------------- ### Clean Up RHODS Environment Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/roles_ocp_workloads/ocp4_workload_rhods_handson/files/README.md Removes the RHODS installation and cleans up the associated environment from the OpenShift cluster. This script should be run to revert any changes made during the installation process. ```shell ./cleanup.sh ``` -------------------------------- ### Install virtualenv Source: https://github.com/redhat-cop/agnosticd/blob/development/docs/Deploying_Using_Execution_Environments.adoc Installs the virtualenv package using Homebrew. This tool is used to create isolated Python environments. ```sh brew install virtualenv ``` -------------------------------- ### Sample Vars YAML Configuration Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/configs/lb2384-binder/README.adoc This snippet shows an example of a `sample_vars.yml` file used for configuring the tap-workshop-binder. It includes essential variables like guid, env_type, and cloud_provider, demonstrating the structure for setting up environment-specific parameters. ```yaml --- guid: test-config-00 env_type: tap-workshop-binder cloud_provider: none ... ``` -------------------------------- ### Ansible Debug Task Example Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/roles_ocp_workloads/ocp4_workload_integreatly/readme.adoc Example of a debug task within an Ansible playbook, used for printing messages during execution. This specific example is from the pre_workload task file and confirms successful completion. ```yaml debug: msg: "pre_workload Tasks completed successfully." ``` -------------------------------- ### Azure Service Principal Authentication (az cli) Source: https://github.com/redhat-cop/agnosticd/blob/development/docs/Preparing_your_workstation.adoc Commands to log in to Azure, create a service principal, and log in using service principal credentials. This is the recommended authentication method. ```bash az login az ad sp create-for-rbac az login --service-principal -u -p --tenant ``` -------------------------------- ### Install Molecule with Docker Support using Pip Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/roles/systemli.apt_repositories/molecule/default/INSTALL.rst This command installs the Molecule package with the necessary dependencies for Docker integration. It assumes you have pip available and are following standard Python package installation procedures. The '--user' flag is recommended if not using a virtual environment. ```bash $ pip install 'molecule[docker]' ``` -------------------------------- ### Ansible Playbook to Install Git Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/roles/geerlingguy.git/README.md This is a basic Ansible playbook example demonstrating how to include and use the geerlingguy.git role to install Git on target servers. ```yaml - hosts: servers roles: - { role: geerlingguy.git } ``` -------------------------------- ### Install Xcode Command Line Tools Source: https://github.com/redhat-cop/agnosticd/blob/development/docs/Setup AgnosticD on Mac.adoc Installs the command line developer tools for Xcode, which are required for various development tasks on macOS. This command should be run after installing Xcode from the App Store. ```shell xcode-select --install ``` -------------------------------- ### Install Prerequisites with Homebrew Source: https://github.com/redhat-cop/agnosticd/blob/development/docs/Setup AgnosticD on Mac.adoc Installs essential development tools including Python 3, virtualenv, jq, and OpenSSL 3 using the Homebrew package manager. Ensure Homebrew is installed before running this command. ```shell brew install python3 virtualenv jq openssl@3 rust ``` -------------------------------- ### Set up AgnosticD Working Environment Source: https://github.com/redhat-cop/agnosticd/blob/development/docs/Deploying_Using_Execution_Environments.adoc Creates the necessary directory structure for AgnosticD work and clones the AgnosticD repository from GitHub. This sets up the local project files. ```sh # Set up AgnosticD mkdir -p ~/Development/agnosticd-workdir cd ~/Development/ git clone git@github.com:redhat-cop/agnosticd.git ``` -------------------------------- ### Ansible Debug Task Example (post_workload.yml) Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/roles_ocp_workloads/ocp4_workload_integreatly/readme.adoc Example debug task for the post-workload configuration phase. It indicates successful completion of the configuration tasks. ```yaml debug: msg: "post_workload Tasks completed successfully." ``` -------------------------------- ### Freeze Python Dependencies to requirements.txt Source: https://github.com/redhat-cop/agnosticd/blob/development/training/02_Getting_Started/config_your_linux.adoc Captures a list of all installed Python packages and their versions into a 'requirements.txt' file. This is a common pattern for replicating the exact environment on another machine by running 'pip install -r requirements.txt'. ```shell pip freeze > requirements.txt ``` -------------------------------- ### Deploy Workload on OpenShift using Ansible Playbook Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/roles/ocp-workload-starter-workshop/readme.adoc This command demonstrates how to deploy a workload using the 'ocp-workload-starter-workshop' playbook. It specifies the target host, the playbook to run, and passes numerous environment variables to configure the deployment, such as user credentials, domains, and resource counts. This command assumes common environment variables are already exported. ```bash WORKLOAD="ocp-workload-starter-workshop" # a TARGET_HOST is specified in the command line, without using an inventory file ansible-playbook -i ${TARGET_HOST}, ./configs/ocp-workloads/ocp-workload.yml \ -e"ansible_ssh_private_key_file=~/.ssh/${SSH_PRIVATE_KEY}" \ -e"ansible_user=${SSH_USER}" \ -e"ocp_username=${OCP_USERNAME}" \ -e"ocp_workload=${WORKLOAD}" \ -e"guid=${GUID}" \ -e"ocp_user_needs_quota=true" \ -e"ocp_master=${MASTER_HOSTNAME}" \ -e"ocp_apps_domain=${APPS_DOMAIN}" \ -e"admin_project=${WORKSHOP_PROJECT}" \ -e"user_count=${NUM_USERS}" \ -e"user_password=${USER_PASSWORD}" \ -e"gogs_password=${GOGS_PASSWORD}" \ -e"ACTION=create" ``` -------------------------------- ### Install Ansible with Azure Support (pip) Source: https://github.com/redhat-cop/agnosticd/blob/development/docs/Preparing_your_workstation.adoc Installs or upgrades pip and then installs the Ansible package with Azure support. The `--force` flag is used due to a known issue. ```bash pip install --upgrade pip pip install --upgrade --force ansible[azure] ``` -------------------------------- ### Tower Installation Configuration Variables Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/roles/tower-installation/README.adoc This snippet defines the necessary variables for configuring the Ansible Tower installation. It includes parameters for version, hostname, administrator password, setup directory, inventory template, and options for installing tower-cli and awx command-line tools. Ensure all required variables are set correctly for a successful deployment. ```yaml tower_version: "3.7.0-4" tower_hostname: tower1.example.com tower_admin_password: changeme tower_setup_dir_path: /tmp tower_template_inventory: "./files/tower_inventory.j2" tower_install_tower_cli: true tower_additional_packages: - python - python-pip - python-devel - gcc tower_template_tower_cli: "./files/tower_cli.j2" tower_install_awx_cli: true tower_template_awx_cli: "./files/awx_cli.rc.j2" ``` -------------------------------- ### Install OpenStack Python Requirements Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/configs/osp-sandbox/README.adoc Installs the necessary Python libraries for interacting with OpenStack, specifically for the OSP sandbox environment. This step is crucial before performing OpenStack operations. ```bash sudo pip3 install -r $HOME/agnosticd/ansible/configs/osp-sandbox/files/openstack_requirements.txt ``` -------------------------------- ### AgnosticD Development Environment Setup (Bash) Source: https://github.com/redhat-cop/agnosticd/blob/development/ansible/configs/ent-demo-ate-binder/README.adoc Provides an example of how to set up a local development environment for AgnosticD using virtual environments and environment variables. This includes setting Ansible paths, log paths, and configuration files. ```bash # example of my `tok-env.sh`: export ANSIBLE_COLLECTIONS_PATH=/Users/tok/repos/agnosticd/repo/agnosticd/collections export ANSIBLE_LOG_PATH=/tmp/output_dir/ate-01 export ANSIBLE_CONFIG=tok-ansible.cfg export MAKEFILE=$(pwd)/ansible/configs/ent-demo-ate-base/Makefile # old legacy config alias mk="make -f $MAKEFILE " ``` -------------------------------- ### Install Python 3.9 Source: https://github.com/redhat-cop/agnosticd/blob/development/docs/Deploying_Using_Execution_Environments.adoc Installs Python version 3.9 using Homebrew. This ensures a specific Python version is available for the project's dependencies. ```sh brew install python@3.9 ``` -------------------------------- ### Step 002: Post Infrastructure Deploy Tasks Source: https://github.com/redhat-cop/agnosticd/blob/development/training/03_Infrastructure/02_Advanced/03_Understanding_Main_File.adoc This section is dedicated to tasks that should be executed after the main infrastructure has been deployed. It imports a playbook specific to the environment type for post-infrastructure configuration. ```yaml - import_playbook: "./configs/{{ env_type }}/post_infra.yml" tags: - step002 - post_infra - post_infra_tasks ```