{"id":18745796,"url":"https://github.com/moshloop/ansible-extras","last_synced_at":"2025-11-23T14:30:25.495Z","repository":{"id":138334067,"uuid":"142546033","full_name":"moshloop/ansible-extras","owner":"moshloop","description":null,"archived":false,"fork":false,"pushed_at":"2019-01-18T09:52:57.000Z","size":30,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-28T20:26:33.653Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/moshloop.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-27T07:50:32.000Z","updated_at":"2019-01-18T09:52:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"163307b1-5ac3-4518-8bb9-224f5c7ab9e0","html_url":"https://github.com/moshloop/ansible-extras","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moshloop%2Fansible-extras","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moshloop%2Fansible-extras/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moshloop%2Fansible-extras/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moshloop%2Fansible-extras/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moshloop","download_url":"https://codeload.github.com/moshloop/ansible-extras/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239627234,"owners_count":19670844,"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":[],"created_at":"2024-11-07T16:19:41.248Z","updated_at":"2025-11-23T14:30:25.444Z","avatar_url":"https://github.com/moshloop.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Filters\n\n| name                                          | description                                                  |\n| --------------------------------------------- | ------------------------------------------------------------ |\n| **dir_exists**(path)                          |                                                              |\n| **file_exists**(path)                         |                                                              |\n| **from_si_unit**(number, base_unit)            | Converts a SI unit e.g. 1GB into a number with an optional base\n| **is_empty**(val)                             |                                                              |\n| **jsonpath**(data)                            | transforms data using `jsonpath_rw`                           |\n| **map_to_entries**(dict, key, value)          | Convert a dict into a list of entries                        |\n| **nestedelement**(path)                       | Returns an nested element from an object tree by path (seperated by / or .) |\n| **play_groups**(play_hosts, groups, hostvars) | Returns a list of groups that are active within a play       |\n| **split**(string, separator=' ')              |                                                              |\n| **sub_map**(dict, prefix)                     | Filter a map by key prefix and remove prefix from keys       |\n| **to_map**(map, key, value)                   |                                                              |\n| **walk_up**(object, path)                     | Walks up an object tree from the lowest level collecting all attributes not available at lower levels |\n\n\n### dir_exists\n```python\nwhen: \"'/path/to/dir' | dir_exists\"\n```\n### file_exists\n```python\nwhen: \"'/path/to/file' | file_exists\"\n```\n\n### from_si_unit\n```python\n'1GB' | from_si_unit('MB') == 1024\n```\n### is_empty\n```python\n' ' | is_empty == true\n```\n### jsonpath\n### map_to_entries\n### nestedelement\n### play_groups\n### split\n```python\n'one two' | split == ['one', 'two']\n```\n### to_map\n### walk_up\n### sub_map\n\n```python\nsub_map({\n        \"elb.check\": \"/health\",\n        \"elb.port\": \"100\",\n        \"don.t\": \"match\"\n      }, \"elb.\") == {\"check\": \"/health\", \"port\": \"100\"}\n```\n\n## Modules\n\n#### cloudinit_iso\n\n**EXAMPLES**\n```yaml\n      - cloudinit_iso:\n          dest: \"{{playbook_dir}}/cloudinit.iso\"\n          user: |\n            #cloud-config\n            preserve_hostname: true\n            hostname: ansible-hostname\n            users:\n                - name: hostname\n```\n\n!!! Dependencies\n    `genisoimage`\n\n#### systemd_service\n\n| Option      | Default           | Required | Description                                               |\n| ----------- | ----------------- | -------- | --------------------------------------------------------- |\n| ExecStart   |                   | Yes      |                                                           |\n| Name        |                   | Yes      |                                                           |\n| Description |                   |          |                                                           |\n| Restart     | on-failure        |          |                                                           |\n| RunAs       | root              |          |                                                           |\n| ServiceArgs |                   |          | A dict of key values to add under the `[service]` section |\n| UnitArgs    |                   |          | A dict of key values to add under the `[unit]` section    |\n| WantedBy    | multi-user.target |          |                                                           |\n| state       | present           |          |                                                           |\n\n**EXAMPLES**\n```yaml\n  - hosts: all\n    roles:\n      - moshloop.systemd\n    tasks:\n        - systemd_service:\n            Name: test\n            ExecStart: \"/usr/bin/nc -l 200\"\n        - systemd_service:\n            Name: test\n            ExecStart: \"/usr/bin/nc -l 200\"\n            UnitArgs:\n                After: networking.service\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoshloop%2Fansible-extras","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoshloop%2Fansible-extras","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoshloop%2Fansible-extras/lists"}