Giter Club home page Giter Club logo

Comments (2)

AJNOURI avatar AJNOURI commented on July 20, 2024 1

Debugging -vvv reveals that Ansible is trying to connect with no user:

ESTABLISH SSH CONNECTION FOR USER: None

Solution1:

Which causing the server to require a password. As a workaround, I passed manually root as ansible_user in an environment variable in the command:

-e "ansible_user=root"

Now it works fine:

$ ansible-playbook -e "ansible_user=root" debianservers.yml
[DEPRECATION WARNING]: DEFAULT_SUDO_USER option, In favor of Ansible Become, which is a generic framework. See become_user. , use become instead. This
feature will be removed in version 2.8. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.


< PLAY [webservers] >

    \   ^__^
     \  (oo)\_______
        (__)\       )\/\
            ||----w |
            ||     ||

< TASK [Gathering Facts] >

    \   ^__^
     \  (oo)\_______
        (__)\       )\/\
            ||----w |
            ||     ||

ok: [51.15.238.91]


< TASK [Record start time of the role] >

    \   ^__^
     \  (oo)\_______
        (__)\       )\/\
            ||----w |
            ||     ||

changed: [51.15.238.91]


/ TASK [debian_webservers : Install (Debian/Ubuntu) Apache
\ web server] /

    \   ^__^
     \  (oo)\_______
        (__)\       )\/\
            ||----w |
            ||     ||

ok: [51.15.238.91]


/ TASK [debian_webservers : Wait for the a file to be
\ present] /

    \   ^__^
     \  (oo)\_______
        (__)\       )\/\
            ||----w |
            ||     ||

ok: [51.15.238.91]


< TASK [debian_webservers : Install vim package] >

    \   ^__^
     \  (oo)\_______
        (__)\       )\/\
            ||----w |
            ||     ||

ok: [51.15.238.91]


< TASK [Record end time of the role] >

    \   ^__^
     \  (oo)\_______
        (__)\       )\/\
            ||----w |
            ||     ||

changed: [51.15.238.91]


< PLAY RECAP >

    \   ^__^
     \  (oo)\_______
        (__)\       )\/\
            ||----w |
            ||     ||

51.15.238.91 : ok=6 changed=2 unreachable=0 failed=0

Solution2:

In ansible config file /etc/ansible/ansible.cfg

sudo_user      = ajn
#ask_sudo_pass = True
#ask_pass      = True

in the playbook: debianservers.yml

  become: yes
  become_user: ajn

from ansible_training.

AJNOURI avatar AJNOURI commented on July 20, 2024

In the playbook file "debianservers.yml", I've changed

become_user: root

fatal: [51.15.238.91]: FAILED! => {"changed": false, "module_stderr": "Shared connection to 51.15.238.91 closed.\r\n", "module_stdout": "sudo: a password is required\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
to retry, use: --limit @/home/ajn/github/ansible_training/roleprj1/roles/waiting_for_events/debianservers.retry

from ansible_training.

Related Issues (3)

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.