我想在完成运行一本剧本后在Ansible中显示一条横幅信息,并提供下一步的说明.这就是我所做的:
- name: display post install message
debug:
msg: |
Things left to do:
- enable dash to dock gnome plugin in gnome tweal tool
- install SpaceVim plugins: vim "+call dein#install()" +qa
- git clone the dotfiles repo
Run Code Online (Sandbox Code Playgroud)
但这会产生如下丑陋的输出:
TASK [display post install message] ********************************************
ok: [localhost] => {
"msg": "Things left to do:\n- enable dash to dock gnome plugin in gnome tweal tool\n- install SpaceVim plugins: vim \"+call dein#install()\" +qa\n- git clone the dotfiles repo\n"
}
PLAY RECAP …
Run Code Online (Sandbox Code Playgroud) 这就是我所拥有的
- name: disable os firewall - firewalld
systemd:
name: firewalld
state: stopped
enabled: no
Run Code Online (Sandbox Code Playgroud)
此任务在firewalld
安装了软件包的主机上运行良好,但在未安装软件包的主机上失败。
确保它可以处理未firewalld
安装的主机的最佳简单方法是什么?我不想使用任何 CMDB,因为它是一个额外的设置。另外,我希望任务是幂等的;使用像dpkg
或rpm
查询是否firewalld
安装的 shell 命令使 ansible playbook 摘要报告更改,这是我不想要的。
ansible ×2