Advertisement
Guest User

Untitled

a guest
Nov 10th, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. ---
  2. - hosts: localhost
  3. tasks:
  4. - set_fact:
  5. store: "{{ ansible_env.store }}"
  6. source_path: "D:\\LOCALIZATION\\Export\\{{ ansible_env.store }}"
  7. destination_file: "D:\\LOCALIZATION\\{{ ansible_env.store }}.zip"
  8. - mssql_query:
  9. server: sql01
  10. database: STOREINFO_TOOL
  11. query: 'select * from store_details where store_id = {{ store }}'
  12. user: user
  13. password: pass
  14. register: query_result
  15. # - debug: var=query_result.results
  16. - copy:
  17. content: "{{ query_result.results }}"
  18. dest: "../store_info.yml"
  19.  
  20. - hosts: server
  21. tasks:
  22. - debug: var=localhost[server]
  23. - name: "Remove {{ destination_file }} if it exists."
  24. win_file: "path={{ destination_file }} state=absent"
  25. - name: zip up {{ source_path }} to {{ destination_file }}
  26. win_shell: Add-Type -assembly system.io.compression.filesystem; [io.compression.zipfile]::CreateFromDirectory('{{ source_path }}', '{{ destination_file }}')
  27. args:
  28. executable: powershell
  29. register: zip_status
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement