api-samples/ops-agent/one_simple_task_per_node.yaml (19 lines of code) (raw):

taskGroups: - taskSpec: runnables: - script: text: | # Check if Ops Agent is already installed if ! dpkg -l | grep google-cloud-ops-agent; then # Ops Agent is not installed, run the installation script curl -sSO https://dl.google.com/cloudagents/add-google-cloud-ops-agent-repo.sh sudo bash add-google-cloud-ops-agent-repo.sh --also-install else # Ops Agent is already installed, skip the installation echo "Ops Agent is already installed. Skipping installation." fi - script: text: "${FOLLOWING_SCRIPT}" allocationPolicy: instances: - policy: machineType: "e2-medium" logsPolicy: destination: "CLOUD_LOGGING"