我有一本剧本,其中包含一个包含以下内容的文件:
- name: debug tags
debug:
msg: debug tags
tags:
- debugtags
当我运行以下命令时,我期望只执行此剧本。但实际上,没有执行任何剧本。这是在我的 Linux 桌面上的 docker 容器中,因此它需要出去获取剧本。我确信剧本在剧本中。命令(出于安全考虑略作编辑)
/usr/bin/ansible-pull -C dockervm -d /usr/local/ansible -U [email protected]:xxxxx-config-usr_local_ansible.git -i localhost, -e small=yes vagrant=True ServerNamePrefix=docker --accept-host-key -t debugtags /usr/local/ansible/playbooks/docker.yml
需要注意的事项:
- 我已经尝试使用 -t 和 --tags 了。
- 没有 -t 或 --tags,剧本运行良好,并执行所有剧本 - 已经使用了数周
下面,找到有问题的文件和输出
角色/docker/任务/main.yml
- name: check ServerNamePrefix set
fail: msg="ServerNamePrefix not provided"
when: ServerNamePrefix is undefined
- include_tasks: apt_update.yml
#- include_tasks: timezone.yml
#- include_tasks: required_software.yml
- include_tasks: postfix.yml
- include_tasks: bashrc.yml
- include_tasks: diskinit.yml
#- include_tasks: hostfile.yml
- include_tasks: repositories.yml
- include_tasks: web_packages.yml
- include_tasks: configfiles.yml
- include_tasks: modules.yml
- include_tasks: groups.yml
- include_tasks: users.yml
- include_tasks: directories.yml
- include_tasks: wkhtmltopdf.yml
- include_tasks: deploy_env_and_configuration.yml
- include_tasks: pushwildcardssl.yml
- include_tasks: touch_files.yml
- include_tasks: debugtags.yml
角色/docker/任务/debugtags.yml
- name: debug tags
debug:
msg: debug tags
tags:
- debugtags
输出
[WARNING]: Could not match supplied host pattern, ignoring: 4a9190122ed4
localhost | SUCCESS => {
"after": "777b48c3f3018bbf5078602209027da6d2b61feb",
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"before": "777b48c3f3018bbf5078602209027da6d2b61feb",
"changed": false,
"remote_url_changed": false
}
[WARNING]: Could not match supplied host pattern, ignoring: 4a9190122ed4
PLAY [all] *********************************************************************
TASK [Gathering Facts] *********************************************************
ok: [localhost]
PLAY RECAP *********************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
所以我很困惑。有什么想法吗?
艾德格林伯格