任务未执行,Ansible

时间:2016-07-08 12:24:15

标签: ansible-playbook ansible-2.x

我有一个Ansible手册来配置服务器以满足我们所需的最低配置。这是我的脚本的一部分:

---
- 
  name: Install Git, OpenJDK, MySql, Docker, Bamboo
  hosts: myservers
  remote_user: root
  vars:
    bamboo: atlassian-bamboo
    bamboover: 5.12.2.1
    dlpath: software/bamboo/downloads/binary
    tmp: /var/tmp
    installto: opt
    datahome: /srv/bamboo-data
    svcuser: someuser
    dbuser: someotheruser
    dbpass: somepassword
  tasks:
    - name: install epel-release
      yum: pkg=epel-release state=latest
    - name: install the open-vm-tools, htop, mlocate, ansible, autoconf, wget, java-1.8.0-openjdk-headless.x86_64, Development tools
      yum: state=present name={{item}}
      with_items:
        - open-vm-tools
        - htop
        - mlocate
        - ansible
        - autoconf
        - wget
        - java-1.8.0-openjdk-headless.x86_64
        - "Development tools"
    ## The task gets here and it doesn't continue for some reason.
    - name: Reboot the server after install
      command: reboot 
    - name: wait for server to come back
      local_action: 
        module: wait_for 
          host={{inventory_hostname}}
          port=22
          state=started 
          delay=1 
          timeout=300
      sudo: false
    - name: updatedb
      command: updatedb >> playbook.log.txt
    - name: install mysql, mysql-community-server
      yum: name={{item}} state=present 
      with_items:
        - http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
        - mysql-community-server
    - name: Start of mysqld
      command: service mysqld start >> playbook.log.txt
     [...] #Continues...

我不明白出了什么问题。在调查过程中,我发现当一个主人无法到达时,有一个已知的问题(在我的情况下会发生什么)。相关问题:ISSUE问题已解决,这是我的Ansible版本:

enter image description here

我尝试从我的ansible hosts文件中删除所有主机,只留下一个我可以访问的主机。无济于事,它只是没有执行所有任务。

这是剧本的输出:

enter image description here

有人可能建议采用不同的方法或更好的解决方案吗?

1 个答案:

答案 0 :(得分:0)

包裹组必须以@为前缀。来自Ansible yum module notes

  

包组被指定为“@ development-tools”,环境组是“@ ^ gnome-desktop-environment”。