ansible-local 打包机不会取货 collections
ansible-local in packer wont pickup collections
我在 Packer 中使用 ansible-local 配置器,并尝试使用 community.general collection,但是我根本无法让我的剧本看到它。
Packer 代码是:
{
"type": "ansible-local",
"staging_directory": "/tmp/packer-provisioner-ansible-local",
"command": "ANSIBLE_COLLECTIONS_PATHS=/tmp/packer-provisioner-ansible-local/collections/roles ansible-playbook",
"playbook_file": "{{ user `jenkins_workspace` }}/packer/ansible/playbook.yml",
"playbook_dir": "{{ user `jenkins_workspace` }}/packer/ansible",
"galaxy_command": "ANSIBLE_COLLECTIONS_PATHS=/tmp/packer-provisioner-ansible-local/collections/roles ansible-galaxy collection",
"galaxy_file": "{{ user `jenkins_workspace` }}/packer/ansible/collections/requirements.yml",
"inventory_groups": "{{user `inventory_groups`}}"
}
collections似乎在正确的目录下安装没有问题
amazon-ebs: Executing Ansible Galaxy: cd /tmp/packer-provisioner-ansible-local && ANSIBLE_COLLECTIONS_PATHS=/tmp/packer-provisioner-ansible-local/roles ansible-galaxy collection install -r /tmp/packer-provisioner-ansible-local/requirements.yml -p /tmp/packer-provisioner-ansible-local/roles
amazon-ebs: |Installing 'community.general:2.0.0' to '/tmp/packer-provisioner-ansible-local/roles/ansible_collections/community/general'
然而 Ansible 无法使用它
amazon-ebs: Executing Ansible: cd /tmp/packer-provisioner-ansible-local && ANSIBLE_COLLECTIONS_PATHS=/tmp/packer-provisioner-ansible-local/roles ansible-playbook /tmp/packer-provisioner-ansible-local/playbook.yml --extra-vars "packer_build_name=amazon-ebs packer_builder_type=amazon-ebs packer_http_addr=ERR_HTTP_ADDR_NOT_IMPLEMENTED_BY_BUILDER -o IdentitiesOnly=yes" -c local -i /tmp/packer-provisioner-ansible-local/packer-provisioner-ansible-local801906075
amazon-ebs: ERROR! couldn't resolve module/action 'community.general.docker_compose'. This often indicates a misspelling, missing collection, or incorrect module path.
有问题的 Anisble 播放是
- name: Docker compose build the containers
community.general.docker_compose:
recreate: never
pull: yes
build: yes
state: present
stopped: yes
project_src: "{{ home }}"
任何关于我哪里出错的建议都很好....
这是因为我使用的是 Ansible 2.9,而该功能仅在 2.10 中出现(这会告诉我不要检查我正在阅读的文档版本 :D )。
遗憾的是,Ansible 错误提到如果不能使用集合就会丢失...
ERROR! couldn't resolve module/action 'community.general.docker_compose'. This often indicates a misspelling, missing collection, or incorrect module path.
希望这个问题能对处于类似位置的其他人有所帮助。
我在 Packer 中使用 ansible-local 配置器,并尝试使用 community.general collection,但是我根本无法让我的剧本看到它。
Packer 代码是:
{
"type": "ansible-local",
"staging_directory": "/tmp/packer-provisioner-ansible-local",
"command": "ANSIBLE_COLLECTIONS_PATHS=/tmp/packer-provisioner-ansible-local/collections/roles ansible-playbook",
"playbook_file": "{{ user `jenkins_workspace` }}/packer/ansible/playbook.yml",
"playbook_dir": "{{ user `jenkins_workspace` }}/packer/ansible",
"galaxy_command": "ANSIBLE_COLLECTIONS_PATHS=/tmp/packer-provisioner-ansible-local/collections/roles ansible-galaxy collection",
"galaxy_file": "{{ user `jenkins_workspace` }}/packer/ansible/collections/requirements.yml",
"inventory_groups": "{{user `inventory_groups`}}"
}
collections似乎在正确的目录下安装没有问题
amazon-ebs: Executing Ansible Galaxy: cd /tmp/packer-provisioner-ansible-local && ANSIBLE_COLLECTIONS_PATHS=/tmp/packer-provisioner-ansible-local/roles ansible-galaxy collection install -r /tmp/packer-provisioner-ansible-local/requirements.yml -p /tmp/packer-provisioner-ansible-local/roles
amazon-ebs: |Installing 'community.general:2.0.0' to '/tmp/packer-provisioner-ansible-local/roles/ansible_collections/community/general'
然而 Ansible 无法使用它
amazon-ebs: Executing Ansible: cd /tmp/packer-provisioner-ansible-local && ANSIBLE_COLLECTIONS_PATHS=/tmp/packer-provisioner-ansible-local/roles ansible-playbook /tmp/packer-provisioner-ansible-local/playbook.yml --extra-vars "packer_build_name=amazon-ebs packer_builder_type=amazon-ebs packer_http_addr=ERR_HTTP_ADDR_NOT_IMPLEMENTED_BY_BUILDER -o IdentitiesOnly=yes" -c local -i /tmp/packer-provisioner-ansible-local/packer-provisioner-ansible-local801906075
amazon-ebs: ERROR! couldn't resolve module/action 'community.general.docker_compose'. This often indicates a misspelling, missing collection, or incorrect module path.
有问题的 Anisble 播放是
- name: Docker compose build the containers
community.general.docker_compose:
recreate: never
pull: yes
build: yes
state: present
stopped: yes
project_src: "{{ home }}"
任何关于我哪里出错的建议都很好....
这是因为我使用的是 Ansible 2.9,而该功能仅在 2.10 中出现(这会告诉我不要检查我正在阅读的文档版本 :D )。
遗憾的是,Ansible 错误提到如果不能使用集合就会丢失...
ERROR! couldn't resolve module/action 'community.general.docker_compose'. This often indicates a misspelling, missing collection, or incorrect module path.
希望这个问题能对处于类似位置的其他人有所帮助。