Comments (2)
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.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansible_training.