{"id":13817224,"url":"https://github.com/hellojukay/ansible","last_synced_at":"2025-08-12T22:36:54.617Z","repository":{"id":140614942,"uuid":"106353777","full_name":"hellojukay/ansible","owner":"hellojukay","description":"介绍用 golang 编写 Ansible 插件","archived":false,"fork":false,"pushed_at":"2018-08-30T08:53:01.000Z","size":2982,"stargazers_count":16,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-13T04:52:44.307Z","etag":null,"topics":["ansible","ansible-modules","golang"],"latest_commit_sha":null,"homepage":"","language":"HTML","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/hellojukay.png","metadata":{"files":{"readme":"README.md","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}},"created_at":"2017-10-10T01:31:23.000Z","updated_at":"2023-02-13T08:59:42.000Z","dependencies_parsed_at":"2024-01-18T03:47:23.825Z","dependency_job_id":null,"html_url":"https://github.com/hellojukay/ansible","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/hellojukay/ansible","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellojukay%2Fansible","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellojukay%2Fansible/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellojukay%2Fansible/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellojukay%2Fansible/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hellojukay","download_url":"https://codeload.github.com/hellojukay/ansible/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellojukay%2Fansible/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270148081,"owners_count":24535693,"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","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"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":["ansible","ansible-modules","golang"],"created_at":"2024-08-04T06:00:37.471Z","updated_at":"2025-08-12T22:36:54.557Z","avatar_url":"https://github.com/hellojukay.png","language":"HTML","funding_links":[],"categories":["Misc"],"sub_categories":[],"readme":"# Ansible\n这个项目讲述了Ansible的基本使用方法，和开发自定义模块的方式和例子\n# 目录\n* [Ansible简介](./doc/introduction.md#desc)\n  * [Ansible的特点](./doc/introduction.md#tedian)\n  * [Hello World](./doc/introduction.md#helloworld)\n  * [安装方式](./doc/introduction.md#anzhuang)\n* [Hosts文件](./doc/hosts.md#hosts)\n  * [编写host文件](./doc/hosts.md#xiehosts)\n* [playbook](./doc/playbook.md#playbook)\n  * [helloworld](./doc/playbook.md#helloworld)\n  * [变量](./doc/playbook.md#bianliang)\n  * [条件](./doc/playbook.md#tiaojian)\n* [自定义模块](./doc/modeul.md#modeul)\n  * [参数](./doc/modeul.md#canshu)\n  * [返回值](./doc/modeul.md#fanhuizhi)\n  * [使用自定义模块](./doc/modeul.md#shiyon)\n* [Ansible配置](./doc/config.md)\n\n# demo\n这里编写一个名字叫做`fuck`的模块，他的功能是往标准输出里面输出`fuck`.\n```golang\npackage main\n\nimport (\n\t\"encoding/json\"\n)\n\n// Response 返回值的消息结构\ntype Response struct {\n\tChanged bool   `json:\"changed\"`\n\tFail    bool   `json:\"fail\"`\n\tMsg     string `json:\"msg\"`\n\tRC      int    `json:\"rc\"`\n}\n\nfunc main() {\n\tprintln(\"fuck\")\n\tvar res = Response{\n\t\tChanged: false,\n\t\tFail:    false,\n\t\tMsg:     \"\",\n\t\tRC:      0,\n\t}\n\tbuf, _ := json.Marshal(res)\n\tprintln(string(buf))\n}\n```\n编译之后放在模块的目录中\n```shell\nmac-pro:res jukay$ ansible dev -m fuck -u root\n39.106.10.228 | SUCCESS =\u003e {\n    \"changed\": false,\n    \"fail\": false,\n    \"msg\": \"\",\n    \"rc\": 0\n}\nmac-pro:res jukay$\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellojukay%2Fansible","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhellojukay%2Fansible","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellojukay%2Fansible/lists"}