the lab uses automated, prepopulated Variables for most of the ansible Playbooks
The Variables are assigned via Environment vars, loaded automatically by the “direnv” shell extension direnv
This perfectly Simulates a Pipeline approach, we Variables would be assigned from a Request Tool such as Snow, and Credentials provided via a Vault
Please make sure to use the assigned directories for the labs
ansible communicates with remote hosts (Inventory) using ssh / winrm. Remote host do not require ansible to be deployed, but do require Python. Python is already configured on the Remote Hosts in thr Lab.
Remote Hosts are treated as “Inventory”, that ansible will gather “Facts” from ( OS releated information, Network Software etc )
We can define our Inventory via Invetory Files. Most Likely, Inventory files are stored in a GitOps Structure. The Inventory Files are stored with the adjesent lab directories
windows: # <- a group of Hosts addressed as windows
children:
databasehosts: # <- a group of Hosts addressed as databasehosts
hosts:
sql01: # <- an indivisual Host adressed as sql01
sql02:
ansible_host: sql02.demo.local # <- an indivisual Host adressed as sql02. resolvable as sql02.demo.local
vars: # specific Vars for the Group Database Hosts
app_agent: ""
app_agent_product_id: '{165F48F4-38C4-49DF-904E-4A23D39078BF}'
filehosts:
hosts:
file:
vars:
app_agent: ""
app_agent_product_id: '{49C974B3-BA72-485C-9A96-794B065339DF}'
exchangehosts:
hosts:
exchange1:
exchange2:
vars:
app_agent: ""
app_agent_product_id: '{165F48F4-38C4-49DF-904E-4A23D39078BF}'
vars: # -> vars for all Windows Hosts
ansible_user: administrator
ansible_password: Password123!
ansible_winrm_scheme: https
ansible_winrm_server_cert_validation: ignore
ansible_shell_type: cmd
ansible_connection: winrm
git clone https://github.com/bob-builds-labs/0499.git ~/workspace/0499
changing to lab1 directory will load the required variables for lab1
cd ~/workspace/0499/lab1
direnv allow .
Make sure PPDM is Powered on and Running:
ansible-playbook ../playbooks/start_stop_vms_by_vm_names.yaml -e vm_names='ppdm-1' -e state=start
# govc equivalent:
# govc vm.power -on -vm.ipath="$(govc find / -type m -name ppdm-1)"
ansible-playbook ~/workspace/ansible_ppdm/100.0_list_agents.yml
ansible-playbook ~/workspace/ansible_ppdm/100.1_download_agents.yml
this will create a directory structure in /tmp by default ( destination can be changed with parameter -e “download_destination=/whereeveriam” )
as we will register the agents to ppdm using the fqdn, we need to enable DNS for Agents on the PPDM Host:
ansible-playbook ~/workspace/ansible_ppdm/100.2_set_dns_for_agents.yaml