Try to search your question here, if you can't find : Ask Any Question Now ?

Using vault in playbooks

HomeCategory: stackoverflowUsing vault in playbooks
Avatarpragati asked 4 months ago

Hello I am trying to run the following playbook using the vault, but i can’t seem to get it to work.

Created an ansible vault file using:

ansible-valut create group_vars/routers

in there i had the following entries:

ansible_ssh_user: admin
ansible_ssh_pw: admin
auth_pass: admin

Then i had the following playbook:

---
- hosts:routers
  gather_facts: true
  connection: local

  tasks:
    - name: show run
      ios_command:
        authorize: yes
        auth_pass: "{{ auth_pass }}"
        commands:
          - show run
      register: config

When i try to run it using this cli command

ansible-playbook -u admin script.yaml --ask-vault-pass

I get the following error everytime

Unable to elevate privelage to enable mode, at prompt [None] with error: timeout value 10 seconds reached while trying to send command: enable

UPDATE

If i change the connection to network_cli, now i get the following error:

fatal: [ROUTER-A]: Failed! => {"changed": false, "msg": "show runrn       ^rn% Invalid input detected at '^' marker.rnrROUTER-A>"}
1 Answers
Best Answer
AvatarAmit answered 4 months ago
Your Answer

12 + 9 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com