Ошибка при выполнении playbook’a

283 просмотра
0

Добрый день. Я написал тестовый playbook который должен установить nginx на две виртуальные машины. При выполнении playbooka, возникает ошибка:

TASK [Install package nginx]
***************************************************
task path: /home/ansible/kiask-ansible/playbooks/test.yml:11
<10.0.2.15> ESTABLISH SSH CONNECTION FOR USER: ansible
<10.0.2.15> SSH: EXEC ssh -C -q -o ControlMaster=auto -o
ControlPersist=60s -o KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-
keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible
-o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/ansible-
ssh-%h-%p-%r -tt 10.0.2.15 '( umask 22 && mkdir -p "$( echo
$HOME/.ansible/tmp/ansible-tmp-1497967374.46-265450707591388 )" &&
echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1497967374.46-
265450707591388 )" )'
<10.0.0.141> ESTABLISH SSH CONNECTION FOR USER: ansible
<10.0.0.141> SSH: EXEC ssh -C -q -o ControlMaster=auto -o
ControlPersist=60s -o KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-
keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible
-o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/ansible-
ssh-%h-%p-%r -tt 10.0.0.141 '( umask 22 && mkdir -p "$( echo
$HOME/.ansible/tmp/ansible-tmp-1497967374.47-61506623098693 )" && echo
"$( echo $HOME/.ansible/tmp/ansible-tmp-1497967374.47-61506623098693
)" )'
<10.0.2.15> PUT /tmp/tmp2IIW8L TO /home/ansible/.ansible/tmp/ansible-
tmp-1497967374.46-265450707591388/apt
<10.0.2.15> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o
ControlPersist=60s -o KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-
keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible
-o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/ansible-
ssh-%h-%p-%r '[10.0.2.15]'
<10.0.0.141> PUT /tmp/tmpPCJKXl TO /home/ansible/.ansible/tmp/ansible-
tmp-1497967374.47-61506623098693/apt
<10.0.0.141> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o
ControlPersist=60s -o KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-
keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible
-o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/ansible-
ssh-%h-%p-%r '[10.0.0.141]'
<10.0.2.15> ESTABLISH SSH CONNECTION FOR USER: ansible
<10.0.2.15> SSH: EXEC ssh -C -q -o ControlMaster=auto -o
ControlPersist=60s -o KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-
keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible
-o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/ansible-
ssh-%h-%p-%r -tt 10.0.2.15 '/bin/sh -c '"'"'sudo -H -S -n -u root
/bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-
hruvczpcgcouyzrcieseacgtuntmcebp; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
LC_MESSAGES=en_US.UTF-8 /usr/bin/python
/home/ansible/.ansible/tmp/ansible-tmp-1497967374.46-
265450707591388/apt; rm -rf "/home/ansible/.ansible/tmp/ansible-tmp-
1497967374.46-265450707591388/" > /dev/null
2>&1'"'"'"'"'"'"'"'"''"'"''
<10.0.0.141> ESTABLISH SSH CONNECTION FOR USER: ansible
<10.0.0.141> SSH: EXEC ssh -C -q -o ControlMaster=auto -o
ControlPersist=60s -o KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-
keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible
-o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/ansible-
ssh-%h-%p-%r -tt 10.0.0.141 '/bin/sh -c '"'"'sudo -H -S -n -u root
/bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-
zyisyxledzeqsprdjaijtaygqugsqahi; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
LC_MESSAGES=en_US.UTF-8 /usr/bin/python
/home/ansible/.ansible/tmp/ansible-tmp-1497967374.47-
61506623098693/apt; rm -rf "/home/ansible/.ansible/tmp/ansible-tmp-
1497967374.47-61506623098693/" > /dev/null 2>&1'"'"'"'"'"'"'"'"''"'"''
fatal: [k4-test-1]: FAILED! => {"changed": false, "failed": true,
"invocation": {"module_name": "apt"}, "module_stderr": "",
"module_stdout": "sudo: a password is required\r\n", "msg": "MODULE
FAILURE", "parsed": false}
fatal: [k4-test-2]: FAILED! => {"changed": false, "failed": true,
"invocation": {"module_name": "apt"}, "module_stderr": "",
"module_stdout": "sudo: a password is required\r\n", "msg": "MODULE
FAILURE", "parsed": false}
 
PLAY RECAP
*********************************************************************
k4-test-1                  : ok=1    changed=0    unreachable=0
failed=1
k4-test-2                  : ok=1    changed=0    unreachable=0
failed=1

Собственно, сам playbook выглядит следующим образом:

---
 
 
- name: Install package nginx on remote hosts
  hosts: vhosts
 
 
  tasks:
 
 
  - name: Install package nginx
    apt: name=nginx update_cache=yes
    sudo: yes
 
  - name: Starting service nginx
    service: name=nginx state=started
    sudo: yes

Благодарю за внимание!


Добавить комментарий

1 Ответы

Python Опубликовано 16.12.2018
0

Ответ из комментариев:

Ошибка – «sudo: a password is required» – не настроен passwordless sudo. либо настроить нужно, либо запускать плейбук с ключом —ask-become-pass

Добавить комментарий
Напишите свой ответ на данный вопрос.
Scroll Up