Skip to content

Instantly share code, notes, and snippets.

@TuranTimur
Last active July 10, 2025 00:57
Show Gist options
  • Save TuranTimur/db2bd0cc88105ca222bc1086e9c7ad84 to your computer and use it in GitHub Desktop.
Save TuranTimur/db2bd0cc88105ca222bc1086e9c7ad84 to your computer and use it in GitHub Desktop.
/**********************************************
*
* MSSQL
*
***********************************************/
# Installation
https://nagarkotideepak9.medium.com/installing-microsoft-sql-mssql-in-red-hat-8-37adc1c5b42e
* mssql 설치
* odbc 설치 -> 이 부분 참고
# Playbook
[root@rhel8 playbook-test]# cat mssql.yml
---
- hosts: localhost
tasks:
- name: Set some values in the test db
community.general.odbc:
dsn: "DRIVER={ODBC Driver 17 for SQL Server};Server=192.168.56.102;Database=dbname;UID=sa;PWD=mysecret;"
query: "Select * from empDepartment"
commit: false
changed_when: false
register: rs_data
- debug:
msg:
results: "{{ rs_data.results }}"
col: "{{ rs_data |json_query('description[].name') }}"
- debug:
msg: "{{ rs_data }}"
/**********************************************
*
* Postgresql
*
***********************************************/
# SQL
https://docs.ansible.com/ansible/latest/collections/community/postgresql/postgresql_query_module.html#ansible-collections-community-postgresql-postgresql-query-module
* 위의 링크 참고
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment