Rundeck - 运行 commands/jobs 的问题,节点在 resource-yaml 文件中定义
Rundeck - problem with running commands/jobs with nodes defined in resource-yaml file
[SOLVED - answer in comments]
我正在寻求帮助。也许有人已经遇到过这个问题,或者只是知道发生了什么并且可以提供建议?非常感谢!
在 Rundeck 中,我定义了将 Ansible(通过 ansible 插件)设置为执行程序的项目。
在一个项目中,我有两个资源模型:
- Ansible 资源模型源(将 Satellite 设置为动态清单 - 一切按预期工作)
- resourceyaml(不起作用)
这两种资源的配置都列在此 post 的末尾。
如前所述,我正在努力处理 yaml 资源模型中定义的节点 -
- 节点在节点部分可见,但每当我尝试针对它执行命令或作业时,都会抛出错误:
[WARNING]: Could not match supplied host pattern, ignoring: template
ERROR! Specified hosts and/or --limit does not match any hosts
Failed: AnsibleError: ERROR: Ansible execution returned with non zero code.
Execution failed: 116 in project Linux-Ansible: [Workflow result: , step failures: {1=Dispatch failed on 1 nodes: [template: AnsibleError: ERROR: Ansible execution returned with non zero code. + {dataContext=MultiDataContextImpl(map={}, base=null)} ]}, Node failures: {template=[AnsibleError: ERROR: Ansible execution returned with non zero code. + {dataContext=MultiDataContextImpl(map={}, base=null)} ]}, status: failed]
当我通过 cli 执行 ansible 并将 resourceyaml 文件设置为清单时,我可以看到这些警告:
ansible -i /etc/ansible/hosts-rundeck-static.yml all --limit node001@domain.com -m shell -a id
[WARNING]: Skipping key (username) in group (template) as it is not a mapping, it is a <class 'ansible.parsing.yaml.objects.AnsibleUnicode'>
[WARNING]: Skipping key (description) in group (template) as it is not a mapping, it is a <class
'ansible.parsing.yaml.objects.AnsibleUnicode'>
[WARNING]: Skipping key (tags) in group (template) as it is not a mapping, it is a <class 'ansible.parsing.yaml.objects.AnsibleUnicode'>
[WARNING]: Skipping key (hostname) in group (template) as it is not a mapping, it is a <class 'ansible.parsing.yaml.objects.AnsibleUnicode'>
[WARNING]: Skipping key (ssh-keypath) in group (template) as it is not a mapping, it is a <class
'ansible.parsing.yaml.objects.AnsibleUnicode'>
[WARNING]: Skipping key (nodename) in group (template) as it is not a mapping, it is a <class 'ansible.parsing.yaml.objects.AnsibleUnicode'>
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
[WARNING]: Could not match supplied host pattern, ignoring: node001@domain.com
会议。对于资源模型:
- YAML:
Format: resourceyaml
File Path:/etc/ansible/hosts-rundeck-static.yml
Writeable: yes
hosts-rundeck-static.yml 的内容:
---
template:
nodename: node001@domain.com
hostname: 1.2.3.4
username: admin@domain.com
ssh-keypath: keys/ssh_key/key1
description: this is a template node
tags: template
- Ansible 清单:
ansible inventory File path:/etc/ansible/foreman.yml
Ansible config file path:/etc/ansible
Gather Facts: yes
Ignore Host Discovery Errors: yes
SSH Authentication: privateKey
SSH User:admin@domain.com
SSH Key File path:/rundeck/id_ecdsa
Privilege escalation method.: sudo
Ansible 配置文件:
[defaults]
strategy_plugins = /opt/mitogen/ansible_mitogen/plugins/strategy
collections_paths = /etc/ansible/collections
inventory = /etc/ansible/foreman.yml
timeout = 30
[inventory]
enable_plugins = host_list, yaml, script, ini, foreman
[privilege_escalation]
[paramiko_connection]
[ssh_connection]
pipelining = True
[persistent_connection]
[accelerate]
[selinux]
[colors]
[diff]
Rundeck版本:3.3.6-20201111,带Ansible插件版本:3.1.1
有人可以帮我吗?谢谢!
记录答案:遵循 指南并在节点执行器部分(文件名末尾)正确定义 ansible.cfg
/ 库存路径解决了这个问题。
[SOLVED - answer in comments]
我正在寻求帮助。也许有人已经遇到过这个问题,或者只是知道发生了什么并且可以提供建议?非常感谢!
在 Rundeck 中,我定义了将 Ansible(通过 ansible 插件)设置为执行程序的项目。 在一个项目中,我有两个资源模型:
- Ansible 资源模型源(将 Satellite 设置为动态清单 - 一切按预期工作)
- resourceyaml(不起作用)
这两种资源的配置都列在此 post 的末尾。
如前所述,我正在努力处理 yaml 资源模型中定义的节点 -
- 节点在节点部分可见,但每当我尝试针对它执行命令或作业时,都会抛出错误:
[WARNING]: Could not match supplied host pattern, ignoring: template
ERROR! Specified hosts and/or --limit does not match any hosts
Failed: AnsibleError: ERROR: Ansible execution returned with non zero code.
Execution failed: 116 in project Linux-Ansible: [Workflow result: , step failures: {1=Dispatch failed on 1 nodes: [template: AnsibleError: ERROR: Ansible execution returned with non zero code. + {dataContext=MultiDataContextImpl(map={}, base=null)} ]}, Node failures: {template=[AnsibleError: ERROR: Ansible execution returned with non zero code. + {dataContext=MultiDataContextImpl(map={}, base=null)} ]}, status: failed]
当我通过 cli 执行 ansible 并将 resourceyaml 文件设置为清单时,我可以看到这些警告:
ansible -i /etc/ansible/hosts-rundeck-static.yml all --limit node001@domain.com -m shell -a id
[WARNING]: Skipping key (username) in group (template) as it is not a mapping, it is a <class 'ansible.parsing.yaml.objects.AnsibleUnicode'>
[WARNING]: Skipping key (description) in group (template) as it is not a mapping, it is a <class
'ansible.parsing.yaml.objects.AnsibleUnicode'>
[WARNING]: Skipping key (tags) in group (template) as it is not a mapping, it is a <class 'ansible.parsing.yaml.objects.AnsibleUnicode'>
[WARNING]: Skipping key (hostname) in group (template) as it is not a mapping, it is a <class 'ansible.parsing.yaml.objects.AnsibleUnicode'>
[WARNING]: Skipping key (ssh-keypath) in group (template) as it is not a mapping, it is a <class
'ansible.parsing.yaml.objects.AnsibleUnicode'>
[WARNING]: Skipping key (nodename) in group (template) as it is not a mapping, it is a <class 'ansible.parsing.yaml.objects.AnsibleUnicode'>
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
[WARNING]: Could not match supplied host pattern, ignoring: node001@domain.com
会议。对于资源模型:
- YAML:
Format: resourceyaml
File Path:/etc/ansible/hosts-rundeck-static.yml
Writeable: yes
hosts-rundeck-static.yml 的内容:
---
template:
nodename: node001@domain.com
hostname: 1.2.3.4
username: admin@domain.com
ssh-keypath: keys/ssh_key/key1
description: this is a template node
tags: template
- Ansible 清单:
ansible inventory File path:/etc/ansible/foreman.yml
Ansible config file path:/etc/ansible
Gather Facts: yes
Ignore Host Discovery Errors: yes
SSH Authentication: privateKey
SSH User:admin@domain.com
SSH Key File path:/rundeck/id_ecdsa
Privilege escalation method.: sudo
Ansible 配置文件:
[defaults]
strategy_plugins = /opt/mitogen/ansible_mitogen/plugins/strategy
collections_paths = /etc/ansible/collections
inventory = /etc/ansible/foreman.yml
timeout = 30
[inventory]
enable_plugins = host_list, yaml, script, ini, foreman
[privilege_escalation]
[paramiko_connection]
[ssh_connection]
pipelining = True
[persistent_connection]
[accelerate]
[selinux]
[colors]
[diff]
Rundeck版本:3.3.6-20201111,带Ansible插件版本:3.1.1
有人可以帮我吗?谢谢!
记录答案:遵循 ansible.cfg
/ 库存路径解决了这个问题。