GithubHelp home page GithubHelp logo

Comments (6)

qaxi avatar qaxi commented on July 30, 2024 1

Resolved by PR #74

from community.ciscosmb.

ckhordiasma avatar ckhordiasma commented on July 30, 2024

From looking at the code, I think it's because of this

def on_become(self, passwd=None):
if self._get_prompt().endswith(b"#"):
return

where it will skip attempting an elevation if it sees a prompt starts with #. For my switch, # indicates that you're at priv 7 or 15, so this logic doesn't really work because you should still be able to elevate past privilege 7

from community.ciscosmb.

ckhordiasma avatar ckhordiasma commented on July 30, 2024

alright... found a workaround. If I add the following task before my non-working task

    - name: disable
      become: no
      community.ciscosmb.command:
        commands:
          - disable

AND ensure that ansible_become is unset or set to no in the inventory file,

then my original task works as expected.

This forces the cli session to go to the lowest possible setting and changes the cli prefix to > instead of #, which then properly triggers the code to run an enable for subsequent tasks

If I set become: yes either in the "disable" task or globally, then I get the following error on the disable task:

{"changed": false, "msg": "Negative size passed to PyBytes_FromStringAndSize"}

from community.ciscosmb.

qaxi avatar qaxi commented on July 30, 2024

Hi

my understanding to become: yes is this: immediately after login it (on cisco sw) sends enable command.

And the priv. 7 account looks like "edgy" ... but legit.

I should check privilege more exactly.

Can you test this and send me output?

    - name: Set up ansible user account
      become: yes
      community.ciscosmb.command:
        commands:
          - sh privilege
          - enable
          - sh privilege
          - config t
          - "username ansible password {{new_user_password}} privilege 15"
          - ip ssh pubkey-auth auto-login
          - exit

And just in case test this

    - name: Set up ansible user account
      become: yes
      community.ciscosmb.command:
        commands:
          - enable
          - config t
          - "username ansible password {{new_user_password}} privilege 15"
          - ip ssh pubkey-auth auto-login
          - exit

from community.ciscosmb.

qaxi avatar qaxi commented on July 30, 2024

@ckhordiasma Never mind, I just checked the code and the leading test is redundant.

I will delete it and release ASAP.

Thank you for help.

from community.ciscosmb.

ckhordiasma avatar ckhordiasma commented on July 30, 2024

thank you!

from community.ciscosmb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.