• <small id='QFvgt'></small><noframes id='QFvgt'>

        <i id='QFvgt'><tr id='QFvgt'><dt id='QFvgt'><q id='QFvgt'><span id='QFvgt'><b id='QFvgt'><form id='QFvgt'><ins id='QFvgt'></ins><ul id='QFvgt'></ul><sub id='QFvgt'></sub></form><legend id='QFvgt'></legend><bdo id='QFvgt'><pre id='QFvgt'><center id='QFvgt'></center></pre></bdo></b><th id='QFvgt'></th></span></q></dt></tr></i><div id='QFvgt'><tfoot id='QFvgt'></tfoot><dl id='QFvgt'><fieldset id='QFvgt'></fieldset></dl></div>
        <legend id='QFvgt'><style id='QFvgt'><dir id='QFvgt'><q id='QFvgt'></q></dir></style></legend>
      1. <tfoot id='QFvgt'></tfoot>
          <bdo id='QFvgt'></bdo><ul id='QFvgt'></ul>

        使用 Ansible 任务运行 SELECT 查询

        时间:2023-06-06
      2. <small id='hwaKQ'></small><noframes id='hwaKQ'>

        1. <i id='hwaKQ'><tr id='hwaKQ'><dt id='hwaKQ'><q id='hwaKQ'><span id='hwaKQ'><b id='hwaKQ'><form id='hwaKQ'><ins id='hwaKQ'></ins><ul id='hwaKQ'></ul><sub id='hwaKQ'></sub></form><legend id='hwaKQ'></legend><bdo id='hwaKQ'><pre id='hwaKQ'><center id='hwaKQ'></center></pre></bdo></b><th id='hwaKQ'></th></span></q></dt></tr></i><div id='hwaKQ'><tfoot id='hwaKQ'></tfoot><dl id='hwaKQ'><fieldset id='hwaKQ'></fieldset></dl></div>
            • <tfoot id='hwaKQ'></tfoot>

                  <tbody id='hwaKQ'></tbody>
              1. <legend id='hwaKQ'><style id='hwaKQ'><dir id='hwaKQ'><q id='hwaKQ'></q></dir></style></legend>
                  <bdo id='hwaKQ'></bdo><ul id='hwaKQ'></ul>
                  本文介绍了使用 Ansible 任务运行 SELECT 查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  在 this 的 Ansbile mysql 数据库模块列表中,有一个用于创建数据库,或者创建用户等

                  In this list of mysql db modules for Ansbile, there's one for creating a db, or creating a user, etc.

                  我想对预先存在的表运行查询,并使用该查询的结果来填充 Ansible 变量(IP 地址列表和节点类型),我将根据节点类型运行不同的任务.

                  I would like to run a query against a pre-existing table and use the results of that query to populate an Ansible variable (list of IP addresses, and node type) upon which I would run different tasks, depending on node type.

                  在 Ansible 中如何做到这一点?

                  How can that be done in Ansible?

                  推荐答案

                  这大概是怎么做的(但未经测试):

                  This is approximately how to do it (but it is untested):

                  - name: Retrieve stuff from mysql
                    command: >
                      mysql --user=alice --password=topsecret dbname
                      --host=147.102.160.1 --batch --skip-column-names
                      --execute="SELECT stuff from stuff_table"
                    register: stuff
                    check_mode: no
                    changed_when: False
                  
                  - name: Do something with stuff
                    debug: "{{ item }}"
                    with_items: stuff.stdout_lines
                  

                  记录在此处.

                  这篇关于使用 Ansible 任务运行 SELECT 查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在 ubuntu 上使用 ansible 安装 MySQL 下一篇:Ansible 幂等 MySQL 安装 Playbook

                  相关文章

                  最新文章

                  1. <i id='Kl654'><tr id='Kl654'><dt id='Kl654'><q id='Kl654'><span id='Kl654'><b id='Kl654'><form id='Kl654'><ins id='Kl654'></ins><ul id='Kl654'></ul><sub id='Kl654'></sub></form><legend id='Kl654'></legend><bdo id='Kl654'><pre id='Kl654'><center id='Kl654'></center></pre></bdo></b><th id='Kl654'></th></span></q></dt></tr></i><div id='Kl654'><tfoot id='Kl654'></tfoot><dl id='Kl654'><fieldset id='Kl654'></fieldset></dl></div>
                  2. <small id='Kl654'></small><noframes id='Kl654'>

                      <bdo id='Kl654'></bdo><ul id='Kl654'></ul>

                    <legend id='Kl654'><style id='Kl654'><dir id='Kl654'><q id='Kl654'></q></dir></style></legend>
                    1. <tfoot id='Kl654'></tfoot>