Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- - hosts: localhost
- tasks:
- - set_fact:
- store: "{{ ansible_env.store }}"
- source_path: "D:\\LOCALIZATION\\Export\\{{ ansible_env.store }}"
- destination_file: "D:\\LOCALIZATION\\{{ ansible_env.store }}.zip"
- - mssql_query:
- server: sql01
- database: STOREINFO_TOOL
- query: 'select * from store_details where store_id = {{ store }}'
- user: user
- password: pass
- register: query_result
- # - debug: var=query_result.results
- - copy:
- content: "{{ query_result.results }}"
- dest: "../store_info.yml"
- - hosts: server
- tasks:
- - debug: var=localhost[server]
- - name: "Remove {{ destination_file }} if it exists."
- win_file: "path={{ destination_file }} state=absent"
- - name: zip up {{ source_path }} to {{ destination_file }}
- win_shell: Add-Type -assembly system.io.compression.filesystem; [io.compression.zipfile]::CreateFromDirectory('{{ source_path }}', '{{ destination_file }}')
- args:
- executable: powershell
- register: zip_status
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement