openwhisk ansible setup.yml失败,错误为“ ansible / _distribution未定义”

问题描述

我想使用 ansible Openwhisk docker 一起安装。但是当我跑步

ansible-playbook -i environments/local setup.yml

我收到此错误

> The conditional check 'Nginx.ssl.cert == "openwhisk-server-cert.pem"'
Failed. The error was: error while evaluating conditional (Nginx.ssl.cert ==
"openwhisk-server-cert.pem"): 'ansible_distribution' is undefined  The error
appears to have been in '/home/parichehr/openwhisk/ansible/setup.yml': line 60,column 5,but may be elsewhere in the file depending on the exact Syntax
problem.  The offending line appears to be:    # Generate Nginx certificates   -
name: gen untrusted server certificate for host     ^ here 

解决方法

ansible_distribution是通过任务Gathering Facts定义的变量。默认情况下,“收集事实”是启用的,但是如果您要确保收集到的事实,可以按照以下方式在剧本中gather_facts: yes

- name: Setup.yml
  hosts: all
  gather_facts: yes

  tasks:
  ...........