小编GMa*_*ter的帖子

在Ansible中显示横幅消息

我想在完成运行一本剧本后在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)

ansible

12
推荐指数
1
解决办法
8057
查看次数

仅当安装了软件包时才禁用 systemd 服务

这就是我所拥有的

- name: disable os firewall - firewalld
  systemd:
    name: firewalld
    state: stopped
    enabled: no
Run Code Online (Sandbox Code Playgroud)

此任务在firewalld安装了软件包的主机上运行良好,但在未安装软件包的主机上失败。

确保它可以处理未firewalld安装的主机的最佳简单方法是什么?我不想使用任何 CMDB,因为它是一个额外的设置。另外,我希望任务是幂等的;使用像dpkgrpm查询是否firewalld安装的 shell 命令使 ansible playbook 摘要报告更改,这是我不想要的。

ansible

5
推荐指数
1
解决办法
4638
查看次数

标签 统计

ansible ×2