mysql - Running a SELECT Query with an Ansible Task -


in this list of mysql db modules ansbile, there's 1 creating db, or creating user, etc.

i run query against pre-existing table , use results of query populate ansible variable (list of ip addresses, , node type) upon run different tasks, depending on node type.

how can done in ansible?

this approximately how (but untested):

- name: retrieve stuff mysql   command: >     mysql --user=alice --password=topsecret dbname     --host=147.102.160.1 --batch --skip-column-names     --execute="select stuff stuff_table"   register: stuff   always_run: true   changed_when: false  - name: stuff   debug: "{{ item }}"   with_items: stuff.stdout_lines 

documented here.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -