Я пытаюсь подключиться к целевому серверу через пользователя "naresh" и установить apache2 через пользователя "vijay", а пользователь "vijay" является пользователем sudo без пароля, но моя книга воспроизведения все еще не работает.
ansible-playbook ds.yml -u naresh
cat ds.yml
---
- hosts: all
gather_facts: no
tasks:
- name: install apache2
command: apt install apache2 -y
register: abcd
become: yes
become_user: vijay
- debug: var=abcd
Я получаю ошибку ниже
fatal: [52.87.204.142]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"}, "changed": true, "cmd": ["apt", "install", "apache2", "-y"], "delta": "0:00:00.007384", "end": "2019-11-06 14:25:58.346627", "msg": "non-zero return code", "rc": 100, "start": "2019-11-06 14:25:58.339243", "stderr": "\nWARNING: apt does not have a stable CLI interface. Use with caution in scripts.\n\nE: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)\nE: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?", "stderr_lines": ["", "WARNING: apt does not have a stable CLI interface. Use with caution in scripts.", "", "E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)", "E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?"], "stdout": "", "stdout_lines": []}