{"id":19251241,"url":"https://github.com/rexops/rex-foreman","last_synced_at":"2026-06-18T17:32:59.595Z","repository":{"id":138907984,"uuid":"37714601","full_name":"RexOps/rex-foreman","owner":"RexOps","description":"Module to access hosts from foreman","archived":false,"fork":false,"pushed_at":"2017-08-16T12:24:39.000Z","size":13,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-23T16:48:40.046Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RexOps.png","metadata":{"files":{"readme":"README.pod","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-06-19T09:51:46.000Z","updated_at":"2022-01-04T18:04:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"e6474f9c-dd1b-4d53-ba44-fc32e59f210d","html_url":"https://github.com/RexOps/rex-foreman","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/RexOps/rex-foreman","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RexOps%2Frex-foreman","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RexOps%2Frex-foreman/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RexOps%2Frex-foreman/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RexOps%2Frex-foreman/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RexOps","download_url":"https://codeload.github.com/RexOps/rex-foreman/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RexOps%2Frex-foreman/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34501475,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-18T02:00:06.871Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T18:21:15.952Z","updated_at":"2026-06-18T17:32:59.580Z","avatar_url":"https://github.com/RexOps.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"=pod\n\n=head1 NAME\n\nForeman - Read host information out of Foreman.\n\nWith this module you can retrieve hosts and host parameter from Foreman. You can create dynamic groups out of these hosts.\n\n=head1 SYNOPSIS\n\n use Foreman;\n\n my $foreman = Foreman-\u003enew(\n   url      =\u003e \"https://foreman.your-domain.tld\",\n   user     =\u003e \"foreman-user\",\n   password =\u003e \"foreman-password\",\n );\n\n group frontends =\u003e $foreman-\u003eget_hosts(environment =\u003e \"stage\", service =\u003e \"shop\");\n\n=head1 METHODS\n\n=over 4\n\n=item get_hosts(%query_options)\n\nThe I\u003cget_hosts()\u003e method will construct a search query with the given key =\u003e value parameters and send it to foreman. The returning data will be converted in an array. Every Array-Item is an object of the type I\u003cForeman::Server\u003e. This object can just be passed on to the I\u003cgroup()\u003e function.\n\nIf you store the authentication settings inside Foreman you can modify these data inside the I\u003cForeman::Server\u003e object so that Rex knows which login and password to use.\n\n my $foreman = Foreman-\u003enew(\n   url      =\u003e \"https://foreman.your-domain.tld\",\n   user     =\u003e \"foreman-user\",\n   password =\u003e \"foreman-password\",\n   modify_host_options =\u003e sub {\n    my ($foreman, $server) = @_;\n    $server-\u003e{auth}-\u003e{user}      = $server-\u003e{deploy_user};\n    $server-\u003e{auth}-\u003e{password}  = decrypt($server-\u003e{deploy_password});\n    $server-\u003e{auth}-\u003e{auth_type} = $server-\u003e{auth_type};\n   },\n );\n\n\n=item get_host(host =\u003e \"hostname\")\n\nThis method will return a single host object (I\u003cForeman::Server\u003e).\n\n\n=item get_environments()\n\nThis method will return all environments Foreman is aware of. It will return a list of names.\n\n=item get_roles()\n\nThis method will return a list of roles Foreman knows (for example Puppet roles). In fact this method is querying Foreman for all known I\u003cpuppetclasses\u003e and return the ones which start with I\u003crole_\u003e.\n\n\n=item get_hostgroup_parameters(hostgroup =\u003e \"hostgroup-name\")\n\nThis method will return all parameters that are registered with a hostgroup.\n\n=item get_host_parameters(host =\u003e \"hostname\")\n\nThis method will return all host parameters that are registered with a host. It will also merge the hostgroup parameters.\n\n=back\n\n=head1 COPYRIGHT\n\nCopyright 2015 FILIADATA GmbH\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frexops%2Frex-foreman","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frexops%2Frex-foreman","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frexops%2Frex-foreman/lists"}