问题标签 [ansible-playbook]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
yaml - 如何在 YAML 中连接字符串?
我正在编写一个剧本,我需要在其中执行 mysql 查询并以 json 格式传递输出。剧本代码工作正常,只是我想在字符串concatenate
部分遇到错误。如果我传递示例 json 字符串,它工作正常。
output.stdout_lines
是我的剧本中已经设置的变量,其中包含{'red','blue','yellow'}
格式的输出。
那么如何连接output.stdout_lines
变量'{"stdout_lines": {{output.stdout_lines}} }'
呢?有什么建议么
ansible - 我们如何检查额外的参数是否应该在 ansible playbook 中通过?
我是编写ansible剧本的新手。我试图找到一种方法来检查是否传递了额外的参数。如果额外参数为空或未通过命令行传递,我想在控制台上输出错误消息。
我在这里尝试什么。
运行命令:-
如果action
为 null 或未通过,则应显示错误消息。
我的任务.yml
我没有收到任何错误消息只是得到
请建议我如何检查是否通过了额外的参数?
mysql - 使用ansible安装edx配置时无法连接到mysql
我已经想edx-configuarion
在我的 ubuntu 服务器中安装平台。我在 github 上阅读了这个 wiki,但是当我运行这个命令时:
我收到此错误:
我将我的root
用户密码更改为''
但仍然是同样的问题。我还将EDXAPP_MYSQL_USER
toroot
和更改EDXAPP_MYSQL_PASSWORD
为另一个密码playbooks/roles/edxapp/defaults/main.yml
但仍然是同样的问题:(
ansible - 如果某些文件已更改,我如何运行 ansible 命令
我ansible
用来部署我的django App
使用
但我只想运行它,如果 requirements.txt 自上次运行以来发生了变化
linux - Ansible:是否可以搜索替换单个单词
在lineinfile模块中,它替换了整行。
如果这条线很长,我必须再次重复整条线。
假设我想替换文件中的单个单词:
这是剧本:
有什么办法可以达到类似的效果sed 's/horse/dog/g'
吗?
debian - ansible pipelining mode with shell script that requires tty
I am using ansible to install node.js and npm on Debian wheezy VMs following the steps in the Backports section of this .
The following playbook task used to work nicely with conventional ansible ssh mode.
Until I tried to enable pipelining of ansible 1.5. now it fails with:
The downloaded shellscript install.sh references /dev/tty in line 246 and therefore fails when executed with ansible in pipelining mode.
Can I disable pipelining just for this one task?
Is there another option?"
makefile - 可以使用 ansible 来部署应用程序而不是制作文件吗
我最近开始使用ansible
linux 服务器的配置管理。
我的习惯是,如果我学习了一种工具,那么我会尽可能多地使用它。
最初,对于我的 php Web 应用程序,我有很长一段时间Makefile
用于下载、安装包、制作 php.ini 文件更改、提取 zip 文件、在文件夹之间复制文件等,以便以自动化方式部署我的应用程序。
现在,我正在考虑将该Makefile
部署转换为,Ansible
因为这样我就可yml
以为单独的区域安排单独的文件,而不是makefile
为整个项目安排一个大文件。
我想知道为此使用 ansible 是个好主意还是Makefile
会对此有好处。
linux - 如何在 ansible 命令中提及通配符
我正在通过 Ansible 执行 shell 命令。
有时我没有完整的文件夹名称。假设我有 dirname solr4.7.0
。
在 shell 中,我可以输入cd solr*
.
但在ansible我不能这样做:
chdir=/var/solr*
有什么解决方法吗?
ansible-playbook - Ansible 使用 --extra-vars 进行条件包含
我正在使用 Ansible 来部署一个环境,该环境可能已经分发或不分发服务。我想有条件地包含基于我传递给 ansible-playbook 的参数的剧本。
create_server.yml
这是我调用 create_server.yml 的方式
是否有可能做到这一点,如果可以,怎么做?
ansible - Ansible:是否可以使用本地文件提供远程任务(避免先上传文件)
假设我有这个 Ansible 任务:
我有很多这样的,我首先要上传文件
如果有办法告诉 ansible 它必须首先上传文件,那就太好了,例如: