{"id":15680881,"url":"https://github.com/cytopia/ansible-module-diff","last_synced_at":"2025-07-22T12:33:55.867Z","repository":{"id":147859109,"uuid":"138721222","full_name":"cytopia/ansible-module-diff","owner":"cytopia","description":"Ansible module to diff strings, file contents or command outputs against each other","archived":false,"fork":false,"pushed_at":"2018-06-27T15:20:44.000Z","size":24,"stargazers_count":11,"open_issues_count":1,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-07T11:17:52.096Z","etag":null,"topics":["ansible","ansible-modules","diff"],"latest_commit_sha":null,"homepage":null,"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/cytopia.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":"2018-06-26T10:15:51.000Z","updated_at":"2022-01-18T08:51:23.000Z","dependencies_parsed_at":"2023-05-27T17:30:35.403Z","dependency_job_id":null,"html_url":"https://github.com/cytopia/ansible-module-diff","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cytopia/ansible-module-diff","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cytopia%2Fansible-module-diff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cytopia%2Fansible-module-diff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cytopia%2Fansible-module-diff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cytopia%2Fansible-module-diff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cytopia","download_url":"https://codeload.github.com/cytopia/ansible-module-diff/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cytopia%2Fansible-module-diff/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266496399,"owners_count":23938711,"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-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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","diff"],"created_at":"2024-10-03T16:45:36.321Z","updated_at":"2025-07-22T12:33:55.770Z","avatar_url":"https://github.com/cytopia.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ansible Module: diff\n\nSome custom ansible modules not yet submitted or accepted by [Ansible](https://github.com/ansible/ansible).\n\n## Usage\n\nAn Ansible module to do generic diffs against strings, files and command outputs.\n\n#### Arguments\n\n| Name             | Required | Default | Description |\n|------------------|----------|---------|-------------|\n| source           | Yes      |         | The source input to diff. Can be a string, contents of a file or output from a command, depending on `source_type` |\n| target           | Yes      |         | The target input to diff. Can be a string, contents of a file or output from a command, depending on `target_type` |\n| source_type      | No       | string  | Specify the input type of `source`: `string`, `file` or `command` |\n| target_type      | No       | string  | Specify the input type of `target`: `string`, `file` or `command` |\n| diff             | No       | raw     | Specify the diff type: `raw` or `yaml`. |\n| diff_yaml_ignore | No       | `[]`    | List of keys to ignore for yaml diff |\n\n\n#### Examples\n\n```yml\n# Diff compare two strings\n- diff:\n    source: \"foo\"\n    target: \"bar\"\n    source_type: string\n    target_type: string\n\n# Diff compare variable against template file (as strings)\n- diff:\n    source: \"{{ lookup('template', tpl.yml.j2) }}\"\n    target: \"{{ my_var }}\"\n    source_type: string\n    target_type: string\n\n# Diff compare string against command output\n- diff:\n    source: \"/bin/bash\"\n    target: \"which bash\"\n    source_type: string\n    target_type: command\n\n# Diff compare file against command output\n- diff:\n    source: \"/etc/hostname\"\n    target: \"hostname\"\n    source_type: file\n    target_type: command\n\n# Diff compare two normalized yaml files (sorted keys and comments stripped),\n# but additionally ignore the yaml keys: 'creationTimestamp' and 'metadata'\n- diff:\n    source: /tmp/file-1.yml\n    target: /tmp/file-2.yml\n    source_type: file\n    target_type: file\n    diff: yaml\n    diff_yaml_ignore:\n      - creationTimestamp\n      - metadata\n```\n\n## Integration\n\n\u003e 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 module into that directory\n\n```shell\n$ mkdir library\n$ cp path/to/module library\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcytopia%2Fansible-module-diff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcytopia%2Fansible-module-diff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcytopia%2Fansible-module-diff/lists"}