Skip to content

Instantly share code, notes, and snippets.

@jeffreysbeckett
Created May 3, 2022 04:10
Show Gist options
  • Save jeffreysbeckett/32f8c9556a70f06a8598262ccdcbe6eb to your computer and use it in GitHub Desktop.
Save jeffreysbeckett/32f8c9556a70f06a8598262ccdcbe6eb to your computer and use it in GitHub Desktop.
output for oslogin
"os_policies": [
{
"allow_no_resource_group_match": false,
"description": "",
"id": "cloudops-policy",
"mode": "ENFORCEMENT",
"resource_groups": [
{
"inventory_filters": [],
"resources": [
{
"exec": [],
"file": [],
"id": "add-repo",
"pkg": [],
"repository": [
{
"apt": [],
"goo": [],
"yum": [
{
"base_url": "https://packages.cloud.google.com/yum/repos/google-cloud-ops-agent-el7-x86_64-all",
"display_name": "Google Cloud Ops Agent Repository",
"gpg_keys": [
"https://packages.cloud.google.com/yum/doc/yum-key.gpg",
"https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg"
],
"id": "google-cloud-ops-agent"
}
],
"zypper": []
}
]
},
{
"exec": [],
"file": [],
"id": "install-pkg",
"pkg": [
{
"apt": [],
"deb": [],
"desired_state": "INSTALLED",
"googet": [],
"msi": [],
"rpm": [],
"yum": [
{
"name": "google-cloud-ops-agent"
}
],
"zypper": []
}
],
"repository": []
},
{
"exec": [
{
"enforce": [
{
"args": [],
"file": [],
"interpreter": "SHELL",
"output_file_path": "",
"script": "sudo yum remove -y google-cloud-ops-agent || true; sudo yum install -y 'google-cloud-ops-agent-1.0.2*' \u0026\u0026 exit 100"
}
],
"validate": [
{
"args": [],
"file": [],
"interpreter": "SHELL",
"output_file_path": "",
"script": "if [[ $(rpm --query --queryformat '%{VERSION}\n' google-cloud-ops-agent) == '1.0.2' ]]; then exit 100; else exit 101; fi"
}
]
}
],
"file": [],
"id": "exec-script",
"pkg": [],
"repository": []
},
{
"exec": [
{
"enforce": [
{
"args": [],
"file": [],
"interpreter": "SHELL",
"output_file_path": "",
"script": "sudo systemctl start google-cloud-ops-agent.target \u0026\u0026 exit 100"
}
],
"validate": [
{
"args": [],
"file": [],
"interpreter": "SHELL",
"output_file_path": "",
"script": "if (ps aux | grep 'opt[/].*google-cloud-ops-agent.*bin/'); then exit 100; else exit 101; fi"
}
]
}
],
"file": [],
"id": "ensure-agent-running",
"pkg": [],
"repository": []
}
]
}
]
},
{
"allow_no_resource_group_match": false,
"description": "",
"id": "setup-repo-and-install-package-policy",
"mode": "ENFORCEMENT",
"resource_groups": [
{
"inventory_filters": [],
"resources": [
{
"exec": [],
"file": [],
"id": "setup-repo",
"pkg": [],
"repository": [
{
"apt": [],
"goo": [],
"yum": [
{
"base_url": "https://packages.cloud.google.com/yum/repos/google-cloud-monitoring-el8-x86_64-all",
"display_name": "Google Cloud Monitoring Agent Repository",
"gpg_keys": [
"https://packages.cloud.google.com/yum/doc/yum-key.gpg",
"https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg"
],
"id": "google-cloud-monitoring"
}
],
"zypper": []
}
]
},
{
"exec": [],
"file": [],
"id": "install-pkg",
"pkg": [
{
"apt": [],
"deb": [],
"desired_state": "INSTALLED",
"googet": [],
"msi": [],
"rpm": [],
"yum": [
{
"name": "stackdriver-agent"
}
],
"zypper": []
}
],
"repository": []
}
]
}
]
}
],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment