1

I am writing a playbook for automating anaconda installation . I am using Ansible expect module to answer the installation prompts. Here is my code.

---
  - hosts: all
    become: yes
    become_method: sudo
    gather_facts: true
    tasks:
      - name: Run the installer Anaconda
        expect:
          command: bash ~/Downloads/Anaconda3-2019.03-Linux-x86_64.sh
          responses:
          "Please, press ENTER to continue" : "\n"
          "More"                        : " "
          " Do you accept the license terms" : "yes"
          "Press ENTER to confirm the location" : "\n"
          "Do you wish the installer to initialize Anaconda3 by running conda init": "yes"

Here the error I am getting. TASK [Run the installer Anaconda] **********************************************

fatal: [192.168.6.230]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (expect) module: Do you accept the license terms, Do you wish the installer to initialize Anaconda3 by running conda init, More, Please, press ENTER to continue, Press ENTER to confirm the location Supported parameters include: chdir, command, creates, echo, removes, responses, timeout"}

user9517
  • 114,104
  • 20
  • 206
  • 289

1 Answers1

1

You need to indent your responses:

          responses:
            - "Please, press ENTER to continue" : "\n"
            - "More"                        : " "
            - " Do you accept the license terms" : "yes"
            - "Press ENTER to confirm the location" : "\n"
            - "Do you wish the installer to initialize Anaconda3 by running conda init": "yes"

Otherwise they are only treated as the next parameters for the expect section. YAML relies heavily on correct indentation.

Gerald Schneider
  • 19,757
  • 8
  • 52
  • 79
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - [From Review](/review/low-quality-posts/410935) – Jenny D May 22 '19 at 09:09
  • @JennyD That actually was the answer. I wasn't referring to the formatting of the question. – Gerald Schneider May 22 '19 at 09:17
  • thanks for the clarification, now it's obvious! (I was surprised at what seemed like a bit of a newbie error from someone like you; I'm sorry I didn't skip that review and wait for you to edit it.) – Jenny D May 22 '19 at 09:19
  • No worries, happens to the best – Gerald Schneider May 22 '19 at 09:21