Re: [packer] Jenkins and Packer

2019-08-21 Thread Rickard von Essen
It seems like you have an old version of Packer. Remove it and install a
new version. Also add packer version to the top of your script.

On Wed, Aug 21, 2019, 23:03 Pietto Vasco  wrote:

> I have a strange issue where i can run packer from the cmdline without
> issue.
>
> But when i setup a jenkins to job schedule the build it fails to build. I
> tried with the packer plugin and without
>
> Running as SYSTEM
>
> Building in workspace C:\Program Files (x86)\Jenkins\workspace\packer build 2
>
> [packer build 2] $ cmd /c call C:\Windows\TEMP\jenkins5282781951821865303.bat
>
>
>
> C:\Program Files (x86)\Jenkins\workspace\packer build 2>packer build 
> C:\Users\Administrator\Documents\vaec-amiauto\vaec-encryptedcrispami.json
>
> Failed to initialize build 'amazon-ebs': provisioner type not found: 
> windows-update
>
> amazon-ebs output will be in this color.
>
>
>
>
>
> ==> Builds finished but no artifacts were created.
>
>
>
> C:\Program Files (x86)\Jenkins\workspace\packer build 2>exit 0
>
> Finished: SUCCESS
>
>
> Attached is my packer plugin config
>
>
>
>
>
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in
> violation of those guidelines may result in your removal from this mailing
> list.
>
> GitHub Issues: https://github.com/mitchellh/packer/issues
> IRC: #packer-tool on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Packer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to packer-tool+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/packer-tool/78116bd3-e3f6-4277-adf6-e91f527a7ff1%40googlegroups.com
> 
> .
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to packer-tool+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CALz9Rt-0n1WBKEnmZtvg%2BfOKGp_%2BqygKZcrn2vULnHyGSdd1uA%40mail.gmail.com.


Re: [packer] ignore building images that already exists

2019-08-21 Thread Rickard von Essen
No you can't do that. As a workaround you can use the aws cli to check if
the AMI exists, if so run packer build with -exclude=amazon-ebs

On Wed, Aug 21, 2019, 23:39 Khai Do  wrote:

> We are using packer with the amazon-ebs builder.  The packer build command
> throws an error when attempting to build an AMI with a name that matches an
> existing AMI on AWS.  I would like to make packer provide the same info but
> NOT fail for this use case?  Instead I would like it to just ignore and
> continue to the next image build.  Is there a way to tell packer to ignore
> builds where an AMI already exists?  something like an
> '-skip-already-exist' flag?
>
> ➜ packer --version
> 1.4.3
> ➜  packer build -var-file=../vars.json template.json
> amazon-ebs output will be in this color.
>
> ==> amazon-ebs: Prevalidating AMI Name: weechat-v1.0.0
> ==> amazon-ebs: Error: AMI Name: 'weechat-v1.0.0' is used by an existing
> AMI: ami-0ee682a1a7e3717d0
> Build 'amazon-ebs' errored: Error: AMI Name: 'weechat-v1.0.0' is used by
> an existing AMI: ami-0ee682a1a7e3717d0
>
> ==> Some builds didn't complete successfully and had errors:
> --> amazon-ebs: Error: AMI Name: 'weechat-v1.0.0' is used by an existing
> AMI: ami-0ee682a1a7e3717d0
>
> ==> Builds finished but no artifacts were created.
> ➜   echo $?
> 1
>
>
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in
> violation of those guidelines may result in your removal from this mailing
> list.
>
> GitHub Issues: https://github.com/mitchellh/packer/issues
> IRC: #packer-tool on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Packer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to packer-tool+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/packer-tool/50f8f68f-aca8-43a0-9e20-7e050475a6d3%40googlegroups.com
> 
> .
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to packer-tool+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CALz9Rt_z6oQcw4r3O%2Bid_2%2BG7V%2BhozTnRkZqUrcGhdBHpXo%3DEA%40mail.gmail.com.


[packer] Timeout waiting for WinRM if running from non-domain joined agents

2019-08-21 Thread Ray
We're trying to run packer build for Azure VM images from unattended 
agents. It happened that everything works if the agents are domain joined. 
As soon as we switch to non-domain joined machines. The same set of 
configuration stopped working with following error:

...
2019-08-21T13:50:20Z: ==> Production: Waiting for WinRM to become 
available...
2019-08-21T14:20:20Z: ==> Production: Timeout waiting for WinRM.
...

The packer version is 1.4.3. Anyone experienced this before? Is there 
special config needed for non-domain joined machines, e.g. SSL? Thanks!

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to packer-tool+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/9cd0e2a2-80b1-490a-b4bb-88b9f3186f67%40googlegroups.com.


[packer] ignore building images that already exists

2019-08-21 Thread Khai Do
We are using packer with the amazon-ebs builder.  The packer build command 
throws an error when attempting to build an AMI with a name that matches an 
existing AMI on AWS.  I would like to make packer provide the same info but 
NOT fail for this use case?  Instead I would like it to just ignore and 
continue to the next image build.  Is there a way to tell packer to ignore 
builds where an AMI already exists?  something like an 
'-skip-already-exist' flag? 

➜ packer --version
1.4.3
➜  packer build -var-file=../vars.json template.json
amazon-ebs output will be in this color.

==> amazon-ebs: Prevalidating AMI Name: weechat-v1.0.0
==> amazon-ebs: Error: AMI Name: 'weechat-v1.0.0' is used by an existing 
AMI: ami-0ee682a1a7e3717d0
Build 'amazon-ebs' errored: Error: AMI Name: 'weechat-v1.0.0' is used by an 
existing AMI: ami-0ee682a1a7e3717d0

==> Some builds didn't complete successfully and had errors:
--> amazon-ebs: Error: AMI Name: 'weechat-v1.0.0' is used by an existing 
AMI: ami-0ee682a1a7e3717d0

==> Builds finished but no artifacts were created.
➜   echo $?
1


-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to packer-tool+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/50f8f68f-aca8-43a0-9e20-7e050475a6d3%40googlegroups.com.


[packer] Jenkins and Packer

2019-08-21 Thread Pietto Vasco
I have a strange issue where i can run packer from the cmdline without 
issue. 

But when i setup a jenkins to job schedule the build it fails to build. I 
tried with the packer plugin and without

Running as SYSTEM

Building in workspace C:\Program Files (x86)\Jenkins\workspace\packer build 2

[packer build 2] $ cmd /c call C:\Windows\TEMP\jenkins5282781951821865303.bat

 

C:\Program Files (x86)\Jenkins\workspace\packer build 2>packer build 
C:\Users\Administrator\Documents\vaec-amiauto\vaec-encryptedcrispami.json 

Failed to initialize build 'amazon-ebs': provisioner type not found: 
windows-update

amazon-ebs output will be in this color.

 

 

==> Builds finished but no artifacts were created.

 

C:\Program Files (x86)\Jenkins\workspace\packer build 2>exit 0 

Finished: SUCCESS


Attached is my packer plugin config





-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to packer-tool+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/78116bd3-e3f6-4277-adf6-e91f527a7ff1%40googlegroups.com.


Re: [packer] Getting packer to be able to change an image from a local GCP bucket

2019-08-21 Thread Rickard von Essen
And to use a non default source image you should set
https://packer.io/docs/builders/googlecompute.html#source_image_project_id

On Wed, Aug 21, 2019, 22:39 Rickard von Essen 
wrote:

> First you have to create an image from the disk in gcs with gcloud, see
> https://cloud.google.com/sdk/gcloud/reference/compute/images/create
>
> Use the --source-uri argument.
>
> On Wed, Aug 21, 2019, 21:58 Wes Quinn  wrote:
>
>> Hello,
>>
>> I am working with packerpy and GCP to be able to load an OVA file to a
>> personal bucket and then modify that image and create a new image from
>> that, using the provisioners feature in a JSON file.
>>
>> I have the process to upload to a personal bucket working, but I can't
>> figure out how to get packer to find my image in my personal bucket.
>> Packer keeps searching the public area.  I didn't see where I can use a
>> bucket.
>>
>> Anyone have any idea on how to get packet to modify the image from the
>> personal bucket?
>>
>> On a separate note, I am able to use packer, in this same manner with
>> AWS, just fine.
>>
>> Here is an example of my JSON for GCP:
>>
>> {
>>   "variables": {
>> "disk_size": 150,
>> "project_id": "proj-id",
>> "result_image": "packer-example-{{timestamp}}",
>> "source_image": "rhel-7-5-x86-64-minimal-ova",
>> "ssh_password": "password",
>> "ssh_timeout": "3m",
>> "ssh_username": "user",
>> "zone": "us-east-1"
>>   },
>>   "builders": [
>> {
>>   "disk_size": "{{user `disk_size`}}",
>>   "image_name": "{{user `result_image`}}",
>>   "project_id": "{{user `project_id`}}",
>>   "source_image": "{{user `source_image`}}",
>>   "ssh_password": "{{user `ssh_password`}}",
>>   "ssh_username": "{{user `ssh_username`}}",
>>   "type": "googlecompute",
>>   "zone": "{{user `zone`}}"
>> }
>>   ],
>>   "provisioners": [
>> {
>>   "type": "file",
>>   "source": "./welcome.sh",
>>   "destination": "/root/",
>>   "direction": "upload"
>> },
>> {
>>   "type": "shell",
>>   "inline": [
>> "chmod +x welcome.sh",
>> "./welcome.sh"
>>   ]
>> }
>>   ]
>> }
>>
>> Here is the Python code that uses the above JSON code:
>> import argparse
>> import json
>> from packerpy import PackerExecutable
>> parser = argparse.ArgumentParser(description='This script modifies a GCP
>> image in GCP.')
>> parser.add_argument('-f', '--json_file', required=True, help='The JSON
>> file that contains the changes to make to the image file.')
>> args = parser.parse_args()
>> json_file = args.json_file
>> packer_bin = '/usr/local/bin/packer'
>> p = PackerExecutable(packer_bin)
>> (results, output, error) = p.build(json_file)
>> if results == 0:
>>   print('Success!')
>> else:
>>   print('Error:', error)
>> print('\nOutput:', output)
>>
>> If you have any questions, please ask.
>>
>> Thank you very much!
>> Wes Quinn
>>
>> --
>> This mailing list is governed under the HashiCorp Community Guidelines -
>> https://www.hashicorp.com/community-guidelines.html. Behavior in
>> violation of those guidelines may result in your removal from this mailing
>> list.
>>
>> GitHub Issues: https://github.com/mitchellh/packer/issues
>> IRC: #packer-tool on Freenode
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Packer" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to packer-tool+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/packer-tool/5b866b6d-1ee3-4632-8df9-1c585d710e77%40googlegroups.com
>> 
>> .
>>
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to packer-tool+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CALz9Rt9b6JyMDc8ykerdz%2BtNcJUShmhM8U5bN%2BUMG1BprNLKDw%40mail.gmail.com.


Re: [packer] Getting packer to be able to change an image from a local GCP bucket

2019-08-21 Thread Rickard von Essen
First you have to create an image from the disk in gcs with gcloud, see
https://cloud.google.com/sdk/gcloud/reference/compute/images/create

Use the --source-uri argument.

On Wed, Aug 21, 2019, 21:58 Wes Quinn  wrote:

> Hello,
>
> I am working with packerpy and GCP to be able to load an OVA file to a
> personal bucket and then modify that image and create a new image from
> that, using the provisioners feature in a JSON file.
>
> I have the process to upload to a personal bucket working, but I can't
> figure out how to get packer to find my image in my personal bucket.
> Packer keeps searching the public area.  I didn't see where I can use a
> bucket.
>
> Anyone have any idea on how to get packet to modify the image from the
> personal bucket?
>
> On a separate note, I am able to use packer, in this same manner with AWS,
> just fine.
>
> Here is an example of my JSON for GCP:
>
> {
>   "variables": {
> "disk_size": 150,
> "project_id": "proj-id",
> "result_image": "packer-example-{{timestamp}}",
> "source_image": "rhel-7-5-x86-64-minimal-ova",
> "ssh_password": "password",
> "ssh_timeout": "3m",
> "ssh_username": "user",
> "zone": "us-east-1"
>   },
>   "builders": [
> {
>   "disk_size": "{{user `disk_size`}}",
>   "image_name": "{{user `result_image`}}",
>   "project_id": "{{user `project_id`}}",
>   "source_image": "{{user `source_image`}}",
>   "ssh_password": "{{user `ssh_password`}}",
>   "ssh_username": "{{user `ssh_username`}}",
>   "type": "googlecompute",
>   "zone": "{{user `zone`}}"
> }
>   ],
>   "provisioners": [
> {
>   "type": "file",
>   "source": "./welcome.sh",
>   "destination": "/root/",
>   "direction": "upload"
> },
> {
>   "type": "shell",
>   "inline": [
> "chmod +x welcome.sh",
> "./welcome.sh"
>   ]
> }
>   ]
> }
>
> Here is the Python code that uses the above JSON code:
> import argparse
> import json
> from packerpy import PackerExecutable
> parser = argparse.ArgumentParser(description='This script modifies a GCP
> image in GCP.')
> parser.add_argument('-f', '--json_file', required=True, help='The JSON
> file that contains the changes to make to the image file.')
> args = parser.parse_args()
> json_file = args.json_file
> packer_bin = '/usr/local/bin/packer'
> p = PackerExecutable(packer_bin)
> (results, output, error) = p.build(json_file)
> if results == 0:
>   print('Success!')
> else:
>   print('Error:', error)
> print('\nOutput:', output)
>
> If you have any questions, please ask.
>
> Thank you very much!
> Wes Quinn
>
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in
> violation of those guidelines may result in your removal from this mailing
> list.
>
> GitHub Issues: https://github.com/mitchellh/packer/issues
> IRC: #packer-tool on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Packer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to packer-tool+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/packer-tool/5b866b6d-1ee3-4632-8df9-1c585d710e77%40googlegroups.com
> 
> .
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to packer-tool+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CALz9Rt8Y0edBKDjHRGuWf4UJGjDW-PigGyFMqignJhPTZTRZLA%40mail.gmail.com.


[packer] Getting packer to be able to change an image from a local GCP bucket

2019-08-21 Thread Wes Quinn
Hello,

I am working with packerpy and GCP to be able to load an OVA file to a 
personal bucket and then modify that image and create a new image from 
that, using the provisioners feature in a JSON file.

I have the process to upload to a personal bucket working, but I can't 
figure out how to get packer to find my image in my personal bucket.  
Packer keeps searching the public area.  I didn't see where I can use a 
bucket.

Anyone have any idea on how to get packet to modify the image from the 
personal bucket?

On a separate note, I am able to use packer, in this same manner with AWS, 
just fine.

Here is an example of my JSON for GCP:

{
  "variables": {
"disk_size": 150,
"project_id": "proj-id",
"result_image": "packer-example-{{timestamp}}",
"source_image": "rhel-7-5-x86-64-minimal-ova",
"ssh_password": "password",
"ssh_timeout": "3m",
"ssh_username": "user",
"zone": "us-east-1"
  },
  "builders": [
{
  "disk_size": "{{user `disk_size`}}",
  "image_name": "{{user `result_image`}}",
  "project_id": "{{user `project_id`}}",
  "source_image": "{{user `source_image`}}",
  "ssh_password": "{{user `ssh_password`}}",
  "ssh_username": "{{user `ssh_username`}}",
  "type": "googlecompute",
  "zone": "{{user `zone`}}"
}
  ],
  "provisioners": [
{
  "type": "file",
  "source": "./welcome.sh",
  "destination": "/root/",
  "direction": "upload"
},
{
  "type": "shell",
  "inline": [
"chmod +x welcome.sh",
"./welcome.sh"
  ]
}
  ]
}

Here is the Python code that uses the above JSON code:
import argparse
import json
from packerpy import PackerExecutable
parser = argparse.ArgumentParser(description='This script modifies a GCP 
image in GCP.')
parser.add_argument('-f', '--json_file', required=True, help='The JSON file 
that contains the changes to make to the image file.')
args = parser.parse_args()
json_file = args.json_file
packer_bin = '/usr/local/bin/packer'
p = PackerExecutable(packer_bin)
(results, output, error) = p.build(json_file)
if results == 0:
  print('Success!')
else:
  print('Error:', error)
print('\nOutput:', output)

If you have any questions, please ask.

Thank you very much!
Wes Quinn

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to packer-tool+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/5b866b6d-1ee3-4632-8df9-1c585d710e77%40googlegroups.com.