2.57. hammer 策略
操作策略
Usage: hammer policy [OPTIONS] SUBCOMMAND [ARG] ... Parameters: SUBCOMMAND Subcommand [ARG] ... Subcommand arguments Subcommands: create Create a Policy delete, destroy Delete a Policy hosts List all hosts info, show Show a Policy list, index List Policies update Update a Policy Options: -h, --help Print help
2.57.1. hammer 策略创建
创建策略
Usage: hammer policy create [OPTIONS] Options: --cron-line CRON_LINE Policy schedule cron line (only if period == “custom”) --day-of-month DAY_OF_MONTH Policy schedule day of month (only if period == “monthly”) --deploy-by DEPLOY_BY How the policy should be deployed Possible value(s): 'puppet', 'ansible', 'manual' --description DESCRIPTION Policy description --host-ids HOST_IDS Apply policy to hosts Comma separated list of values. Values containing comma should be quoted or escaped with backslash. JSON is acceptable and preferred way for complex parameters --hostgroup-ids HOSTGROUP_IDS Apply policy to host groups Comma separated list of values. Values containing comma should be quoted or escaped with backslash. JSON is acceptable and preferred way for complex parameters --hostgroups HOSTGROUP_NAMES Comma separated list of values. Values containing comma should be quoted or escaped with backslash. JSON is acceptable and preferred way for complex parameters --hosts HOST_NAMES Comma separated list of values. Values containing comma should be quoted or escaped with backslash. JSON is acceptable and preferred way for complex parameters --location LOCATION_NAME Name to search by --location-id LOCATION_ID Set the current location context for the request --location-ids LOCATION_IDS REPLACE locations with given ids Comma separated list of values. Values containing comma should be quoted or escaped with backslash. JSON is acceptable and preferred way for complex parameters --locations LOCATION_NAMES Comma separated list of values. Values containing comma should be quoted or escaped with backslash. JSON is acceptable and preferred way for complex parameters --name NAME Policy name --organization ORGANIZATION_NAME Name to search by --organization-id ORGANIZATION_ID Set the current organization context for the request --organization-ids ORGANIZATION_IDS REPLACE organizations with given ids. Comma separated list of values. Values containing comma should be quoted or escaped with backslash. JSON is acceptable and preferred way for complex parameters --organizations ORGANIZATION_NAMES Comma separated list of values. Values containing comma should be quoted or escaped with backslash. JSON is acceptable and preferred way for complex parameters --period PERIOD Policy schedule period (weekly, monthly, custom) --scap-content SCAP_CONTENT_TITLE SCAP content title --scap-content-id SCAP_CONTENT_ID Policy SCAP content ID --scap-content-profile SCAP_CONTENT_PROFILE_NAME Name to search by --scap-content-profile-id SCAP_CONTENT_PROFILE_ID Policy SCAP content profile ID --tailoring-file TAILORING_FILE_NAME Tailoring file name --tailoring-file-id TAILORING_FILE_ID Tailoring file ID --tailoring-file-profile-id TAILORING_FILE_PROFILE_ID Tailoring file profile ID --weekday WEEKDAY Policy schedule weekday (only if period == “weekly”) -h, --help Print help
2.57.2. hammer 策略删除
删除策略
Usage: hammer policy <delete|destroy> [OPTIONS] Options: --id ID --location LOCATION_NAME Set the current location context for the request --location-id LOCATION_ID Set the current location context for the request --location-title LOCATION_TITLE Set the current location context for the request --name NAME Name to search by --organization ORGANIZATION_NAME Set the current organization context for the request --organization-id ORGANIZATION_ID Set the current organization context for the request --organization-title ORGANIZATION_TITLE Set the current organization context for the request -h, --help Print help
2.57.3. hammer 策略主机
列出所有主机
Usage: hammer policy hosts [OPTIONS] Options: --fields FIELDS Show specified fields or predefined field sets only. (See below) Comma separated list of values. Values containing comma should be quoted or escaped with backslash. JSON is acceptable and preferred way for complex parameters --hostgroup HOSTGROUP_NAME Hostgroup name --hostgroup-id HOSTGROUP_ID ID of host group --hostgroup-title HOSTGROUP_TITLE Hostgroup title --id ID Policy Id --include INCLUDE Array of extra information types to include Possible value(s): 'parameters', 'all_parameters' --location LOCATION_NAME Set the current location context for the request --location-id LOCATION_ID ID of location --location-title LOCATION_TITLE Set the current location context for the request --name NAME Policy name --order ORDER Sort field and order, eg. ‘id DESC’ --organization ORGANIZATION_NAME Set the current organization context for the request --organization-id ORGANIZATION_ID ID of organization --organization-title ORGANIZATION_TITLE Set the current organization context for the request --page PAGE Page number, starting at 1 --per-page PER_PAGE Number of results per page to return, 'all' to return all results --puppet-environment PUPPET_ENVIRONMENT_NAME Puppet environment name --puppet-environment-id PUPPET_ENVIRONMENT_ID --search SEARCH Filter results --thin THIN Only list ID and name of hosts One of true/false, yes/no, 1/0. -h, --help Print help Predefined field sets: -----------------------|-----|---------|----- FIELDS | ALL | DEFAULT | THIN -----------------------|-----|---------|----- Id | x | x | x Name | x | x | x Operating system | x | x | Host group | x | x | Ip | x | x | Mac | x | x | Global status | x | x | Organization | x | | Location | x | | Additional information | x | | Content view | x | x | Lifecycle environment | x | x | Security | x | | Bugfix | x | | Enhancement | x | | Trace status | x | x | -----------------------|-----|---------|----- Search / Order fields: activation_key string activation_key_id string addon string addons_status Values: mismatched, matched, not_specified ansible_role string applicable_errata string applicable_errata_issued date applicable_rpms string architecture string autoheal boolean boot_time build Values: true, false class string comment text compute_resource string compute_resource_id integer config_group string content_source string content_view string content_view_id integer created_at datetime cve_id integer domain string domain_id integer environment string errata_status Values: security_needed, errata_needed, updated, unknown execution_status Values: ok, error facts string global_status Values: ok, warning, error has_ip string has_mac string hostgroup string hostgroup_fullname string hostgroup_id integer hostgroup_name string hostgroup_title string hypervisor boolean hypervisor_host string id integer image string insights_recommendations_count integer installable_errata string installed_at datetime ip string job_invocation.id string job_invocation.result Values: cancelled, failed, pending, success last_checkin datetime last_report datetime lifecycle_environment string lifecycle_environment_id integer location string location_id integer mac string managed Values: true, false model string name string organization string organization_id integer origin string os string os_description string os_id integer os_major string os_minor string os_title string owner string owner_id integer owner_type string params string params_name string parent_hostgroup string puppet_ca string puppet_proxy_id integer puppetmaster string purpose_status Values: mismatched, matched, not_specified realm string realm_id integer registered_at datetime registered_through string release_version string reported.boot_time reported.cores reported.disks_total reported.ram reported.sockets reported.virtual role text role_status Values: mismatched, matched, not_specified service_level string sla_status Values: mismatched, matched, not_specified smart_proxy string status.applied integer status.enabled Values: true, false status.failed integer status.failed_restarts integer status.interesting Values: true, false status.pending integer status.restarted integer status.skipped integer subnet string subnet.name text subnet6 string subnet6.name text subscription_id string subscription_name string subscription_status Values: valid, partial, invalid, unknown, disabled, unsubscribed_hypervisor subscription_uuid string trace_status Values: reboot_needed, process_restart_needed, updated upgradable_rpms string usage text usage_status Values: mismatched, matched, not_specified user.firstname string user.lastname string user.login string user.mail string usergroup string usergroup.name string uuid string
2.57.4. hammer 策略信息
显示策略
Usage: hammer policy <info|show> [OPTIONS] Options: --fields FIELDS Show specified fields or predefined field sets only. (See below) Comma separated list of values. Values containing comma should be quoted or escaped with backslash. JSON is acceptable and preferred way for complex parameters --id ID --location LOCATION_NAME Set the current location context for the request --location-id LOCATION_ID Set the current location context for the request --location-title LOCATION_TITLE Set the current location context for the request --name NAME Name to search by --organization ORGANIZATION_NAME Set the current organization context for the request --organization-id ORGANIZATION_ID Set the current organization context for the request --organization-title ORGANIZATION_TITLE Set the current organization context for the request -h, --help Print help Predefined field sets: --------------------------|-----|---------|----- FIELDS | ALL | DEFAULT | THIN --------------------------|-----|---------|----- Id | x | x | x Name | x | x | x Created at | x | x | Period | x | x | Weekday | x | x | Day of month | x | x | Cron line | x | x | Scap content id | x | x | Scap content profile id | x | x | Tailoring file id | x | x | Tailoring file profile id | x | x | Deployment option | x | x | Locations/ | x | x | Organizations/ | x | x | Hostgroups/ | x | x | --------------------------|-----|---------|-----
2.57.5. hammer 策略列表
列出策略
Usage: hammer policy <list|index> [OPTIONS] Options: --fields FIELDS Show specified fields or predefined field sets only. (See below) Comma separated list of values. Values containing comma should be quoted or escaped with backslash. JSON is acceptable and preferred way for complex parameters --location LOCATION_NAME Set the current location context for the request --location-id LOCATION_ID Set the current location context for the request --location-title LOCATION_TITLE Set the current location context for the request --order ORDER Sort field and order, eg. ‘id DESC’ --organization ORGANIZATION_NAME Set the current organization context for the request --organization-id ORGANIZATION_ID Set the current organization context for the request --organization-title ORGANIZATION_TITLE Set the current organization context for the request --page PAGE Page number, starting at 1 --per-page PER_PAGE Number of results per page to return, 'all' to return all results --search SEARCH Filter results -h, --help Print help Predefined field sets: -----------|-----|---------|----- FIELDS | ALL | DEFAULT | THIN -----------|-----|---------|----- Id | x | x | x Name | x | x | x Created at | x | x | -----------|-----|---------|----- Search / Order fields: content string location string location_id integer name string organization string organization_id integer profile string tailoring_file string tailoring_file_profile string
2.57.6. hammer 策略更新
更新策略
Usage: hammer policy update [OPTIONS] Options: --cron-line CRON_LINE Policy schedule cron line (only if period == “custom”) --day-of-month DAY_OF_MONTH Policy schedule day of month (only if period == “monthly”) --deploy-by DEPLOY_BY How the policy should be deployed Possible value(s): 'puppet', 'ansible', 'manual' --description DESCRIPTION Policy description --host-ids HOST_IDS Apply policy to hosts Comma separated list of values. Values containing comma should be quoted or escaped with backslash. JSON is acceptable and preferred way for complex parameters --hostgroup-ids HOSTGROUP_IDS Apply policy to host groups Comma separated list of values. Values containing comma should be quoted or escaped with backslash. JSON is acceptable and preferred way for complex parameters --hostgroups HOSTGROUP_NAMES Comma separated list of values. Values containing comma should be quoted or escaped with backslash. JSON is acceptable and preferred way for complex parameters --hosts HOST_NAMES Comma separated list of values. Values containing comma should be quoted or escaped with backslash. JSON is acceptable and preferred way for complex parameters --id ID --location LOCATION_NAME Name to search by --location-id LOCATION_ID Set the current location context for the request --location-ids LOCATION_IDS REPLACE locations with given ids Comma separated list of values. Values containing comma should be quoted or escaped with backslash. JSON is acceptable and preferred way for complex parameters --locations LOCATION_NAMES Comma separated list of values. Values containing comma should be quoted or escaped with backslash. JSON is acceptable and preferred way for complex parameters --name NAME Policy name --new-name NEW_NAME Policy name --organization ORGANIZATION_NAME Name to search by --organization-id ORGANIZATION_ID Set the current organization context for the request --organization-ids ORGANIZATION_IDS REPLACE organizations with given ids. Comma separated list of values. Values containing comma should be quoted or escaped with backslash. JSON is acceptable and preferred way for complex parameters --organizations ORGANIZATION_NAMES Comma separated list of values. Values containing comma should be quoted or escaped with backslash. JSON is acceptable and preferred way for complex parameters --period PERIOD Policy schedule period (weekly, monthly, custom) --scap-content SCAP_CONTENT_TITLE SCAP content title --scap-content-id SCAP_CONTENT_ID Policy SCAP content ID --scap-content-profile SCAP_CONTENT_PROFILE_NAME Name to search by --scap-content-profile-id SCAP_CONTENT_PROFILE_ID Policy SCAP content profile ID --tailoring-file TAILORING_FILE_NAME Tailoring file name --tailoring-file-id TAILORING_FILE_ID Tailoring file ID --tailoring-file-profile-id TAILORING_FILE_PROFILE_ID Tailoring file profile ID --weekday WEEKDAY Policy schedule weekday (only if period == “weekly”) -h, --help Print help