{"id":15089148,"url":"https://github.com/nomakcooper/svcs_attr_facts","last_synced_at":"2026-01-05T04:34:52.477Z","repository":{"id":251292240,"uuid":"836958458","full_name":"NomakCooper/svcs_attr_facts","owner":"NomakCooper","description":"Ansible Custom Module svcs_attr_facts. athers facts about Solaris SMF attribute for a specific services by svcs.","archived":false,"fork":false,"pushed_at":"2025-02-05T07:08:51.000Z","size":71,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-21T14:17:29.065Z","etag":null,"topics":["ansible-module","facts","python","solaris-10","solaris-11","svcs","yaml"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NomakCooper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-08-01T23:14:36.000Z","updated_at":"2025-02-05T07:08:55.000Z","dependencies_parsed_at":"2024-08-02T01:53:48.400Z","dependency_job_id":"cb781301-595c-43a8-8bb4-7114ea2a2998","html_url":"https://github.com/NomakCooper/svcs_attr_facts","commit_stats":{"total_commits":18,"total_committers":1,"mean_commits":18.0,"dds":0.0,"last_synced_commit":"a1a4b0ab52ca7e1fff8f41597b830060cee6c4f1"},"previous_names":["nomakcooper/svcs_attr_facts"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NomakCooper%2Fsvcs_attr_facts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NomakCooper%2Fsvcs_attr_facts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NomakCooper%2Fsvcs_attr_facts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NomakCooper%2Fsvcs_attr_facts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NomakCooper","download_url":"https://codeload.github.com/NomakCooper/svcs_attr_facts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244811374,"owners_count":20514276,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["ansible-module","facts","python","solaris-10","solaris-11","svcs","yaml"],"created_at":"2024-09-25T08:41:17.115Z","updated_at":"2026-01-05T04:34:52.429Z","avatar_url":"https://github.com/NomakCooper.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cmeta name=\"author\" content=\"Marco Noce\"\u003e\n\u003cmeta name=\"description\" content=\"Gathers facts about Solaris SMF attribute for a specific services by svcs.\"\u003e\n\u003cmeta name=\"copyright\" content=\"Marco Noce 2024\"\u003e\n\u003cmeta name=\"keywords\" content=\"ansible, module, solaris, svcs, attribute, smf, service\"\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n![Ansible Custom Module][ansible-shield]\n![Oracle Solaris][solaris-shield]\n![python][python-shield]\n![license][license-shield]\n\n\u003c/div\u003e\n\n\n### svcs_attr_facts ansible custom module\n#### Gathers facts about Solaris SMF attribute for a specific services by svcs.\n\n#### Description :\n\n\u003cb\u003esvcs_attr_facts\u003c/b\u003e is a custom module for ansible that creates an ansible_facts containing the attribute list of specific SMF services on a SunOS/Oracle Solaris host\n\n#### Repo files:\n\n```\n├── /library                \n│   └── svcs_attr_facts.py   ##\u003c-- python custom module\n└── svcs_attr.yml            ##\u003c-- ansible playbook example\n```\n\n#### Requirements :\n\n*  This module supports SunOS/Oracle Solaris only\n*  The SMF services info are gathered from the [svcs] command\n\n#### Parameters :\n\n|Parameter|Type  |Required|Sample                      |Comment                                                                                                                 |\n|---------|------|--------|----------------------------|------------------------------------------------------------------------------------------------------------------------|\n|fmri     |string|True    |\"svc:/network/smtp:sendmail\"|The FMRI of the service instance                                                                                        |\n|alias    |string|True    |\"sendmail\"                  |Service alias, a name of your choice which will then be automatically assigned to the dict object name ( sendmail_attr )|\n\n#### Attributes :\n\n|Attribute |Support|Description                                                                         |\n|----------|-------|------------------------------------------------------------------------------------|\n|check_mode|full   |Can run in check_mode and return changed status prediction without modifying target.|\n|facts     |full   |Action returns an ansible_facts dictionary that will update existing host facts.    |\n\n#### Examples :\n\n#### Tasks\n```yaml\n---\n- name: Gather attribute of sendmail fmri\n  svcs_attr_facts:\n    fmri: \"svc:/network/smtp:sendmail\"\n    alias: sendmail\n\n- name: set fact for print\n  set_fact:\n    sendmail_state: \"{{ ansible_facts.sendmail_attr| map(attribute='state') | first }}\"\n    sendmail_logfile: \"{{ ansible_facts.sendmail_attr| map(attribute='logfile') | first }}\"\n\n- name: print state and logfile attribute of sendmail service\n  debug:\n    msg: \"sendmail service is {{sendmail_state}}. Check logfile {{sendmail_logfile}} for info.\"\n\n```\n#### 'alias'_attr facts:\n```json\n  \"ansible_facts\": {\n    \"sendmail_attr\": [\n      {\n        \"fmri\": \"svc:/network/smtp:sendmail\",\n        \"name\": \"sendmail SMTP mail transfer agent\",\n        \"enabled\": \"true\",\n        \"state\": \"online\",\n        \"next_state\": \"none\",\n        \"state_time\": \"August  1, 2024 at  6:34:29 PM CEST\",\n        \"logfile\": \"/var/svc/log/network-smtp:sendmail.log\",\n        \"restarter\": \"svc:/system/svc/restarter:default\",\n        \"contract_id\": \"133 \",\n        \"manifest\": \"/lib/svc/manifest/network/smtp-sendmail.xml\",\n        \"dependency1\": \"optional_all/none svc:/system/filesystem/autofs (online)\",\n        \"dependency2\": \"require_all/refresh file://localhost/etc/mail/sendmail.cf (online)\",\n        \"dependency3\": \"require_all/refresh file://localhost/etc/nsswitch.conf (online)\",\n        \"dependency4\": \"require_all/none svc:/system/filesystem/local (online)\",\n        \"dependency5\": \"optional_all/refresh svc:/system/identity:domain (online)\",\n        \"dependency6\": \"require_all/refresh svc:/milestone/name-services (online)\",\n        \"dependency7\": \"require_all/none svc:/network/service (online)\",\n        \"dependency8\": \"optional_all/none svc:/system/system-log (multiple)\"\n      }\n    ]\n  },\n```\n#### debug output from example :\n```\nTASK [print state and logfile attribute of sendmail service] *****************************************\nok: [sol11host] =\u003e {\n    \"msg\": \"sendmail service is online. Check logfile /var/svc/log/network-smtp:sendmail.log for info.\"\n}\n```\n#### Returned Facts :\n\n*  Facts returned by this module are added/updated in the hostvars host facts and can be referenced by name just like any other host fact. They do not need to be registered in order to use them.\n*  Attributes change according to the service selected\n\n|Key          |Type  |Description                                                                            |Returned|Sample                                                    |\n|-------------|------|---------------------------------------------------------------------------------------|--------|----------------------------------------------------------|\n|'alias'_attr |list / elements=string|SMF Service attribute list                                                      |        |                                                          |\n|fmri         |string|The FMRI of the service instance.                                                      |always  |\"svc:/network/smtp:sendmail\"                              |\n|name         |string|The complite name of service.                                                          |always  |\"sendmail SMTP mail transfer agent\"                       |\n|enabled      |string|If the service instance is enabled or disabled.                                        |always  |\"true\"                                                    |\n|state        |string|The current state of service instance.                                                 |always  |\"online\"                                                  |\n|next_state   |string|The next state of the service.                                                         |always  |\"none\"                                                    |\n|state_time   |string|Date and time of the last transaction of the current status.                           |always  |\"August  1, 2024 at  6:34:29 PM CEST\"                     |\n|logfile      |string|The log file of service instance.                                                      |always  |\"/var/svc/log/network-smtp:sendmail.log\"                  |\n|restarter    |string|The master restarter daemon for SMF.                                                   |always  |\"svc:/system/svc/restarter:default\"                       |\n|contract_id  |string|The primary contract ID for the service instance.                                      |always  |\"133 \"                                                    |\n|manifest     |string|The .xml manifest file of the service instance.                                        |always  |\"/lib/svc/manifest/network/smtp-sendmail.xml\"             |\n|dependency(n)|string|The dependency service. ( the number of dependencies changes according to the service )|always  |\"optional_all/none svc:/system/filesystem/autofs (online)\"|\n\n## SANITY TEST\n\n* Ansible sanity test is available in [SANITY.md] file\n\n## Integration\n\n1. Assuming you are in the root folder of your ansible project.\n\nSpecify a module path in your ansible configuration file.\n\n```shell\n$ vim ansible.cfg\n```\n```ini\n[defaults]\n...\nlibrary = ./library\n...\n```\n\nCreate the directory and copy the python modules into that directory\n\n```shell\n$ mkdir library\n$ cp path/to/module library\n```\n\n2. If you use Ansible AWX and have no way to edit the control node, you can add the /library directory to the same directory as the playbook .yml file\n\n```\n├── root repository\n│   ├── playbooks\n│   │    ├── /library                \n│   │    │   └── svcs_attr_facts.py      ##\u003c-- python custom module\n│   │    └── your_playbook.yml           ##\u003c-- you playbook\n```   \n\n[ansible-shield]: https://img.shields.io/badge/Ansible-custom%20module-blue?style=for-the-badge\u0026logo=ansible\u0026logoColor=lightgrey\n[solaris-shield]: https://img.shields.io/badge/oracle-solaris-red?style=for-the-badge\u0026logo=oracle\u0026logoColor=red\n[python-shield]: https://img.shields.io/badge/python-blue?style=for-the-badge\u0026logo=python\u0026logoColor=yellow\n[license-shield]: https://img.shields.io/github/license/nomakcooper/svcs_attr_facts?style=for-the-badge\u0026label=LICENSE\n\n\n[svcs]: https://docs.oracle.com/cd/E86824_01/html/E54763/svcs-1.html\n[SANITY.md]: SANITY.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnomakcooper%2Fsvcs_attr_facts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnomakcooper%2Fsvcs_attr_facts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnomakcooper%2Fsvcs_attr_facts/lists"}