Re: [packer] packer environment trying to setup on centos 7

2018-03-08 Thread Rickard von Essen
Can you search your VMware installation for the file netmap.conf? where is
it located? Which OS are you running?

On 9 March 2018 at 04:35, talha jilal  wrote:

> another issue with same packer ,
>
> :( any clue ?
>
>
> vmware-iso output will be in this color.
>
> ==> vmware-iso: Downloading or copying ISO
> vmware-iso: Downloading or copying: file:///usr/src/packer-
> vagrant/CentOS-7-x86_64-Minimal-1708.iso
> ==> vmware-iso: Creating virtual machine disk
> ==> vmware-iso: Building and writing VMX file
> ==> vmware-iso: Could not find netmap conf file: /etc/vmware/netmap.conf
> ==> vmware-iso: Deleting output directory...
> Build 'vmware-iso' errored: Could not find netmap conf file:
> /etc/vmware/netmap.conf
>
> ==> Some builds didn't complete successfully and had errors:
> --> vmware-iso: Could not find netmap conf file: /etc/vmware/netmap.conf
>
> ==> Builds finished but no artifacts were created.
>
>
>
>
> On Thursday, 8 March 2018 17:10:52 UTC-5, talha jilal wrote:
>>
>> Hey Thanks this works for me.
>>
>>
>> On Thursday, 8 March 2018 01:53:30 UTC-5, Rickard von Essen wrote:
>>>
>>> Ensure that tools_upload_flavor is empty, see https://www.packer.io/docs
>>> /builders/vmware-iso.html#tools_upload_flavor
>>>
>>> On Mar 8, 2018 07:26, "talha jilal"  wrote:
>>>
 Hello Friends ,

 I currently trying to setup another envirnoment on Centos 7.  My idea
 is to create a Esxi template by using redhat or centos 7 VM in vcenter and
 reproduce templates.


 1- Centos 7 VM.
 2- Packer (
 packer  -v
 1.2.1
 3-  VMware packages installed ,

 VMware-VIX-1.15.0-2985596.x86_64.bundle
 VMware-ovftool-4.1.0-2459827-lin.x86_64.bundle
 VMware-vSphere-CLI-5.0.0-615831.x86_64.tar.gz
 VMware-Player-7.1.2-2780323.x86_64.bundle

 4- I am having the following error , please also find my json file at
 the bottom.

 packer  build esxi-template.json
 vmware-iso output will be in this color.

 Build 'vmware-iso' errored: Couldn't find VMware tools for 'linux'!
 VMware often downloads these
 tools on-demand. However, to do this, you need to create a fake VM
 of the proper type then click the 'install tools' option in the
 VMware GUI.

 ==> Some builds didn't complete successfully and had errors:
 --> vmware-iso: Couldn't find VMware tools for 'linux'! VMware often
 downloads these
 tools on-demand. However, to do this, you need to create a fake VM
 of the proper type then click the 'install tools' option in the
 VMware GUI.

 ==> Builds finished but no artifacts were created.





 ## JSON FILE   cat  esxi-template.json
 ##



 {
   "provisioners": [
 {
   "type": "shell",
   "execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash
 '{{.Path}}'",
   "script": "scripts/ansible.sh"
 }
   ],
   "builders": [
 {
   "type": "vmware-iso",
   "boot_command": [
 " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort
 }}/ks.cfg"
   ],
   "boot_wait": "10s",
   "disk_size": 81920,
   "guest_os_type": "centos-64",
   "headless": true,
   "http_directory": "http",
   "iso_urls": [
 "CentOS-7-x86_64-Minimal-1708.iso",
 "CentOS-7-x86_64-Minimal-1708.iso"
   ],
   "iso_checksum_type": "sha256",
   "iso_checksum": "bba314624956961a2ea31dd460cd8
 60a77911c1e0a56e4820a12b9c5dad363f5",
   "ssh_username": "vagrant",
   "ssh_password": "vagrant",
   "ssh_port": 22,
   "ssh_wait_timeout": "1s",
   "shutdown_command": "echo 'vagrant'|sudo -S /sbin/halt -h -p",
   "remote_host": "192.168.2.50",
   "remote_datastore": "datastore1",
   "remote_username": "root",
   "remote_password": "somepass",
   "ssh_username": "root",
   "ssh_password": "vagrant",
   "ssh_wait_timeout": "60m",
   "tools_upload_flavor": "linux",
   "http_directory": ".",
   "boot_wait": "5s",
   "vmx_data": {
 "memsize": "2048",
 "numvcpus": "2",
 "ethernet0.present": "TRUE",
 "ethernet0.startConnected": "TRUE",
 "ethernet0.virtualDev": "e1000",
 "ethernet0.addressType": "generated",
 "ethernet0.generatedAddressOffset": "0",
 "ethernet0.wakeOnPcktRcv": "FALSE"
  },
   "tools_upload_flavor": "linux",
   "vm_name": "vmware-template",
   "vmx_data": {
 "cpuid.coresPerSocket": "2",
 "memsize": "2048",
 "numvcpus": "2"
   }
 }
   ],
   "post-processors": [
 {
 "type": "vsphere",

Re: [packer] Error executing packer build on Ubuntu VM (Xenial)

2018-03-08 Thread Rickard von Essen
Great troubleshooting. I don't know LXC/LXD very well but I expect that
there is some network script that runs on startup and adjusts the network
settings. Looks like it is possible to get in before that has completed.

On Mar 9, 2018 2:04 AM, "Peter Goodall"  wrote:

> Seems to be a timing issue. Runs OK with -debug flag on packer.
>
> sleep 15s makes it suceed too:
>
> "provisioners": [
>   {
> "type": "shell",
> "inline": [
>   "lsb_release -a",
>   "sleep 15s",
>   "cat /etc/resolv.conf",
>   "ping -c 1 archive.ubuntu.com",
>   "apt-get update && apt-get install -y python-minimal" ]
>   },
>
>  packer build -debug template.json
> Debug mode enabled. Builds will not be parallelized.
> lxd-xenial output will be in this color.
>
> ==> lxd-xenial: Creating container...
> ==> lxd-xenial: Pausing after run of step 'stepLxdLaunch'. Press enter to 
> continue.
> ==> lxd-xenial: Provisioning with shell script: /tmp/packer-shell373068117
> lxd-xenial: Distributor ID:Ubuntu
> lxd-xenial: No LSB modules are available.
> lxd-xenial: Description:Ubuntu 16.04.4 LTS
> lxd-xenial: Release:16.04
> lxd-xenial: Codename:xenial
> lxd-xenial: # Dynamic resolv.conf(5) file for glibc resolver(3) generated 
> by resolvconf(8)
> lxd-xenial: # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE 
> OVERWRITTEN
> lxd-xenial: nameserver 10.89.242.1
> lxd-xenial: search lxd
> lxd-xenial: PING archive.ubuntu.com (91.189.88.162) 56(84) bytes of data.
> lxd-xenial: 64 bytes from yukinko.canonical.com (91.189.88.162): 
> icmp_seq=1 ttl=48 time=278 ms
> lxd-xenial:
> lxd-xenial: --- archive.ubuntu.com ping statistics ---
> lxd-xenial: 1 packets transmitted, 1 received, 0% packet loss, time 0ms
> lxd-xenial: rtt min/avg/max/mdev = 278.910/278.910/278.910/0.000 ms
> lxd-xenial: Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease
> lxd-xenial: Get:2 http://security.ubuntu.com/ubuntu xenial-security 
> InRelease [102 kB]
> lxd-xenial: Get:3 http://archive.ubuntu.com/ubuntu xenial-updates 
> InRelease [102 kB]
> lxd-xenial: Get:4 http://security.ubuntu.com/ubuntu xenial-security/main 
> amd64 Packages [463 kB]
> lxd-xenial: Get:5 http://archive.ubuntu.com/ubuntu xenial-backports 
> InRelease [102 kB]
> lxd-xenial: Get:6 http://archive.ubuntu.com/ubuntu xenial/universe amd64 
> Packages [7532 kB]
>
> On Friday, March 9, 2018 at 11:51:49 AM UTC+11, Peter Goodall wrote:
>
> Hello Rickard,
>>
>> I am using ‘ubuntu-daily:16.04’ as my base_image.
>> have attached relevant files. Project very similar to the example you
>> posted for me some time ago.
>> Here is the output from running packer:
>>
>>  packer build template.json
>> lxd-xenial output will be in this color.
>>
>> ==> lxd-xenial: Creating container...
>> ==> lxd-xenial: Provisioning with shell script: /tmp/packer-shell321894822
>> lxd-xenial: Distributor ID: Ubuntu
>> lxd-xenial: No LSB modules are available.
>> lxd-xenial: Description:Ubuntu 16.04.4 LTS
>> lxd-xenial: Release:16.04
>> lxd-xenial: Codename:   xenial
>> lxd-xenial: # Dynamic resolv.conf(5) file for glibc resolver(3) 
>> generated by resolvconf(8)
>> lxd-xenial: # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE 
>> OVERWRITTEN
>> lxd-xenial: ping: unknown host archive.ubuntu.com
>> ==> lxd-xenial: Unregistering and deleting deleting container...
>>
>> On Saturday, January 20, 2018 at 7:22:41 PM UTC+11, Rickard von Essen
>> wrote:
>>
>> Can you share your packer template?
>>>
>>> On Jan 20, 2018 06:01, "HSB"  wrote:
>>>
 Hi, Created new VM Box using Vagrant. I can SSH and also connect to
 internet from that host.

 But when I execute packer build (type: lxd) with shell commands for
 ubuntu updates, I get following error. I can CURL all of the following urls
 from command line successfully. I have name-servers setup properly.

 But, I am not sure why packer is complaining about it? Thoughts?

 xenial-container: Firewall stopped and disabled on system startup
 xenial-container: sudo: unable to resolve host
 packer-xenial-container: Connection refused
 xenial-container: Err:1 http://security.ubuntu.com/ubuntu
 xenial-security InRelease
 xenial-container:   Temporary failure resolving '
 security.ubuntu.com'
 xenial-container: Err:2 http://archive.ubuntu.com/ubuntu xenial
 InRelease
 xenial-container:   Temporary failure resolving 'archive.ubuntu.com
 '
 xenial-container: Err:3 http://archive.ubuntu.com/ubuntu
 xenial-updates InRelease
 xenial-container:   Temporary failure resolving 'archive.ubuntu.com
 '
 xenial-container: Err:4 http://archive.ubuntu.com/ubuntu
 xenial-backports InRelease
 xenial-container:   

Re: [packer] packer environment trying to setup on centos 7

2018-03-08 Thread talha jilal
another issue with same packer , 

:( any clue ? 


vmware-iso output will be in this color.

==> vmware-iso: Downloading or copying ISO
vmware-iso: Downloading or copying: 
file:///usr/src/packer-vagrant/CentOS-7-x86_64-Minimal-1708.iso
==> vmware-iso: Creating virtual machine disk
==> vmware-iso: Building and writing VMX file
==> vmware-iso: Could not find netmap conf file: /etc/vmware/netmap.conf
==> vmware-iso: Deleting output directory...
Build 'vmware-iso' errored: Could not find netmap conf file: 
/etc/vmware/netmap.conf

==> Some builds didn't complete successfully and had errors:
--> vmware-iso: Could not find netmap conf file: /etc/vmware/netmap.conf

==> Builds finished but no artifacts were created.




On Thursday, 8 March 2018 17:10:52 UTC-5, talha jilal wrote:
>
> Hey Thanks this works for me. 
>
>
> On Thursday, 8 March 2018 01:53:30 UTC-5, Rickard von Essen wrote:
>>
>> Ensure that tools_upload_flavor is empty, see 
>> https://www.packer.io/docs/builders/vmware-iso.html#tools_upload_flavor
>>
>> On Mar 8, 2018 07:26, "talha jilal"  wrote:
>>
>>> Hello Friends , 
>>>
>>> I currently trying to setup another envirnoment on Centos 7.  My idea is 
>>> to create a Esxi template by using redhat or centos 7 VM in vcenter and 
>>> reproduce templates. 
>>>
>>>
>>> 1- Centos 7 VM. 
>>> 2- Packer ( 
>>> packer  -v
>>> 1.2.1
>>> 3-  VMware packages installed , 
>>>
>>> VMware-VIX-1.15.0-2985596.x86_64.bundle
>>> VMware-ovftool-4.1.0-2459827-lin.x86_64.bundle
>>> VMware-vSphere-CLI-5.0.0-615831.x86_64.tar.gz
>>> VMware-Player-7.1.2-2780323.x86_64.bundle
>>>
>>> 4- I am having the following error , please also find my json file at 
>>> the bottom. 
>>>
>>> packer  build esxi-template.json
>>> vmware-iso output will be in this color.
>>>
>>> Build 'vmware-iso' errored: Couldn't find VMware tools for 'linux'! 
>>> VMware often downloads these
>>> tools on-demand. However, to do this, you need to create a fake VM
>>> of the proper type then click the 'install tools' option in the
>>> VMware GUI.
>>>
>>> ==> Some builds didn't complete successfully and had errors:
>>> --> vmware-iso: Couldn't find VMware tools for 'linux'! VMware often 
>>> downloads these
>>> tools on-demand. However, to do this, you need to create a fake VM
>>> of the proper type then click the 'install tools' option in the
>>> VMware GUI.
>>>
>>> ==> Builds finished but no artifacts were created.
>>>
>>>
>>>
>>>
>>>
>>> ## JSON FILE   cat  esxi-template.json 
>>> ##
>>>
>>>
>>>
>>> {
>>>   "provisioners": [
>>> {
>>>   "type": "shell",
>>>   "execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash 
>>> '{{.Path}}'",
>>>   "script": "scripts/ansible.sh"
>>> }
>>>   ],
>>>   "builders": [
>>> {
>>>   "type": "vmware-iso",
>>>   "boot_command": [
>>> " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort 
>>> }}/ks.cfg"
>>>   ],
>>>   "boot_wait": "10s",
>>>   "disk_size": 81920,
>>>   "guest_os_type": "centos-64",
>>>   "headless": true,
>>>   "http_directory": "http",
>>>   "iso_urls": [
>>> "CentOS-7-x86_64-Minimal-1708.iso",
>>> "CentOS-7-x86_64-Minimal-1708.iso"
>>>   ],
>>>   "iso_checksum_type": "sha256",
>>>   "iso_checksum": 
>>> "bba314624956961a2ea31dd460cd860a77911c1e0a56e4820a12b9c5dad363f5",
>>>   "ssh_username": "vagrant",
>>>   "ssh_password": "vagrant",
>>>   "ssh_port": 22,
>>>   "ssh_wait_timeout": "1s",
>>>   "shutdown_command": "echo 'vagrant'|sudo -S /sbin/halt -h -p",
>>>   "remote_host": "192.168.2.50",
>>>   "remote_datastore": "datastore1",
>>>   "remote_username": "root",
>>>   "remote_password": "somepass",
>>>   "ssh_username": "root",
>>>   "ssh_password": "vagrant",
>>>   "ssh_wait_timeout": "60m",
>>>   "tools_upload_flavor": "linux",
>>>   "http_directory": ".",
>>>   "boot_wait": "5s",
>>>   "vmx_data": {
>>> "memsize": "2048",
>>> "numvcpus": "2",
>>> "ethernet0.present": "TRUE",
>>> "ethernet0.startConnected": "TRUE",
>>> "ethernet0.virtualDev": "e1000",
>>> "ethernet0.addressType": "generated",
>>> "ethernet0.generatedAddressOffset": "0",
>>> "ethernet0.wakeOnPcktRcv": "FALSE"
>>>  },
>>>   "tools_upload_flavor": "linux",
>>>   "vm_name": "vmware-template",
>>>   "vmx_data": {
>>> "cpuid.coresPerSocket": "2",
>>> "memsize": "2048",
>>> "numvcpus": "2"
>>>   }
>>> }
>>>   ],
>>>   "post-processors": [
>>> {
>>> "type": "vsphere",
>>> "host": "192.168.2.50",
>>> "insecure": true,
>>> "username": "root",
>>> "password": "somepass",
>>> "datacenter": "some",
>>> "vm_name": "packer-build-centos7",
>>> "vm_folder": "vagrant",
>>> "datastore": "datastore1",
>>> "cluster": "some"
>>>
>>> }
>>> ]
>>> }
>>>
>>> -- 
>>> 

Re: [packer] Error executing packer build on Ubuntu VM (Xenial)

2018-03-08 Thread Peter Goodall


Seems to be a timing issue. Runs OK with -debug flag on packer.

sleep 15s makes it suceed too:

"provisioners": [
  {
"type": "shell",
"inline": [ 
  "lsb_release -a",
  "sleep 15s",
  "cat /etc/resolv.conf",
  "ping -c 1 archive.ubuntu.com",
  "apt-get update && apt-get install -y python-minimal" ]
  },

 packer build -debug template.json
Debug mode enabled. Builds will not be parallelized.
lxd-xenial output will be in this color.

==> lxd-xenial: Creating container...
==> lxd-xenial: Pausing after run of step 'stepLxdLaunch'. Press enter to 
continue. 
==> lxd-xenial: Provisioning with shell script: /tmp/packer-shell373068117
lxd-xenial: Distributor ID:Ubuntu
lxd-xenial: No LSB modules are available.
lxd-xenial: Description:Ubuntu 16.04.4 LTS
lxd-xenial: Release:16.04
lxd-xenial: Codename:xenial
lxd-xenial: # Dynamic resolv.conf(5) file for glibc resolver(3) generated 
by resolvconf(8)
lxd-xenial: # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE 
OVERWRITTEN
lxd-xenial: nameserver 10.89.242.1
lxd-xenial: search lxd
lxd-xenial: PING archive.ubuntu.com (91.189.88.162) 56(84) bytes of data.
lxd-xenial: 64 bytes from yukinko.canonical.com (91.189.88.162): icmp_seq=1 
ttl=48 time=278 ms
lxd-xenial:
lxd-xenial: --- archive.ubuntu.com ping statistics ---
lxd-xenial: 1 packets transmitted, 1 received, 0% packet loss, time 0ms
lxd-xenial: rtt min/avg/max/mdev = 278.910/278.910/278.910/0.000 ms
lxd-xenial: Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease
lxd-xenial: Get:2 http://security.ubuntu.com/ubuntu xenial-security 
InRelease [102 kB]
lxd-xenial: Get:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease 
[102 kB]
lxd-xenial: Get:4 http://security.ubuntu.com/ubuntu xenial-security/main 
amd64 Packages [463 kB]
lxd-xenial: Get:5 http://archive.ubuntu.com/ubuntu xenial-backports 
InRelease [102 kB]
lxd-xenial: Get:6 http://archive.ubuntu.com/ubuntu xenial/universe amd64 
Packages [7532 kB]

On Friday, March 9, 2018 at 11:51:49 AM UTC+11, Peter Goodall wrote:

Hello Rickard,
>
> I am using ‘ubuntu-daily:16.04’ as my base_image.
> have attached relevant files. Project very similar to the example you 
> posted for me some time ago.
> Here is the output from running packer:
>
>  packer build template.json
> lxd-xenial output will be in this color.
>
> ==> lxd-xenial: Creating container...
> ==> lxd-xenial: Provisioning with shell script: /tmp/packer-shell321894822
> lxd-xenial: Distributor ID: Ubuntu
> lxd-xenial: No LSB modules are available.
> lxd-xenial: Description:Ubuntu 16.04.4 LTS
> lxd-xenial: Release:16.04
> lxd-xenial: Codename:   xenial
> lxd-xenial: # Dynamic resolv.conf(5) file for glibc resolver(3) generated 
> by resolvconf(8)
> lxd-xenial: # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE 
> OVERWRITTEN
> lxd-xenial: ping: unknown host archive.ubuntu.com
> ==> lxd-xenial: Unregistering and deleting deleting container...
>
> On Saturday, January 20, 2018 at 7:22:41 PM UTC+11, Rickard von Essen 
> wrote:
>
> Can you share your packer template?
>>
>> On Jan 20, 2018 06:01, "HSB"  wrote:
>>
>>> Hi, Created new VM Box using Vagrant. I can SSH and also connect to 
>>> internet from that host.
>>>
>>> But when I execute packer build (type: lxd) with shell commands for 
>>> ubuntu updates, I get following error. I can CURL all of the following urls 
>>> from command line successfully. I have name-servers setup properly. 
>>>
>>> But, I am not sure why packer is complaining about it? Thoughts?
>>>
>>> xenial-container: Firewall stopped and disabled on system startup
>>> xenial-container: sudo: unable to resolve host 
>>> packer-xenial-container: Connection refused
>>> xenial-container: Err:1 http://security.ubuntu.com/ubuntu 
>>> xenial-security InRelease
>>> xenial-container:   Temporary failure resolving 'security.ubuntu.com
>>> '
>>> xenial-container: Err:2 http://archive.ubuntu.com/ubuntu xenial 
>>> InRelease
>>> xenial-container:   Temporary failure resolving 'archive.ubuntu.com'
>>> xenial-container: Err:3 http://archive.ubuntu.com/ubuntu 
>>> xenial-updates InRelease
>>> xenial-container:   Temporary failure resolving 'archive.ubuntu.com'
>>> xenial-container: Err:4 http://archive.ubuntu.com/ubuntu 
>>> xenial-backports InRelease
>>> xenial-container:   Temporary failure resolving 'archive.ubuntu.com'
>>>
>>> xenial-container: W: Failed to fetch 
>>> http://archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease  
>>> Temporary failure resolving 'archive.ubuntu.com'
>>> xenial-container: W: Failed to fetch 
>>> http://archive.ubuntu.com/ubuntu/dists/xenial-backports/InRelease  
>>> Temporary failure resolving 'archive.ubuntu.com'
>>> xenial-container: W: Failed to fetch 
>>> 

Re: [packer] Error executing packer build on Ubuntu VM (Xenial)

2018-03-08 Thread Peter Goodall
Hello Rickard,

I am having a very similar problem. It seems that the working container, 
which has been started from packer, has no dns resolution set up. My packer 
files are very similar to those you posted for me earlier - which some 
variables for input and output image names, and a few container shell 
debugging commands.

template.json:
-

{
"variables": {
  "base_im": "{{env `base_image`}}",
  "output_im": "{{env `output_image`}}"
},

"builders": [
  {
"type": "lxd",
"name": "lxd-xenial",
"image":  "{{user `base_im`}}",
"output_image": "{{user `output_im`}}",
"publish_properties": {
  "description": "Trivial repackage with Packer"
}
  }
],
"provisioners": [
  {
"type": "shell",
"inline": [ 
  "lsb_release -a",
  "cat /etc/resolv.conf",
  "ping -c 1 archive.ubuntu.com",
  "apt-get update && apt-get install -y python-minimal" ]
  },
  {
"type": "ansible",
"playbook_file": "./playbook.yml",
"extra_arguments": [ "-c", "lxd", "-i", "packer-lxd-xenial,", "-l", 
"packer-lxd-xenial" ]
  }
]
  }

playbook.yml: 
--

---
- hosts: all
  tasks:
- name: Shelling
  shell: echo "Hello world"

Cheers,
--Peter Goodall

On Saturday, January 20, 2018 at 7:22:41 PM UTC+11, Rickard von Essen wrote:
>
> Can you share your packer template?
>
> On Jan 20, 2018 06:01, "HSB"  wrote:
>
>> Hi, Created new VM Box using Vagrant. I can SSH and also connect to 
>> internet from that host.
>>
>> But when I execute packer build (type: lxd) with shell commands for 
>> ubuntu updates, I get following error. I can CURL all of the following urls 
>> from command line successfully. I have name-servers setup properly. 
>>
>> But, I am not sure why packer is complaining about it? Thoughts?
>> [...]
>>
>

-- 
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/669756c5-2621-4b9e-a69c-dc69f6aa01a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [packer] Error executing packer build on Ubuntu VM (Xenial)

2018-03-08 Thread Peter Goodall
Hello,

Can you let me know what the problem was please. I am having the same issue.
I am building from 'ubuntu-daily:16.04' as a base, from a ubuntu 16.04  
host.

Cheers,
--Peter G

On Sunday, January 21, 2018 at 6:11:27 AM UTC+11, HSB wrote:
>
> Thanks. After some debugging and playing around, I found that the issue 
> was with Linux Container configuration and packer failed executing commands 
> on Linux Container. 
>
> [...]
>>
>>

-- 
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/626db34b-7899-4ad5-9159-ae893257e968%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [packer] packer environment trying to setup on centos 7

2018-03-08 Thread talha jilal
Hey Thanks this works for me. 


On Thursday, 8 March 2018 01:53:30 UTC-5, Rickard von Essen wrote:
>
> Ensure that tools_upload_flavor is empty, see 
> https://www.packer.io/docs/builders/vmware-iso.html#tools_upload_flavor
>
> On Mar 8, 2018 07:26, "talha jilal"  
> wrote:
>
>> Hello Friends , 
>>
>> I currently trying to setup another envirnoment on Centos 7.  My idea is 
>> to create a Esxi template by using redhat or centos 7 VM in vcenter and 
>> reproduce templates. 
>>
>>
>> 1- Centos 7 VM. 
>> 2- Packer ( 
>> packer  -v
>> 1.2.1
>> 3-  VMware packages installed , 
>>
>> VMware-VIX-1.15.0-2985596.x86_64.bundle
>> VMware-ovftool-4.1.0-2459827-lin.x86_64.bundle
>> VMware-vSphere-CLI-5.0.0-615831.x86_64.tar.gz
>> VMware-Player-7.1.2-2780323.x86_64.bundle
>>
>> 4- I am having the following error , please also find my json file at the 
>> bottom. 
>>
>> packer  build esxi-template.json
>> vmware-iso output will be in this color.
>>
>> Build 'vmware-iso' errored: Couldn't find VMware tools for 'linux'! 
>> VMware often downloads these
>> tools on-demand. However, to do this, you need to create a fake VM
>> of the proper type then click the 'install tools' option in the
>> VMware GUI.
>>
>> ==> Some builds didn't complete successfully and had errors:
>> --> vmware-iso: Couldn't find VMware tools for 'linux'! VMware often 
>> downloads these
>> tools on-demand. However, to do this, you need to create a fake VM
>> of the proper type then click the 'install tools' option in the
>> VMware GUI.
>>
>> ==> Builds finished but no artifacts were created.
>>
>>
>>
>>
>>
>> ## JSON FILE   cat  esxi-template.json 
>> ##
>>
>>
>>
>> {
>>   "provisioners": [
>> {
>>   "type": "shell",
>>   "execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash 
>> '{{.Path}}'",
>>   "script": "scripts/ansible.sh"
>> }
>>   ],
>>   "builders": [
>> {
>>   "type": "vmware-iso",
>>   "boot_command": [
>> " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort 
>> }}/ks.cfg"
>>   ],
>>   "boot_wait": "10s",
>>   "disk_size": 81920,
>>   "guest_os_type": "centos-64",
>>   "headless": true,
>>   "http_directory": "http",
>>   "iso_urls": [
>> "CentOS-7-x86_64-Minimal-1708.iso",
>> "CentOS-7-x86_64-Minimal-1708.iso"
>>   ],
>>   "iso_checksum_type": "sha256",
>>   "iso_checksum": 
>> "bba314624956961a2ea31dd460cd860a77911c1e0a56e4820a12b9c5dad363f5",
>>   "ssh_username": "vagrant",
>>   "ssh_password": "vagrant",
>>   "ssh_port": 22,
>>   "ssh_wait_timeout": "1s",
>>   "shutdown_command": "echo 'vagrant'|sudo -S /sbin/halt -h -p",
>>   "remote_host": "192.168.2.50",
>>   "remote_datastore": "datastore1",
>>   "remote_username": "root",
>>   "remote_password": "somepass",
>>   "ssh_username": "root",
>>   "ssh_password": "vagrant",
>>   "ssh_wait_timeout": "60m",
>>   "tools_upload_flavor": "linux",
>>   "http_directory": ".",
>>   "boot_wait": "5s",
>>   "vmx_data": {
>> "memsize": "2048",
>> "numvcpus": "2",
>> "ethernet0.present": "TRUE",
>> "ethernet0.startConnected": "TRUE",
>> "ethernet0.virtualDev": "e1000",
>> "ethernet0.addressType": "generated",
>> "ethernet0.generatedAddressOffset": "0",
>> "ethernet0.wakeOnPcktRcv": "FALSE"
>>  },
>>   "tools_upload_flavor": "linux",
>>   "vm_name": "vmware-template",
>>   "vmx_data": {
>> "cpuid.coresPerSocket": "2",
>> "memsize": "2048",
>> "numvcpus": "2"
>>   }
>> }
>>   ],
>>   "post-processors": [
>> {
>> "type": "vsphere",
>> "host": "192.168.2.50",
>> "insecure": true,
>> "username": "root",
>> "password": "somepass",
>> "datacenter": "some",
>> "vm_name": "packer-build-centos7",
>> "vm_folder": "vagrant",
>> "datastore": "datastore1",
>> "cluster": "some"
>>
>> }
>> ]
>> }
>>
>> -- 
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/packer-tool/6460479d-d45a-4ac7-8a78-1efbcf23643c%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 

Re: [packer] Set Docker environment variables WITHOUT using "ENV"

2018-03-08 Thread Ivan Ribakov
 Alvaro: 

I posted this question here because of the Packer way to build Docker 
images, i.e. without using Dockerfiles. I'm hoping that this place has 
higher concentration of people who work with Docker without Dockerfiles and 
as such can help me with my query.
In case you are wondering, earlier snippet can be replicated using 
following Packer template 
. 
P.S. last line in the snippet should be "docker run" not "docker exec".

Rickard:

Thanks again for taking your time today to help me out. Another answer 
 on my SO question already 
suggested use of "--changes": it is definitely the winning option for me at 
the moment.

However, I would like to use this opportunity to ask if after all there is 
an alternative to "--changes" that can be performed by one of provisioners. 
Reason I'm looking for an alternative is that I'm using Ansible playbook to 
provision both Docker and Vagrant images. My only option for now to set 
PATH correctly in Docker seems to be to duplicate PATH configuration inside 
Packer template and I don't like the idea of repeating the configuration 
for obvious reasons.

I appreciate that this is not an issue with Packer at all, but as mentioned 
earlier, seeing how this forum has a high concentration of people who work 
with Docker without Dockerfiles I was hoping that someone might know a 
better answer (and if not, could perhaps at least hint where the limitation 
lies).


On Thursday, 8 March 2018 19:33:20 UTC+1, Rickard von Essen wrote:
>
> Use changes and ENV to set the PATH, see 
> https://www.packer.io/docs/builders/docker.html#basic-example-changes-to-metadata
>
> On Mar 8, 2018 7:00 PM, "Alvaro Miranda Aguilera"  > wrote:
>
>> where packer fits here ?
>>
>> On Thu, Mar 8, 2018 at 6:02 PM, Ivan Ribakov > > wrote:
>>
>>> I'm building a docker image and using Ansible for provisioning. I would 
>>> like to be able to update image's PATH variable from inside the container 
>>> (I don't need these changes to take effect immediately, as long as they are 
>>> commited to an image and are available later). Is there a way to do it?
>>>
>>> To illustrate my point:
>>>
>>> $ docker run -itd --name test centos:6 
>>> $ docker exec -it test /bin/bash 
>>> [root@006a9c3195b6 /]# echo 'echo SUCCESS' > /root/test.sh 
>>> [root@006a9c3195b6 /]# chmod +x /root/test.sh 
>>> [root@006a9c3195b6 /]# echo 'export PATH=/root:$PATH' > 
>>> /etc/profile.d/my_settings.sh 
>>> [root@006a9c3195b6 /]# echo 'PATH=/root:$PATH' > /etc/environment 
>>> [root@006a9c3195b6 /]# echo 'export PATH=/root:$PATH' > ~/.bashrc
>>> [root@006a9c3195b6 /]# exit 
>>> $ docker commit test test-image:1 
>>> $ docker exec -it test-image:1 test.sh
>>> OCI runtime exec failed: exec failed: container_linux.go:296: starting 
>>> container process caused "exec: \"test.sh\": executable file not found in 
>>> $PATH": unknown
>>>
>>>
>>> However, following works:
>>>
>>> $ docker run -it test-image:1 /bin/bash
>>> [root@8f821c7b9b82 /]# test.sh 
>>> SUCCESS
>>>
>>>
>>> Any ideas as to what I'm doing wrong?
>>>
>>> -- 
>>> 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...@googlegroups.com .
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/packer-tool/e4cb8df6-fe4e-48bc-9064-64ce4cabae79%40googlegroups.com
>>>  
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>> Alvaro
>>
>> -- 
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/packer-tool/CAHqq0eyK01mTYLZDQmxdz-U%3DWbFj39dFkcNHEDZ883nXukym9Q%40mail.gmail.com
>>  
>> 

Re: [packer] Set Docker environment variables WITHOUT using "ENV"

2018-03-08 Thread Alvaro Miranda Aguilera
where packer fits here ?

On Thu, Mar 8, 2018 at 6:02 PM, Ivan Ribakov 
wrote:

> I'm building a docker image and using Ansible for provisioning. I would
> like to be able to update image's PATH variable from inside the container
> (I don't need these changes to take effect immediately, as long as they are
> commited to an image and are available later). Is there a way to do it?
>
> To illustrate my point:
>
> $ docker run -itd --name test centos:6
> $ docker exec -it test /bin/bash
> [root@006a9c3195b6 /]# echo 'echo SUCCESS' > /root/test.sh
> [root@006a9c3195b6 /]# chmod +x /root/test.sh
> [root@006a9c3195b6 /]# echo 'export PATH=/root:$PATH' > 
> /etc/profile.d/my_settings.sh
> [root@006a9c3195b6 /]# echo 'PATH=/root:$PATH' > /etc/environment
> [root@006a9c3195b6 /]# echo 'export PATH=/root:$PATH' > ~/.bashrc
> [root@006a9c3195b6 /]# exit
> $ docker commit test test-image:1
> $ docker exec -it test-image:1 test.sh
> OCI runtime exec failed: exec failed: container_linux.go:296: starting 
> container process caused "exec: \"test.sh\": executable file not found in 
> $PATH": unknown
>
>
> However, following works:
>
> $ docker run -it test-image:1 /bin/bash
> [root@8f821c7b9b82 /]# test.sh
> SUCCESS
>
>
> Any ideas as to what I'm doing wrong?
>
> --
> 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/e4cb8df6-fe4e-48bc-9064-64ce4cabae79%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Alvaro

-- 
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/CAHqq0eyK01mTYLZDQmxdz-U%3DWbFj39dFkcNHEDZ883nXukym9Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[packer] Set Docker environment variables WITHOUT using "ENV"

2018-03-08 Thread Ivan Ribakov
I'm building a docker image and using Ansible for provisioning. I would 
like to be able to update image's PATH variable from inside the container 
(I don't need these changes to take effect immediately, as long as they are 
commited to an image and are available later). Is there a way to do it?

To illustrate my point:

$ docker run -itd --name test centos:6 
$ docker exec -it test /bin/bash 
[root@006a9c3195b6 /]# echo 'echo SUCCESS' > /root/test.sh 
[root@006a9c3195b6 /]# chmod +x /root/test.sh 
[root@006a9c3195b6 /]# echo 'export PATH=/root:$PATH' > 
/etc/profile.d/my_settings.sh 
[root@006a9c3195b6 /]# echo 'PATH=/root:$PATH' > /etc/environment 
[root@006a9c3195b6 /]# echo 'export PATH=/root:$PATH' > ~/.bashrc
[root@006a9c3195b6 /]# exit 
$ docker commit test test-image:1 
$ docker exec -it test-image:1 test.sh
OCI runtime exec failed: exec failed: container_linux.go:296: starting 
container process caused "exec: \"test.sh\": executable file not found in 
$PATH": unknown


However, following works:

$ docker run -it test-image:1 /bin/bash
[root@8f821c7b9b82 /]# test.sh 
SUCCESS


Any ideas as to what I'm doing wrong?

-- 
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/e4cb8df6-fe4e-48bc-9064-64ce4cabae79%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [packer] Re: packer build on Mac: Change output directory from /var/folders to /Volumes/...

2018-03-08 Thread Rickard von Essen
MacOS sets TMPDIR to /var/... by default try changing that. See
https://www.packer.io/docs/other/environment-variables.html#tmpdir

On Mar 8, 2018 2:00 PM, "Christian Nolte"  wrote:

> This unfortunately does not help. Packer still tries to save some
> intermediary files in  /var/folders.
>
> I am using parallels provider for VM creation
>
> Am Donnerstag, 1. März 2018 11:19:12 UTC+1 schrieb Christian Nolte:
>>
>> Hi!
>>
>> I would like to change the output dir of packer build from
>> /var/folders... to an external storage under /Volumes. Is that possible?
>>
>> Cheers,
>> Christian
>>
> --
> 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/1c613659-9057-46e8-bc9f-6d4edf7e05e8%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CALz9Rt9UFAOdyJAGdeSFXiLbohiZkagPsMWm%3Dtc6KRL6OgZBjg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [packer] packer build on Mac: Change output directory from /var/folders to /Volumes/...

2018-03-08 Thread Christian Nolte

Sorry for replying again - this did not work for me as packer still tries 
to save to /var/folders:

-860e329aab41}.hds

*Build 'parallels-iso' errored: 1 error(s) occurred:*



** Post-processor failed: write 
/var/folders/1m/lp9cmp090wx05482mhfp08k10b/T/packer262128344/WindowsServer2016Docker.pvm/harddisk1.hdd/harddisk1.hdd.0.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds:
 
no space left on device*




Am Donnerstag, 1. März 2018 12:22:44 UTC+1 schrieb Rickard von Essen:
>
> See 
> https://www.packer.io/docs/builders/virtualbox-iso.html#output_directory
>
>
> On Mar 1, 2018 11:19, "Christian Nolte"  
> wrote:
>
>> Hi!
>>
>> I would like to change the output dir of packer build from 
>> /var/folders... to an external storage under /Volumes. Is that possible?
>>
>> Cheers,
>> Christian
>>
>> -- 
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/packer-tool/87de5376-7ecc-46a4-a86d-5820b0758cff%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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/2bea6b24-85b2-439d-bdd3-949140e386c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[packer] Re: packer build on Mac: Change output directory from /var/folders to /Volumes/...

2018-03-08 Thread Christian Nolte
This unfortunately does not help. Packer still tries to save some 
intermediary files in  /var/folders.

I am using parallels provider for VM creation

Am Donnerstag, 1. März 2018 11:19:12 UTC+1 schrieb Christian Nolte:
>
> Hi!
>
> I would like to change the output dir of packer build from /var/folders... 
> to an external storage under /Volumes. Is that possible?
>
> Cheers,
> Christian
>

-- 
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/1c613659-9057-46e8-bc9f-6d4edf7e05e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [packer] Skip shutdown

2018-03-08 Thread Alvaro Miranda Aguilera
However it feels that you can think into a 2 step process

packer does step 1 and you get a intermediate box
step 2 publish the tested box



On Wed, Mar 7, 2018 at 7:35 PM, Rickard von Essen <
rickard.von.es...@gmail.com> wrote:

> Then I would end my provisioning with a file provisioner which downloads a
> marker (empty) file and then a script that exits with 1. And then wrap the
> Packer build in a script that checks if the marker file exists.
>
> On 7 March 2018 at 18:56, valli nayagam  wrote:
>
>> I'm using vmware-iso builder and would like to use the machine for other
>> operations without power on again.
>>
>> *Example:*
>> Step 1: Building Debian server and installing an app using ansible
>> provision.
>> Step 2: Run automation scripts and tests against above provisioned
>> machine.
>>
>> Regards
>> Vallinayagam.K
>>
>> On Wednesday, 7 March 2018 22:52:06 UTC+5:30, Rickard von Essen wrote:
>>>
>>> No in general it's not. Which builder do you use and what's the reason
>>> for this?
>>>
>>> On Mar 7, 2018 17:02, "valli nayagam"  wrote:
>>>
>>> Hi All
>>>
>>> Is it possible to skip the shutdown operation after build and
>>> provisioning the machine?
>>>
>>> I'm not sure whether my understanding is valid, but looking for some
>>> answers.
>>>
>>> Thanks in advance.
>>>
>>> Regards
>>> Vallinayagam. K
>>>
>>> --
>>> 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...@googlegroups.com.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/packer-tool/19e1a8e4-95d8-446b-bc09-432fdce5e3ba%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>> --
>> 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/ms
>> gid/packer-tool/3ff6adc6-04c6-4795-a9f7-ee7747cab193%40googlegroups.com
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> 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/CALz9Rt8-T8POz0ALNFPzX0tRCiGWmQQzeMYqhr
> P1wJ%3DHFGKtEA%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Alvaro

-- 
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/CAHqq0ewOBBFSWW1Hsh37Ft2LGtjAcc1nUTiYm5sM8b%2BRD7M1tA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [packer] Ansible + Docker instead of multiple Dockerfiles. Should I use multiple Packer template files?

2018-03-08 Thread Alvaro Miranda Aguilera
in your code, packer will build the 2 docker in parallel

and on each of them ansible will run

you will end with 2 dockers

then if the ansible filter by name, then should work

you may need to check the container gets the name you need, maybe tweak the
execute command

if I run it as is:

xenial-git: hostname: f39716ea17ed

xenial-vim: hostname: 8f052d9779d6

so if your ansible requires match hostname, i did update the repo, so now
it does:

*==> xenial-vim: Provisioning with shell script: xenial-all.sh*

xenial-git: hostname: xenial-git

xenial-vim: hostname: xenial-vim

https://github.com/kikitux/packer-multidocker/commit/578441c9d3d4577ab22dd2a918a548aa3c16e7ef

Alvaro

On Wed, Mar 7, 2018 at 3:21 PM, Loric Brevet  wrote:

> Thank you for your precise explanation, and for having posted this code as
> example on GitHub.
>
> These conditions on provisioning can effectively bring some interest for
> this purpose.
>
> Usually, docker-compose files contain less that 10 containers. So it maybe
> possible to keep them definitely in the same file.
>
> In the end, it seem to be more a matter of readability and maintenance to
> decide to split them into separate JSON files.
>
> What I can notice however – correct me if I am wrong – is that it is not
> possible to have multiple builders provisioned only once by one
> provisioning script.
> It seems the provisioning is triggered once per builder.
>
> In Ansible, we usually define an inventory as followed.
>
> [git]
> xenial-git
>
> [vim]
> xenial-vim
>
> And so launching the playbook would at once match the corresponding
> builder from the inventory and install the git package in the git
> container, and the vim package in the vim container.
>
> That behavior does not seem possible with Packer + Ansible + Docker.
>
> That would correspond to a Packer JSON file more or less as below.
>
> {
> "variables": {
> },
> "builders": [
> {
> "commit": true,
> "image": "ubuntu:xenial",
> "pull": true,
> "type": "docker",
> "name": "xenial-vim",
> "run_command": [
> "-d","-t","{{.Image}}",
> "/bin/bash","-l"
> ]
> },
> {
> "commit": true,
> "image": "ubuntu:xenial",
> "pull": true,
> "type": "docker",
> "name": "xenial-git",
> "run_command": [
> "-d","-t","{{.Image}}",
> "/bin/bash","-l"
> ]
> }
> ],
> "post-processors": [
> {
> "only": [ "xenial-vim" ],
> "repository": "xenial-vim",
> "tag": "latest",
> "type": "docker-tag"
> },
> {
> "only": [ "xenial-git" ],
> "repository": "xenial-git",
> "tag": "latest",
> "type": "docker-tag"
> }
> ],
> "provisioners": [
> {
> "type": "ansible",
> "playbook_file": "ansible/myplaybook.yml"
> }
> ]
> }
>
> Packer could process to this sequence of actions:
>
>- Create xenial-vim base image from the first builder
>- Create xenial-git base image from the second builder
>- Create a dynamic inventory for Ansible
>- Execute only once the provisioning to provision at once the two
>previous builder images
>- Commit, tag and push xenial-vim to the xenial-vim repository
>- Commit, tag and push xenial-git to the xenial-git repository
>
>
> Can you confirm this is not really doable with Packer? Or at least the
> provisioning would be launched twice?
>
> Thank you so much,
> Loric
>
>
> On Wednesday, 7 March 2018 12:05:21 UTC+1, Alvaro Miranda Aguilera wrote:
>
>> Hello
>>
>> Yes, can be done
>>
>>
>>
>>
>>
>> TL;DR check this:
>> https://github.com/kikitux/packer-multidocker
>>
>>
>>
>>
>> for many many dockers, I would suggest have one json per docker and have
>> something like a make file
>>
>> but for 2 its still doable
>>
>> say you have 2 dockers, and you want 3 provision to run, one shared and
>> one local
>>
>> the feature you need is inside each build you can use a name.
>>
>> "builders": [
>>
>> {
>>
>> ..
>>
>> "image": "ubuntu:xenial",
>>
>> ..
>>
>> "type": "docker",
>>
>> "name": "xenial-vim",
>>
>> ..
>>
>> },
>>
>>
>>
>>
>>
>> for your request, imagine you have db and www but to keep things simple i
>> just used vim/git
>>
>>
>> for this example i did
>>
>> xenial-vim
>> xenial-git
>>
>> both get htop installed but then a local script run vim gets vim, git
>> gets git
>>
>> root@ubuntu-1604-vmware:/vagrant/multidocker# docker run --rm xenial-vim
>> which htop vim git
>>
>> /usr/bin/htop
>>
>> /usr/bin/vim
>>
>> root@ubuntu-1604-vmware:/vagrant/multidocker# docker run --rm xenial-git
>> which htop vim git
>>
>> /usr/bin/htop
>>
>> /usr/bin/git
>>
>>