Skip to content

(A) Basic PhotonOS Patterns

Brendan O'Connor edited this page Jan 17, 2024 · 32 revisions

Pattern A-01: The OVFtool Container

Step 1: using the master controller, navigate to the drop repo.

cd /usr/local/drop

Step 2: Verify the VMware-ovftool-4.4.3-18663434-lin.x86_64 bundle has been downloaded.

ls

Should return:

root@photon-machine [ /usr/local/drop ]# ls
VMware-ovftool-4.4.3-18663434-lin.x86_64.bundle

Step 3: build the ovftool container

cd /usr/local/e2e-patterns/photon/
sh build-e2e-pattern-ovftool.sh

Use the following syntax to test or run the ovftool

docker run ovftool --rm -it -v $PWD --help

Pattern A-02: The PowerCLI Container

  • Prerequisites: None.
  • Description: build powercli container.
  • Expected runtime: 1-2min

Step 1: using the master controller, navigate to the /usr/local/e2e-patterns/photon repo.

cd /usr/local/e2e-patterns/photon

Step 2: build the powercli container.

sh build-e2e-pattern-pcli.sh

To run the PowerCLI container interactively, run the following:

docker run --rm -it vmware/powerclicore

To run a PowerShell script, run the following (replace sample.ps1 with appropriate script name):

docker run --rm --entrypoint="/usr/bin/pwsh" -v ${PWD}:/tmp vmware/powerclicore /tmp/sample.ps1

NOTE: all PowerShell scripts need to begin with #!/bin/sh otherwise you will receive exec format error from Docker. For example: sample.ps1

#!/bin/sh
echo "Hello World!"

Pattern A-03: The Terraform Container

  • Prerequisites: None.
  • Description: build Terraform container.
  • Expected runtime: 1-2min

Step 1: using the master controller, navigate to the /usr/local/e2e-patterns/photon repo.

cd /usr/local/e2e-patterns/photon

Step 2: build the terraform container.

sh build-e2ep-terraform.sh

To run the Terraform container interactively, run the following:

docker run -i -t hashicorp/terraform --help

Create main.tf file in a dedicated directory on the Photon appliance and use the following syntax to initialize:

docker  run  -v $(pwd):$(pwd) -w $(pwd) -i -t hashicorp/terraform init

Pattern A-04: Kubernetes

Step 1: using the master controller, navigate to the /usr/local/e2e-patterns/minikube repo.

cd /usr/local/e2e-patterns/minikube

Step 2: build the minikube pattern on the Master Controller (small scale) using the -p parameter.

python3 build-e2ep-k8.py -p

Or build the minikube pattern on its own Photon Controller using the -a parameter.

python3 build-e2ep-k8.py -a

Step 3: validate kubectl

kubectl --help

Pattern A-05: The Ansible Container

  • Prerequisites: None.
  • Description: builds an Ansible container.
  • Expected runtime: 1-2min

Step 1: using the master controller, navigate to the /usr/local/e2e-patterns/photon repo.

cd /usr/local/e2e-patterns/photon

Step 2: build the ansible container.

sh build-e2ep-ansible.sh

To run the ansible container interactively, run the following:

docker run -i -t alpinelinux/ansible ansible --help

Pattern A-06: Build Photon template using OVFTool Container

Prerequisites:

Step 1: using the master controller, navigate to the /usr/local/e2e-patterns/photon repo:

cd /usr/local/e2e-patterns/photon

Step 2: deploy PhotonOS by running the following script

python3 build-e2ep-photon-with-ovftool.py VMNAME

Example:

python3 build-e2ep-photon-with-ovftool.py photonos-test-01

Pattern A-06A: Get VM IP Address using PowerCLI Container

Prereqisites:

Step 1: using the master controller, navigate to the /usr/local/e2e-patterns/photon repo:

cd /usr/local/e2e-patterns/photon

Step 2: get IP address by running the following script

python3 build-e2ep-get-vm-ip.py VMNAME

Example:

python3 build-e2ep-get-vm-ip.py photonos-test-01 

The IP Address for the provided virtual machine will appear in the _photonos.log.

Pattern A-06B: Change Default PhotonOS Password using PowerCLI Container

Prereqisites:

Step 1: using the master controller, navigate to the /usr/local/e2e-patterns/photon repo:

cd /usr/local/e2e-patterns/photon

Step 2: change the default password by running the following script

python3 build-e2ep-change-default-photonos-pw.py VMNAME NEWPASSWORD

Example:

python3 build-e2ep-change-default-photonos-pw.py photonos-test-01 VMware1VMware1

Pattern A-06C: Change VM IP Address using PowerCLI Container

Prerequisites:

Step 1: using the master controller, navigate to the /usr/local/e2e-patterns/photon repo:

cd /usr/local/e2e-patterns/photon

Step 2: change IP address by running the following script

python3 build-e2ep-change-photon-ip-address.py VMNAME IPADDRESS NETMASK DEFAULTGW

Example:

python3 build-e2ep-change-photon-ip-address.py photonos-test-01 172.16.0.85 255.255.255.0 172.16.0.1

Pattern A-06D: Run command over SSH to a remote Photon VM

In Progress

Pattern A-06E: Download script over SSH to a remote Photon VM

In Progress

Pattern A-06F: Run script over SSH to a remote Photon VM

In Progress

Clone this wiki locally