ansible-playbook -i inventory/testenv ./deploy.yml提示line 1, column 3错误

来源:3-5 Ansible playbooks入门和编写规范(下)

smniuhe

2020-07-11

(.py3-a2.5-env) [deploy@iZuf6iq8e7ya9v3ix71k0pZ test_playbooks]$ ansible-playbook -i inventory/testenv ./deploy.yml

ERROR! The requested action was not found in configured module paths. Additionally, core modules are missing. If this is a checkout, run 'git submodule update --init --recursive' to correct this problem.

The error appears to have been in '/home/deploy/test_playbooks/roles/testbox/tasks/main.yml': line 1, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


- name: Print server name and user to remote testbox
  ^ here


The error appears to have been in '/home/deploy/test_playbooks/roles/testbox/tasks/main.yml': line 1, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


- name: Print server name and user to remote testbox
  ^ here

main.yml

- name: Print server name and user to remote testbox
  shell: "echo 'Currently {{ user }} is logining {{ server_name }}' > {{ output }}"
写回答

6回答

smniuhe

提问者

2020-07-18

遇到这个问题,应该是某个安装环节出了问题,我是继续先前学,然后重新再安装,解决了,建议尽量和老师环境一样,可以减少错误率,github clone ansible repository 的问题可以通过 gitee 去解决

1
0

一路向北

2020-07-12

在ansible目录执行git submodule update --init --recursive
然后再尝试 deploy

0
4
qq_精慕门7592651
回复
一路向北
重新安装也没用。。这个问题怎么解决呢。。。
2022-03-14
共4条回复

smniuhe

提问者

2020-07-12

(.py3-a2.5-env) [deploy@iZuf6iq8e7ya9v3ix71k0pZ test_playbooks]$ vim deploy.yml


//img.mukewang.com/szimg/5f0a6d9309c0d99708880348.jpg



(.py3-a2.5-env) [deploy@iZuf6iq8e7ya9v3ix71k0pZ test_playbooks]$ vim inventory/testenv

//img1.sycdn.imooc.com/szimg/5f0a6dc5097dd7d306720410.jpg


(.py3-a2.5-env) [deploy@iZuf6iq8e7ya9v3ix71k0pZ test_playbooks]$ vim roles/testbox/tasks/main.yml
//img.mukewang.com/szimg/5f0a6dea09fc20a512100258.jpg

0
0

一路向北

2020-07-12

建议把代码内容发过来

0
1
smniuhe
贴出来了
2020-07-12
共1条回复

smniuhe

提问者

2020-07-12

相关代码和结构

//img.mukewang.com/szimg/5f0a6b1209a8275414440448.jpg//img.mukewang.com/szimg/5f0a6b00098e2f4213200220.jpg

0
0

一路向北

2020-07-12

建议把代码贴过来看一下

0
1
smniuhe
老师,我贴上面了
2020-07-12
共1条回复

Jenkins+Ansible+Gitlab-三剑合璧掌握自动化部署

整合三大工具解决自动化部署&持续交付问题

1290 学习 · 319 问题

查看课程