Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 6180

How to create GCP policy that will install ops-agent on all Ubuntu 22.04 VMs?

$
0
0

I'm trying to create a policy that will install ops-agent on all Ubuntu 22.04 automatically, so I've created this OS policy assignment and it seems it's been rolled out successfully but I still see my VMs as Non-compliant, what is that I'm doing wrong?
Command:gcloud compute os-config os-policy-assignments describe ops-agent-ubuntu-22-stag-os-policy --project=project-stag
Result:

baseline: trueinstanceFilter:  inventories:  - osShortName: ubuntu    osVersion: '22.04'name: projects/10777777778136/locations/europe-west1-b/osPolicyAssignments/ops-agent-ubuntu-22-stag-os-policyosPolicies:- id: ops-agent-ubuntu22-stag-os-policy1111111  mode: ENFORCEMENT  resourceGroups:  - inventoryFilters:    - osShortName: ubuntu-22.04    resources:    - exec:        enforce:          interpreter: SHELL          script: |            sudo bash add-google-cloud-ops-agent-repo.sh --uninstall             sudo bash add-google-cloud-ops-agent-repo.sh --also-install        validate:          interpreter: SHELL          script: |            sudo bash add-google-cloud-ops-agent-repo.sh --uninstall             sudo bash add-google-cloud-ops-agent-repo.sh --also-install      id: uninstall-existing-agent    - exec:        enforce:          interpreter: SHELL          script: sudo systemctl start google-cloud-ops-agent.target && exit 100        validate:          interpreter: SHELL          script: if (ps aux | grep 'opt[/].*google-cloud-ops-agent.*bin/'); then            exit 100; else exit 101; fi      id: ensure-agent-runningrevisionCreateTime: '2024-02-26T07:23:44Z'revisionId: fd1aa77c-4444-45ea-9e69-929678cf6b09rollout:  disruptionBudget:    percent: 10  minWaitDuration: 0srolloutState: SUCCEEDEDuid: 746d7ba2-07bd-44444-a466-8f298f2b7cfe


and when trying to check the reports it doesn't show any reason for the failure
Command:

gcloud compute os-config os-policy-assignment-reports describe ops-agent-ubuntu-22-stag-os-policy --instance=test-opsagent --location=europe-west1-b --project=project-stag

Result:

gcloud compute os-config os-policy-assignment-reports describe ops-agent-ubuntu-22-stag-os-policy --instance=test-opsagent --location=europe-west1-b --project=project-staginstance: test-opsagentlastRunId: ''name: projects/10777777778136/locations/europe-west1-b/instances/1924903941761499182/osPolicyAssignments/ops-agent-ubuntu-22-stag-os-policy/reportosPolicyAssignment: projects/10777777778136/locations/europe-west1-b/osPolicyAssignments/ops-agent-ubuntu-22-stag-os-policy@fd1aa77c-ad48-45ea-9e69-929678cf6b09osPolicyCompliances:- complianceState: NON_COMPLIANT  complianceStateReason: ''  osPolicyId: ops-agent-ubuntu22-stag-os-policy1111111updateTime: '2024-02-26T07:33:50.896031Z'

Viewing all articles
Browse latest Browse all 6180

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>