hashicorp / hashicorp/packer-plugin-ansible

Ansible provisioner SSL validation error installing roles

Open
#8 0 comments 0 reactions 0 assignees View on GitHub
bug provisioner/ansible-remote
Dominant language
Go
Stars
64
Forks
40
PR merge metrics
No merged PRs in 30d

Description

_This issue was originally opened by @Olesp as hashicorp/packer#10838. It was migrated here as a result of the [Packer plugin split](https://github.com/hashicorp/packer/issues/8610#issuecomment-770034737). The original body of the issue is below._


#### Overview of the Issue

When using the Ansible provisioner. i try to download roles from ansible galaxy with a requirements.yml file.
When trying to get the roles I get an error message ``

Adding `galaxy_command="ansible-galaxy -c"` creates an error `read |0: file already closed`

#### Reproduction Steps

Runing the packer template to create an AMI create the issue.

### Packer version

1.7.0

### Simplified Packer Buildfile

Buildfile

```
source "amazon-ebs" "example"{
assume_role {
role_arn = "arn:aws:iam::xxxxx:role/xxxxxx"
}
instance_type = "t2.micro"
source_ami = "ami-01e7ca2ef94a0ae86"
region = "us-east-2"
ssh_username = "ubuntu"

}

build {
source "source.amazon-ebs.example" {
ami_name = "packer_generated_ami-{{timestamp}}"
ami_description = "This is the first AMI created by packer"
}

provisioner "ansible" {
playbook_file = "./project_1/playbooks/playbook.yml"
galaxy_file="./project_1/requirements.yml"
roles_path="./project_1/roles"
}
}
```

### Operating system and Environment details

Mac OS Big Sur 11.2.3
Python 3.9
Ansible 2.10.7

### Log Fragments and crash.log files

```
==> amazon-ebs.example: Provisioning with Ansible...
amazon-ebs.example: Setting up proxy adapter for Ansible....
amazon-ebs.example: Executing Ansible Galaxy
amazon-ebs.example: Starting galaxy role install process
amazon-ebs.example: [WARNING]: - andrewrothstein.miniconda was NOT installed successfully: Unknown
amazon-ebs.example: error when attempting to call Galaxy at 'https://galaxy.ansible.com/api/':
amazon-ebs.example:
amazon-ebs.example: ERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.
==> amazon-ebs.example: Provisioning step had errors: Running the cleanup provisioner, if present...
==> amazon-ebs.example: Terminating the source AWS instance...
==> amazon-ebs.example: Cleaning up any extra volumes...
==> amazon-ebs.example: No volumes to clean up, skipping
==> amazon-ebs.example: Deleting temporary security group...
==> amazon-ebs.example: Deleting temporary keypair...
Build 'amazon-ebs.example' errored after 1 minute 19 seconds: Error executing Ansible: Error executing Ansible Galaxy: Non-zero exit status: exit status 1
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with the simplified Packer Buildfile and requirements.yml shown in the issue. Inspect the Ansible provisioner's Galaxy execution and proxy/SSL handling; done means roles install successfully without the certificate verification failure or the reported closed-pipe error.

Written by the indexing model from the issue text.

Assessment

Tech stack
ansible, go
Domain
devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.