告诉 Ansible 进行 elm 初始化

tell Ansible to elm init

我有一个 ansible 角色用于设置 elm,最后一个任务是 elm init,配置初始 elm 项目,但我在执行此任务时遇到问题,因为我需要在 elm 提示我时告诉我是

Hello! Elm projects always start with an elm.json file. I can create them!

Now you may be wondering, what will be in this file? How do I add Elm files to my project? How do I see it in the browser? How will my code grow? Do I need more directories? What about tests? Etc.

Check out https://elm-lang.org/0.19.0/init for all the answers!

Knowing all that, would you like me to create an elm.json file now? [Y/n]: y

Ansible 不理解这个,所以我怎么能告诉 Ansible 说 Y

Ansible 任务是:

- name: setup elm project
  shell: elm init path="{{ project_path }}"
  tags:
    - configuration

在 unix shell 中执行此操作的标准方法是 pipe yes 命令,它会在每次询问时发送一个 y。由于 ansible 将接受任何 shell 命令,这应该适用于任何 Unix/Linux/macOS 机器:

shell: yes | elm init path="{{ project_path }}"