Provisioner shell inline command does not run

23 views
Skip to first unread message

jz

unread,
May 7, 2020, 2:19:00 AM5/7/20
to Packer
Pack 1.5.5
vsphere-iso v2.3
Photon 3

Running into an issue: the provisioner section seems never be executed. Here is the json file:

  "builders": [
    {
      "type": "vsphere-iso",

      "vcenter_server":      "vcsas11001.mycompany.com",
      "username":            "admini...@vsphere.local",
      "password":            "XXXXXXXXXXXXX",
      "insecure_connection": "true",
      "vm_name": "photon3-ga-1",
      "notes": "Build via Packer",
      "cluster": "VxRail-Virtual-SAN-Cluster-XXXXX",
      "host": "esxas11001.mycompany.com",
      "datastore": "VxRail-Virtual-SAN-Datastore-XXXXX",
      "folder": "MY VMs",

      "guest_os_type": "vmwarePhoton64Guest",

      "ssh_username": "sshuser",
      "ssh_password": "XXXXXX",

      "CPUs":             2,
      "RAM":              4096,
      "RAM_reserve_all": false,
      "network": "Management Network-XXXXX",

      "convert_to_template": false,

      "disk_controller_type":  "pvscsi",
      "disk_size":        25000,
      "disk_thin_provisioned": true,

      "network_card": "vmxnet3",
      "shutdown_command": "",

      "iso_paths": ["[VxRail-Virtual-SAN-Datastore-XXXXX] iso/photon-os-3.0-ga/photon-3.0-58f9c74-bundle.iso"],
      "floppy_files": [
        "{{user `ks_path`}}/photon_ks.cfg"
      ],
      "boot_command": ["<esc><wait>",
                                "vmlinuz initrd=initrd.img root=/dev/ram0 loglevel=3 ks=cdrom:/isolinux/photon_ks.cfg photon.media=cdrom",
                                "<enter>"]
      }
  ],

   "provisioners": [
   {
     "type": "shell",
     "inline": ["mkdir -p /tmp/threetimes"],
     "only": ["vsphere-iso"]
   }
  ]
}

All I am doing is to create a dummy directory under /tmp. With or without  "only": ["vsphere-iso"] is the same result - no directory is created. Anything wrong here?

Thanks,

J

jz

unread,
May 7, 2020, 10:58:09 AM5/7/20
to Packer
Just clarify - the reason I am doing this is try to run a command line to create a new user in inline. Also this user is meant to be a ssh user from Packer host to VM. I am using Photon so the root shh is blocked by default. Long story short - if provisioner shell relies on ssh between packer host and the VM this provisioner will not work anyway. Is this true that provisioner shell type depends on ssh?

Rickard von Essen

unread,
May 7, 2020, 12:42:33 PM5/7/20
to packe...@googlegroups.com
Yes provisioner depends on the communicator, in this case ssh. 

--
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/5cf5ffd2-d419-4098-aea9-27849b9274e3%40googlegroups.com.

Lesley Kimmel

unread,
May 7, 2020, 12:57:21 PM5/7/20
to Packer
Give your builder a name and then refer to the name (no the type) in the provisioner.
Reply all
Reply to author
Forward
0 new messages