{"id":17040987,"url":"https://github.com/uggla/ansible-examples","last_synced_at":"2026-04-09T02:02:28.960Z","repository":{"id":148619965,"uuid":"196090841","full_name":"uggla/ansible-examples","owner":"uggla","description":"Escaping example with bash and ansible","archived":false,"fork":false,"pushed_at":"2019-07-09T22:20:23.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-10T19:22:54.775Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uggla.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":"2019-07-09T22:12:37.000Z","updated_at":"2019-07-09T22:20:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"b4bc9286-87f6-4398-83e9-58791ee83dce","html_url":"https://github.com/uggla/ansible-examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/uggla/ansible-examples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uggla%2Fansible-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uggla%2Fansible-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uggla%2Fansible-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uggla%2Fansible-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uggla","download_url":"https://codeload.github.com/uggla/ansible-examples/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uggla%2Fansible-examples/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31581864,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"online","status_checked_at":"2026-04-09T02:00:06.848Z","response_time":112,"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-10-14T09:11:03.264Z","updated_at":"2026-04-09T02:02:28.940Z","avatar_url":"https://github.com/uggla.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"## Escaping into Bash example\n\nBest solution is to use [Ansi C like string](https://wiki.bash-hackers.org/syntax/quoting#ansi_c_like_strings).\n\n```\ndocker run --rm -ti -e MYVAR=\"JJJJ KKK\" fedora:30 bash -c $'echo \\\"${MYVAR}\\\" | awk \\'{ print $NF }\\'; echo \\\"${MYVAR}\\\"'\nKKK\nJJJJ KKK\n```\n\n## Escaping into Ansible example\n\nThe Ansible yaml parser seems to not handle \\' correctly so use the hex ascii value \\\\x27.\n```\n __________________\n\u003c PLAY [localhost] \u003e\n ------------------\n        \\   ^__^\n         \\  (oo)\\_______\n            (__)\\       )\\/\\\n                ||----w |\n                ||     ||\n\n ________________________\n\u003c TASK [Gathering Facts] \u003e\n ------------------------\n        \\   ^__^\n         \\  (oo)\\_______\n            (__)\\       )\\/\\\n                ||----w |\n                ||     ||\n\nok: [localhost]\n _________________\n\u003c TASK [shell it] \u003e\n -----------------\n        \\   ^__^\n         \\  (oo)\\_______\n            (__)\\       )\\/\\\n                ||----w |\n                ||     ||\n\nchanged: [localhost]\n ______________\n\u003c TASK [debug] \u003e\n --------------\n        \\   ^__^\n         \\  (oo)\\_______\n            (__)\\       )\\/\\\n                ||----w |\n                ||     ||\n\nok: [localhost] =\u003e {\n    \"nene\": {\n        \"changed\": true,\n        \"cmd\": \"docker run --rm -ti -e MYVAR=\\\"JJ-KJJ-RRR TTT\\\" fedora:30 bash -c $'uname -a ; echo \\\"${MYVAR}\\\" | awk -F \\\\x27-\\\\x27 \\\\x27{print $NF}\\\\x27'\",\n        \"delta\": \"0:00:00.545145\",\n        \"end\": \"2019-07-10 00:05:05.105466\",\n        \"failed\": false,\n        \"rc\": 0,\n        \"start\": \"2019-07-10 00:05:04.560321\",\n        \"stderr\": \"\",\n        \"stderr_lines\": [],\n        \"stdout\": \"Linux d3883d4ff32c 5.1.16-300.fc30.x86_64 #1 SMP Wed Jul 3 15:06:51 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux\\r\\nRRR TTT\",\n        \"stdout_lines\": [\n            \"Linux d3883d4ff32c 5.1.16-300.fc30.x86_64 #1 SMP Wed Jul 3 15:06:51 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux\",\n            \"RRR TTT\"\n        ]\n    }\n}\n ____________\n\u003c PLAY RECAP \u003e\n ------------\n        \\   ^__^\n         \\  (oo)\\_______\n            (__)\\       )\\/\\\n                ||----w |\n                ||     ||\n\nlocalhost                  : ok=3    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuggla%2Fansible-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuggla%2Fansible-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuggla%2Fansible-examples/lists"}