# Custodian OpenStack Support
Work in Progress - Not Ready For Use.
## Quick Start
### Installation
```
pip install c7n_openstack
```
### OpenStack Environment Configration
C7N will find cloud config for as few as 1 cloud and as many as you want to put in a config file.
It will read environment variables and config files, and it also contains some vendor specific default
values so that you don't have to know extra info to use OpenStack:
* If you have a config file, you will get the clouds listed in it
* If you have environment variables, you will get a cloud named envvars
* If you have neither, you will get a cloud named defaults with base defaults
Create a clouds.yml file:
```yaml
clouds:
demo:
region_name: RegionOne
auth:
username: 'admin'
password: XXXXXXX
project_name: 'admin'
domain_name: 'Default'
auth_url: 'https://montytaylor-sjc.openstack.blueboxgrid.com:5001/v2.0'
```
Please note: c7n will look for a file called `clouds.yaml` in the following locations:
* Current Directory
* ~/.config/openstack
* /etc/openstack
More information at [https://pypi.org/project/os-client-config](https://pypi.org/project/os-client-config)
### Create a c7n policy yaml file as follows:
```yaml
policies:
- name: demo
resource: openstack.flavor
filters:
- type: value
key: vcpus
value: 1
op: gt
```
### Run c7n and report the matched resources:
```sh
mkdir -p output
custodian run demo.yaml -s output
custodian report demo.yaml -s output --format grid
```
## Examples
filter examples:
```yaml
policies:
- name: test-flavor
resource: openstack.flavor
filters:
- type: value
key: vcpus
value: 1
op: gt
- name: test-project
resource: openstack.project
filters: []
- name: test-server-image
resource: openstack.server
filters:
- type: image
image_name: cirros-0.5.1
- name: test-user
resource: openstack.user
filters:
- type: role
project_name: demo
role_name: _member_
system_scope: false
- name: test-server-flavor
resource: openstack.server
filters:
- type: flavor
vcpus: 1
- name: test-server-age
resource: openstack.server
filters:
- type: age
op: lt
days: 1
- name: test-server-tags
resource: openstack.server
filters:
- type: tags
tags:
- key: a
value: a
- key: b
value: c
op: any
```
Raw data
{
"_id": null,
"home_page": "https://cloudcustodian.io",
"name": "c7n-openstack",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Cloud Custodian Project",
"author_email": null,
"download_url": null,
"platform": null,
"description": "# Custodian OpenStack Support\n\nWork in Progress - Not Ready For Use.\n\n## Quick Start\n\n### Installation\n\n```\npip install c7n_openstack\n```\n\n### OpenStack Environment Configration\n\nC7N will find cloud config for as few as 1 cloud and as many as you want to put in a config file.\nIt will read environment variables and config files, and it also contains some vendor specific default\nvalues so that you don't have to know extra info to use OpenStack:\n\n* If you have a config file, you will get the clouds listed in it\n* If you have environment variables, you will get a cloud named envvars\n* If you have neither, you will get a cloud named defaults with base defaults\n\nCreate a clouds.yml file:\n\n```yaml\nclouds:\n demo:\n region_name: RegionOne\n auth:\n username: 'admin'\n password: XXXXXXX\n project_name: 'admin'\n domain_name: 'Default'\n auth_url: 'https://montytaylor-sjc.openstack.blueboxgrid.com:5001/v2.0'\n```\n\nPlease note: c7n will look for a file called `clouds.yaml` in the following locations:\n\n* Current Directory\n* ~/.config/openstack\n* /etc/openstack\n\nMore information at [https://pypi.org/project/os-client-config](https://pypi.org/project/os-client-config)\n\n### Create a c7n policy yaml file as follows:\n\n```yaml\npolicies:\n- name: demo\n resource: openstack.flavor\n filters:\n - type: value\n key: vcpus\n value: 1\n op: gt\n```\n\n### Run c7n and report the matched resources:\n\n```sh\nmkdir -p output\ncustodian run demo.yaml -s output\ncustodian report demo.yaml -s output --format grid\n```\n\n## Examples\n\nfilter examples:\n\n```yaml\npolicies:\n- name: test-flavor\n resource: openstack.flavor\n filters:\n - type: value\n key: vcpus\n value: 1\n op: gt\n- name: test-project\n resource: openstack.project\n filters: []\n- name: test-server-image\n resource: openstack.server\n filters:\n - type: image\n image_name: cirros-0.5.1\n- name: test-user\n resource: openstack.user\n filters:\n - type: role\n project_name: demo\n role_name: _member_\n system_scope: false\n- name: test-server-flavor\n resource: openstack.server\n filters:\n - type: flavor\n vcpus: 1\n- name: test-server-age\n resource: openstack.server\n filters:\n - type: age\n op: lt\n days: 1\n- name: test-server-tags\n resource: openstack.server\n filters:\n - type: tags\n tags:\n - key: a\n value: a\n - key: b\n value: c\n op: any\n```\n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Cloud Custodian - OpenStack Provider",
"version": "0.1.25",
"project_urls": {
"Documentation": "https://cloudcustodian.io/docs/",
"Homepage": "https://cloudcustodian.io",
"Repository": "https://github.com/cloud-custodian/cloud-custodian"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "73a7727792fdc8ac0d659d27fedeaa613fe9f7296ceb09236a063e81fa90a517",
"md5": "d3dfad57276117c2d0326b6fb6c9b59f",
"sha256": "0c30f09475b6bce38cbfea7c52ef024daed11cdae40ad0c1edbf23670706fa35"
},
"downloads": -1,
"filename": "c7n_openstack-0.1.25-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d3dfad57276117c2d0326b6fb6c9b59f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 14108,
"upload_time": "2024-03-26T21:21:33",
"upload_time_iso_8601": "2024-03-26T21:21:33.037107Z",
"url": "https://files.pythonhosted.org/packages/73/a7/727792fdc8ac0d659d27fedeaa613fe9f7296ceb09236a063e81fa90a517/c7n_openstack-0.1.25-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-26 21:21:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cloud-custodian",
"github_project": "cloud-custodian",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "c7n-openstack"
}