172 похожих чатов

Всем привет! Кто то сможет подсказать что с этим делать? Я только

учусь в этом направлении

Проблема с ansible

macOS Monterey (12.6.2)

____________________
vagrant --version
Vagrant 2.3.6

ansible --version
ansible [core 2.15.0]
config file = /Users/devashe/netology/Vagrant/ansible.cfg
configured module search path = ['/Users/devashe/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ansible
ansible collection location = /Users/devashe/.ansible/collections:/usr/share/ansible/collections
executable location = /Library/Frameworks/Python.framework/Versions/3.9/bin/ansible
python version = 3.9.6 (v3.9.6:db3ff76da1, Jun 28 2021, 11:49:53) [Clang 6.0 (clang-600.0.57)] (/usr/local/bin/python3.9)
jinja version = 3.1.2
libyaml = True
____________________

____________________
%vagrant provision
==> server1.netology: Running provisioner: ansible...
Vagrant gathered an unknown Ansible version:


and falls back on the compatibility mode '1.8'.

Alternatively, the compatibility mode can be specified in your Vagrantfile:
https://www.vagrantup.com/docs/provisioning/ansible_common.html#compatibility_mode

server1.netology: Running ansible-playbook...
usage: ansible-playbook [-h] [--version] [-v] [--private-key PRIVATE_KEY_FILE]
[-u REMOTE_USER] [-c CONNECTION] [-T TIMEOUT]
[--ssh-common-args SSH_COMMON_ARGS]
[--sftp-extra-args SFTP_EXTRA_ARGS]
[--scp-extra-args SCP_EXTRA_ARGS]
[--ssh-extra-args SSH_EXTRA_ARGS]
[-k | --connection-password-file CONNECTION_PASSWORD_FILE]
[--force-handlers] [--flush-cache] [-b]
[--become-method BECOME_METHOD]
[--become-user BECOME_USER]
[-K | --become-password-file BECOME_PASSWORD_FILE]
[-t TAGS] [--skip-tags SKIP_TAGS] [-C] [-D]
[-i INVENTORY] [--list-hosts] [-l SUBSET]
[-e EXTRA_VARS] [--vault-id VAULT_IDS]
[--ask-vault-password | --vault-password-file VAULT_PASSWORD_FILES]
[-f FORKS] [-M MODULE_PATH] [--syntax-check]
[--list-tasks] [--list-tags] [--step]
[--start-at-task START_AT_TASK]
playbook [playbook ...]
ansible-playbook: error: unrecognized arguments: --sudo
***
***
***
______________________

______________________

как я поннимаю нужно пофиксить эту проблему с единствееным error
которая появляется из за каких то проблем с версией ansible
"ansible-playbook: error: unrecognized arguments: --sudo"

но в provision.yml(playbook) нет ничего с --sudo

______________________
Plyabook
---

- hosts: nodes
become: yes
become_user: root
remote_user: vagrant

tasks:
- name: Create directory for ssh-keys
file: state=directory mode=0700 dest=/root/.ssh/

- name: Adding rsa-key in /root/.ssh/authorized_keys
copy: src=~/.ssh/id_rsa.pub dest=/root/.ssh/authorized_keys owner=root mode=0600
ignore_errors: yes

- name: Checking DNS
command: host -t A google.com

- name: Installing tools
apt: >
package={{ item }}
state=present
update_cache=yes
with_items:
- git
- curl

- name: Installing docker
shell: curl -fsSL get.docker.com -o get-docker.sh && chmod +x get-docker.sh && ./get-docker.sh

- name: Add the current user to docker group
user: name=vagrant append=yes groups=docker

может кто сталкивался? или понимает куда копать?

10 ответов

50 просмотров

гуглить ошибки уже не принято? compatibility_mode = "2.0" может помочь

покажи вагрантфайл

Илья- Автор вопроса
Elenhil
покажи вагрантфайл

# -*- mode: ruby -*- ISO = "bento/ubuntu-20.04" NET = "192.168.56." DOMAIN = ".netology" HOST_PREFIX = "server" INVENTORY_PATH = "./inventory" servers = [ { :hostname => HOST_PREFIX + "1" + DOMAIN, :ip => NET + "11", :ssh_host => "20011", :ssh_vm => "22", :ram => 1024, :core => 1 } ] Vagrant.configure(2) do |config| config.vm.synced_folder ".", "/vagrant", disabled: false servers.each do |machine| config.vm.define machine[:hostname] do |node| node.vm.box = ISO node.vm.hostname = machine[:hostname] node.vm.network "private_network", ip: machine[:ip] node.vm.network :forwarded_port, guest: machine[:ssh_vm], host: machine[:ssh_host] node.vm.provider "virtualbox" do |vb| vb.customize ["modifyvm", :id, "--memory", machine[:ram]] vb.customize ["modifyvm", :id, "--cpus", machine[:core]] vb.name = machine[:hostname] end node.vm.provision "ansible" do |setup| setup.inventory_path = INVENTORY_PATH setup.playbook = "./provision.yml" setup.become = true setup.extra_vars = { ansible_user: 'vagrant' } end end end end

Илья
# -*- mode: ruby -*- ISO = "bento/ubuntu-20.04" N...

https://github.com/geerlingguy/ansible-vagrant-examples/issues/83#issuecomment-1100742489

Илья- Автор вопроса
Elenhil
https://github.com/geerlingguy/ansible-vagrant-exa...

Не помогло результат тот же python3 -m pip install --user ansible Requirement already satisfied: ansible in /Users/devashe/Library/Python/3.10/lib/python/site-packages (8.0.0) Requirement already satisfied: ansible-core~=2.15.0 in /Users/devashe/Library/Python/3.10/lib/python/site-packages (from ansible) (2.15.0) Requirement already satisfied: jinja2>=3.0.0 in /Users/devashe/Library/Python/3.10/lib/python/site-packages (from ansible-core~=2.15.0->ansible) (3.1.2) Requirement already satisfied: cryptography in /Users/devashe/Library/Python/3.10/lib/python/site-packages (from ansible-core~=2.15.0->ansible) (41.0.1) Requirement already satisfied: resolvelib<1.1.0,>=0.5.3 in /Users/devashe/Library/Python/3.10/lib/python/site-packages (from ansible-core~=2.15.0->ansible) (1.0.1) Requirement already satisfied: PyYAML>=5.1 in /Users/devashe/Library/Python/3.10/lib/python/site-packages (from ansible-core~=2.15.0->ansible) (6.0) Requirement already satisfied: packaging in /Users/devashe/Library/Python/3.10/lib/python/site-packages (from ansible-core~=2.15.0->ansible) (23.1) Requirement already satisfied: MarkupSafe>=2.0 in /Users/devashe/Library/Python/3.10/lib/python/site-packages (from jinja2>=3.0.0->ansible-core~=2.15.0->ansible) (2.1.3) Requirement already satisfied: cffi>=1.12 in /Users/devashe/Library/Python/3.10/lib/python/site-packages (from cryptography->ansible-core~=2.15.0->ansible) (1.15.1) Requirement already satisfied: pycparser in /Users/devashe/Library/Python/3.10/lib/python/site-packages (from cffi>=1.12->cryptography->ansible-core~=2.15.0->ansible) (2.21) [notice] A new release of pip is available: 23.0.1 -> 23.1.2 [notice] To update, run: python3 -m pip install --upgrade pip devashe@Devashe87 vagrant % ansible --version ansible [core 2.15.0] config file = /Users/devashe/netology/Vagrant/ansible.cfg configured module search path = ['/Users/devashe/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /Users/devashe/Library/Python/3.10/lib/python/site-packages/ansible ansible collection location = /Users/devashe/.ansible/collections:/usr/share/ansible/collections executable location = /Users/devashe/Library/Python/3.10/bin/ansible python version = 3.10.11 (v3.10.11:7d4cc5aa85, Apr 4 2023, 19:05:19) [Clang 13.0.0 (clang-1300.0.29.30)] (/usr/local/bin/python3) jinja version = 3.1.2 libyaml = True _____________________ _____________________ ansible... Vagrant gathered an unknown Ansible version: and falls back on the compatibility mode '1.8'. Alternatively, the compatibility mode can be specified in your Vagrantfile: https://www.vagrantup.com/docs/provisioning/ansible_common.html#compatibility_mode server1.netology: Running ansible-playbook... usage: ansible-playbook [-h] [--version] [-v] [--private-key PRIVATE_KEY_FILE] [-u REMOTE_USER] [-c CONNECTION] [-T TIMEOUT] [--ssh-common-args SSH_COMMON_ARGS] [--sftp-extra-args SFTP_EXTRA_ARGS] [--scp-extra-args SCP_EXTRA_ARGS] [--ssh-extra-args SSH_EXTRA_ARGS] [-k | --connection-password-file CONNECTION_PASSWORD_FILE] [--force-handlers] [--flush-cache] [-b] [--become-method BECOME_METHOD] [--become-user BECOME_USER] [-K | --become-password-file BECOME_PASSWORD_FILE] [-t TAGS] [--skip-tags SKIP_TAGS] [-C] [-D] [-i INVENTORY] [--list-hosts] [-l SUBSET] [-e EXTRA_VARS] [--vault-id VAULT_IDS] [--ask-vault-password | --vault-password-file VAULT_PASSWORD_FILES] [-f FORKS] [-M MODULE_PATH] [--syntax-check] [--list-tasks] [--list-tags] [--step] [--start-at-task START_AT_TASK] playbook [playbook ...] ansible-playbook: error: unrecognized arguments: --sudo

Илья- Автор вопроса
Elenhil
vagrantfile покажи

# -*- mode: ruby -*- ISO = "bento/ubuntu-20.04" NET = "192.168.56." DOMAIN = ".netology" HOST_PREFIX = "server" INVENTORY_PATH = "./inventory" servers = [ { :hostname => HOST_PREFIX + "1" + DOMAIN, :ip => NET + "11", :ssh_host => "20011", :ssh_vm => "22", :ram => 1024, :core => 1 } ] Vagrant.configure(2) do |config| config.vm.synced_folder ".", "/vagrant", disabled: false servers.each do |machine| config.vm.define machine[:hostname] do |node| node.vm.box = ISO node.vm.hostname = machine[:hostname] node.vm.network "private_network", ip: machine[:ip] node.vm.network :forwarded_port, guest: machine[:ssh_vm], host: machine[:ssh_host] node.vm.provider "virtualbox" do |vb| vb.customize ["modifyvm", :id, "--memory", machine[:ram]] vb.customize ["modifyvm", :id, "--cpus", machine[:core]] vb.name = machine[:hostname] end node.vm.provision "ansible" do |setup| setup.inventory_path = INVENTORY_PATH setup.playbook = "./provision.yml" setup.become = true setup.extra_vars = { ansible_user: 'vagrant' } end end end end

Илья
# -*- mode: ruby -*- ISO = "bento/ubuntu-20.04" N...

ansible.compatibility_mode = "2.0" inside the config.vm.provision "ansible" do |ansible| block.

Илья- Автор вопроса
Elenhil
ansible.compatibility_mode = "2.0" inside the conf...

Да! Спасибо! Я вчера это вроде делал, но похоже как то не так... Спасибо еще раз, выручили! 🍻

Илья- Автор вопроса
AlexD
гуглить ошибки уже не принято? compatibility_mode ...

И тебе спасибо!) Ты был прав с самого начала! Вчера когда пробовал что то пошло не так видимо, это сработало!

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
Чёт не понял, я ж правильной функцией воспользовался чтобы вывести отладочную информацию? но что-то она не ловится
notme
18
У меня есть функция где происходит это: write_bit(buffer, 1); write_bit(buffer, 0); write_bit(buffer, 1); write_bit(buffer, 1); write_bit(buffer, 1); w...
~
14
Добрый день! Скажите пожалуйста, а какие программы вы бы рекомендовали написать для того, чтобы научиться управлять памятью? Можно написать динамический массив, можно связный ...
Филипп
7
Недавно Google Project Zero нашёл багу в SQLite с помощью LLM, о чём достаточно было шумно в определённых интернетах, которые сопровождались рассказами, что скоро всех "ибешни...
Alex Sherbakov
5
Ребят в СИ можно реализовать ООП?
Николай
33
https://github.com/erlang/otp/blob/OTP-27.1/lib/kernel/src/logger_h_common.erl#L174 https://github.com/erlang/otp/blob/OTP-27.1/lib/kernel/src/logger_olp.erl#L76 15 лет назад...
Maksim Lapshin
20
Карта сайта