# Not able to run ansible playbook , getting error with passing input file and taking input from user using assert module

**URL:** <https://forum.ansible.com/t/not-able-to-run-ansible-playbook-getting-error-with-passing-input-file-and-taking-input-from-user-using-assert-module/5872>\
**Category:** Get Help\
**Tags:** yaml, kubernetes, playbook\
**Created:** [May 19, 2024, 5:58pm UTC](https://forum.ansible.com/t/not-able-to-run-ansible-playbook-getting-error-with-passing-input-file-and-taking-input-from-user-using-assert-module/5872 "2024-05-19T17:58:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jatin821](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@jatin821](https://forum.ansible.com/u/jatin821)\
**Post date:** [May 19, 2024, 5:58pm UTC](https://forum.ansible.com/t/not-able-to-run-ansible-playbook-getting-error-with-passing-input-file-and-taking-input-from-user-using-assert-module/5872/1 "2024-05-19T17:58:18Z")

</div>

Hello All,

I am trying to pass a file (VAULT-PASS.YML) using Ansible built in module vars and taking input from user and then comparing it using assert module , If the input matches with the content given in file vault-pass.yml then it will prompt success message and execute application deployment and service file which will run in a pod in Kubernetes.

```auto
- name: Execute Task
  hosts: localhost
  become: true
  tasks:
  - name: Load Secrets
    ansible.builtin.include_vars:
      file: /home/xyz/vault-pass.yml
  - name: Prompt for Credentials
    vars_prompt:
      - name: entered_username
        prompt: "Enter the username"
        private: no
      - name: entered_password
        prompt: "Enter the password"
        private: yes

  - name: Verify Credentials
    assert:
      that:
        - entered_username == "secret_username"
        - entered_password == "secret_password"
      fail_msg: "Invalid credentials. Deployment aborted."
      success_msg: "Valid credentials. Proceeding with deployment."

  - name: Include Kubernetes Deployment
    include_tasks: basicapp-deployment.yml
    when: entered_username == secret_username and entered_password == secret_password

  - name: Include Kubernetes Service
    include_tasks: basic-service.yml
    when: entered_username == secret_username and entered_password == secret_password

```

Getting below error  
ERROR! unexpected parameter type in action: \<class ‘ansible.parsing.yaml.objects.AnsibleSequence’\>

The error appears to be in ‘/home/jatin/execute.yml’: line 5, column 5, but may  
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

tasks:

- name: Prompt for Credentials  
^ here

```auto
Below is my vault-pass.yml file content 

secret_username:abcd
secret_password:Welcome@12345
```

---

<div class="post-metadata">

**Author:** ![akira6592](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/akira6592/32/222_2.png) [@akira6592](https://forum.ansible.com/u/akira6592)\
**Post date:** [May 20, 2024, 4:45am UTC](https://forum.ansible.com/t/not-able-to-run-ansible-playbook-getting-error-with-passing-input-file-and-taking-input-from-user-using-assert-module/5872/2 "2024-05-20T04:45:12Z")

</div>

@jatin821 Welcome to community!

The `vars_prompt` is the [play level](https://docs.ansible.com/ansible/latest/reference_appendices/playbooks_keywords.html#play) keyword not module.

Therefore, we should `vars_prompt` as follows:

```yaml
- name: Execute Task
  hosts: localhost
  become: true

  vars_prompt:
    - name: entered_username
      prompt: "Enter the username"
      private: false
    - name: entered_password
      prompt: "Enter the password"
      private: true

  tasks:
    - name: Load Secrets
      ansible.builtin.include_vars:
        file: vault-pass.yml

    - name: Verify Credentials
      ansible.builtin.assert:
        that:
          - entered_username == secret_username
          - entered_password == secret_password
        fail_msg: "Invalid credentials. Deployment aborted."
        success_msg: "Valid credentials. Proceeding with deployment."

```

There are two other points I noticed.

1. It does not need quotation for variable name in that option.

```yaml
# corret
        - entered_username == secret_username
        - entered_password == secret_password

```

1. It needs a space after colon in `vault-pass.yml`

```yaml
# correct
secret_username: abcd
secret_password: Welcome@12345

```

---

<div class="post-metadata">

**Author:** ![jatin821](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@jatin821](https://forum.ansible.com/u/jatin821)\
**Post date:** [May 21, 2024, 6:28am UTC](https://forum.ansible.com/t/not-able-to-run-ansible-playbook-getting-error-with-passing-input-file-and-taking-input-from-user-using-assert-module/5872/3 "2024-05-21T06:28:23Z")

</div>

Thank you Akira for the feedback, I will try making those changes and execute the playbook.
