运行Ansible播放时未定义的变量

时间:2017-01-12 15:42:18

标签: ansible ansible-facts

我正在运行YAML文件中定义的多个ansible播放。

在上一次播放中,我收到以下错误:

this.$http.post('/blog/article/' + articleid + '/comment', article_comments)
.then(function (response) {
    self.comment_id = response.data.comments.id;
    this.user = response.data.comments.user;
    this.dataReady = true;
  }, function (response) {

});

if (this.dataReady == true) {
  this.comments.push({
      comment: this.comment,
      downvotes: 0,
      upvotes: 0,
      user:this.user,
      date_ago: moment(Date.now()).fromNow()
    })
  this.loadComments();
  console.log(this.comments);
}

我是否需要通过收集事实或{"failed": true, "msg": "The conditional check 'ansible_os_family == \"RedHat\"' failed. The error was: error while evaluating conditional (ansible_os_family == \"RedHat\"): 'ansible_os_family' is undefined\n 中的某些内容来更改任何内容?

2 个答案:

答案 0 :(得分:5)

添加:

gather_facts: true

到你上一次比赛并尝试。

答案 1 :(得分:0)

除了@helloV的答案:

给自己和他人的笔记,gathering =gather_facts:一起工作:

# smart - gather by default, but don't regather if already gathered
# implicit - gather by default, turn off with gather_facts: False
# explicit - do not gather by default, must say gather_facts: True
# gathering = explicit