简体   繁体   English

可以用于在多台服务器上运行ruby / rails控制台查询

[英]Can ansible be used to run ruby/rails console queries on multiple servers

Can ansible be used to run ruby/rails console queries on multiple servers. 可以用于在多台服务器上运行ruby / rails控制台查询。 Is there any other tool which can serve this purpose. 是否有其他工具可以达到此目的。 Developers run lot of console queries to get information from different database. 开发人员运行大量控制台查询来从不同的数据库中获取信息。 Is there any way we can use a tool so that they can do their tasks independently without depending on others. 有什么方法可以使用工具,使他们可以独立完成任务,而不必依赖其他人。

I have never been a rails user, but from my understanding the rails console is an interactive process. 我从来没有成为过Rails的用户,但据我所知, rails console是一个交互式过程。 If I read the docs correctly the rails runner command is for running single commands and that makes more sense in context of automation. 如果我正确阅读了文档, rails runner命令是用于运行单个命令的,这在自动化的上下文中更为有意义。

So you should be able to define a task like this in a playbook. 因此,您应该能够在剧本中定义这样的任务。

- shell: rails runner <some-command>

Though... 虽然...

Developer run lot of console queries to get information from different database. 开发人员运行大量控制台查询来从不同的数据库中获取信息。

This more sounds like these are no pre-defined queries but arbitrary things a developer might want to run against multiple machines. 听起来更多的是,这些不是预定义的查询,而是开发人员可能希望对多台计算机运行的任意操作。 Then simply use the ansible command and not ansible-playbook: 然后只需使用ansible命令而不是ansible-playbook:

ansible all -m shell -a "rails runner <some-command>"

Is there any other tool which can serve this purpose. 是否有其他工具可以达到此目的。

If this is your only use case pdsh might be a bit more easy to use 如果这只是您的唯一用例, pdsh可能会更易于使用

pdsh -w host1,host2,hostN "rails runner <some-command>"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM