Skip to content

Instantly share code, notes, and snippets.

@zeitounator
Created September 12, 2021 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeitounator/e3ea522a8129562d1b4f8f215ff023a5 to your computer and use it in GitHub Desktop.
Save zeitounator/e3ea522a8129562d1b4f8f215ff023a5 to your computer and use it in GitHub Desktop.
$ cat test.yml
---
- hosts: localhost
gather_facts: false
vars:
my_user_name: toto
my_password: with$sign
tasks:
- set_fact:
win_shell: "invoke-sqlcmd -username \"{{my_user_name}}\" -password \"{{my_password}}\" -Query \"CREATE TABLE TempLogs (Command varchar(255), Paramenter varchar(255), Value varchar(255))\""
- debug:
var: win_shell
$ ansible-playbook test.yml
PLAY [localhost] ***********************************************************************************************************************************************************************************************************************
TASK [set_fact] ************************************************************************************************************************************************************************************************************************
ok: [localhost]
TASK [debug] ***************************************************************************************************************************************************************************************************************************
ok: [localhost] => {
"win_shell": "invoke-sqlcmd -username \"toto\" -password \"with$sign\" -Query \"CREATE TABLE TempLogs (Command varchar(255), Paramenter varchar(255), Value varchar(255))\""
}
PLAY RECAP *****************************************************************************************************************************************************************************************************************************
localhost : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment