{"id":1209,"date":"2019-10-09T12:45:41","date_gmt":"2019-10-09T12:45:41","guid":{"rendered":"\/blog\/?p=1209"},"modified":"2019-10-09T12:46:25","modified_gmt":"2019-10-09T12:46:25","slug":"mysql-ansible-connection-example","status":"publish","type":"post","link":"\/blog\/index.php\/mysql-ansible-connection-example\/","title":{"rendered":"Mysql-Ansible connection example"},"content":{"rendered":"<p>&#8211; name: Retrieve stuff from mysql<br \/>\n  command: ><br \/>\n    mysql &#8211;user=alice &#8211;password=topsecret dbname<br \/>\n    &#8211;host=147.102.160.1 &#8211;batch &#8211;skip-column-names<br \/>\n    &#8211;execute=&#8221;SELECT stuff from stuff_table&#8221;<br \/>\n  register: stuff<br \/>\n  check_mode: no<br \/>\n  changed_when: False<\/p>\n<p>&#8211; name: Do something with stuff<br \/>\n  debug: &#8220;{{ item }}&#8221;<br \/>\n  with_items: stuff.stdout_lines<\/p>\n<p>#&#8212;&#8212; another example<br \/>\n&#8211; name:  Get username<br \/>\n  command: mysql -u {{ username }} -p {{ mysql_root_password }} {{ database }} -Ns -e &#8220;<your_query>&#8221;<br \/>\n  register: username<\/p>\n<p>&#8211; debug: msg=&#8221;{{ username.stdout_lines }}&#8221;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8211; name: Retrieve stuff from mysql command: > mysql &#8211;user=alice &#8211;password=topsecret dbname &#8211;host=147.102.160.1 &#8211;batch &#8211;skip-column-names &#8211;execute=&#8221;SELECT stuff from stuff_table&#8221; register: stuff check_mode: no changed_when: False &#8211; name: Do something with stuff debug: &#8220;{{ item }}&#8221; with_items: stuff.stdout_lines #&#8212;&#8212; another example &#8211; name: Get username command: mysql -u {{ username }} -p {{ mysql_root_password }} {{ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1209","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1209","targetHints":{"allow":["GET"]}}],"collection":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=1209"}],"version-history":[{"count":2,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1209\/revisions"}],"predecessor-version":[{"id":1211,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1209\/revisions\/1211"}],"wp:attachment":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=1209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=1209"},{"taxonomy":"post_tag","embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=1209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}