# Send y key via Ansible

**URL:** <https://forum.ansible.com/t/send-y-key-via-ansible/11036>\
**Category:** Get Help\
**Tags:** ssh, playbook, network\
**Created:** [November 21, 2024, 7:55am UTC](https://forum.ansible.com/t/send-y-key-via-ansible/11036 "2024-11-21T07:55:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![philly](https://avatars.discourse-cdn.com/v4/letter/p/71e660/32.png) [@philly](https://forum.ansible.com/u/philly)\
**Post date:** [November 21, 2024, 7:55am UTC](https://forum.ansible.com/t/send-y-key-via-ansible/11036/1 "2024-11-21T07:55:28Z")

</div>

Hi, i want to add this command to my Ansible Playbook  
`reload from working rollback-timeout 20`  
The Output should be like this:

```auto
-> reload from working rollback-timeout 20 
Confirm Activate (Y/N) :

```

But in Ansible i receive this Error

````auto
FAILED! => {"changed": false, "msg": "y\r\n ^\r\nERROR: Invalid entry: \"y\"\r\n\r\n-> "}```

````

Playbook:

```auto
- name: Reload from working
  alcatel.aos8.aos8_command:
    commands:
      - "reload from working no rollback-timeout"
  register: raw_reload_from_working_no_rollback_timeout_output

- name: Handle activation confirmation if required
  when: "'Confirm Activate (Y/N) :' in raw_reload_from_working_no_rollback_timeout_output.stdout"
  alcatel.aos8.aos8_command:
    commands:
      - "Y"
  register: confirm_response_output

- name: Debug output
  debug:
    msg:
      - "Reload command output: {{ raw_reload_from_working_no_rollback_timeout_output }}"
      - "Confirm response output: {{ confirm_response_output | default('No confirmation required') }}"

```

---

<div class="post-metadata">

**Author:** ![jiholland](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jiholland/32/11273_2.png) [@jiholland](https://forum.ansible.com/u/jiholland)\
**Post date:** [November 21, 2024, 9:11am UTC](https://forum.ansible.com/t/send-y-key-via-ansible/11036/2 "2024-11-21T09:11:50Z")

</div>

The `alcatel.aos8` collection is not publicly available, so I can’t speak for it, but this is how you do it with `ansible.netcommon.cli_command`:

```auto
- name: Reload from working
  ansible.netcommon.cli_command:
    command: "reload from working no rollback-timeout 20"
    prompt: "Confirm Activate"
    answer: "y"

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [December 21, 2024, 9:12am UTC](https://forum.ansible.com/t/send-y-key-via-ansible/11036/3 "2024-12-21T09:12:09Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
