hashicorp / packer-plugin-salt

This Packer provisioner has been archived due to it no longer being maintained. Users are encouraged to use the shell or shell-local provisioner to run the provisioning tools made available by this plugin. If interested in maintaining this plugin please reach out to us at packer@hashicorp.com.
https://www.packer.io/docs/provisioners/salt-masterless
Mozilla Public License 2.0
2 stars 5 forks source link

openstack: salt_masterless provisioner: Closed SSH session, return code: 2300218 #20

Open hc-github-team-packer opened 2 years ago

hc-github-team-packer commented 2 years ago

This issue was originally opened by @richardfelkl in https://github.com/hashicorp/packer/issues/5607 and has been migrated to this repository. The original issue description is below.


Hello,

I've got a problem when using salt provisioner or salt-call command with packer it immediately closes the packer SSH session ant the build exits with failure.

I'm using OpenStack as a builder. I have no problems with running the shell provisioners. But if I use salt-call command in a shell provisioner or if I use salt_masterless provisioner I'm having an issue above.

Is there any workaround or solution for this?

Packer version: 1.1.2_linux_amd64 Host Sytem: Ubuntu 16.04

Packer log:

openstack

output will be in this color.

==> openstack: Discovering enabled extensions... ==> openstack: Pausing after run of step 'StepLoadExtensions'. Press enter to continue. ==> openstack: Loading flavor: FLAVOR openstack: Verified flavor. ID: 2641f237-dd4f-4106-8c20-d336640961be ==> openstack: Pausing after run of step 'StepLoadFlavor'. Press enter to continue. ==> openstack: Creating temporary keypair: packer_5a116fff-699d-7bd9-7894-2f9eaf71f630 ... ==> openstack: Created temporary keypair: packer_5a116fff-699d-7bd9-7894-2f9eaf71f630 openstack: Saving key for debug purposes: os_openstack.pem ==> openstack: Pausing after run of step 'StepKeyPair'. Press enter to continue. ==> openstack: Launching server... openstack: Server ID: 6e7e47da-931d-474f-ae24-9ad6b12f40c7 ==> openstack: Waiting for server to become ready...

==> openstack: Pausing after run of step 'StepRunSourceServer'. Press enter to continue. ==> openstack: Pausing after run of step 'StepGetPassword'. Press enter to continue. ==> openstack: Pausing after run of step 'StepWaitForRackConnect'. Press enter to continue. ==> openstack: Creating floating IP... openstack: Pool: public openstack: Created floating IP: ==> openstack: Associating floating IP with server... openstack: IP: openstack: Added floating IP to instance! ==> openstack: Pausing after run of step 'StepAllocateIp'. Press enter to continue. ==> openstack: Waiting for SSH to become available...

==> openstack: Connected to SSH! ==> openstack: Pausing after run of step 'StepConnect'. Press enter to continue. ==> openstack: Provisioning with shell script: scripts/base.sh openstack: started ==> openstack: Provisioning with Salt... openstack: Creating remote temporary directory: /tmp/salt openstack: Creating directory: /tmp/salt openstack: Uploading local state tree: salt/formula openstack: Creating directory: /tmp/salt/states openstack: Removing directory: /srv/salt/env/prd openstack: Moving /tmp/salt/states to /srv/salt/env/prd openstack: Uploading local pillar roots: salt/pillar openstack: Creating directory: /tmp/salt/pillar openstack: Removing directory: /srv/salt/pillar openstack: Moving /tmp/salt/pillar to /srv/salt/pillar openstack: Running: salt-call --local state.sls aptly --file-root=/srv/salt/env/prd --pillar-root=/srv/salt/pillar --retcode-passthrough -l info

==> openstack: Pausing before cleanup of step 'StepConnect'. Press enter to continue. ==> openstack: Pausing before cleanup of step 'StepAllocateIp'. Press enter to continue. ==> openstack: Deleted temporary floating IP ==> openstack: Pausing before cleanup of step 'StepWaitForRackConnect'. Press enter to continue. ==> openstack: Pausing before cleanup of step 'StepGetPassword'. Press enter to continue. ==> openstack: Pausing before cleanup of step 'StepRunSourceServer'. Press enter to continue. ==> openstack: Terminating the source server: 6e7e47da-931d-474f-ae24-9ad6b12f40c7 ...

==> openstack: Pausing before cleanup of step 'StepKeyPair'. Press enter to continue. ==> openstack: Deleting temporary keypair: packer_5a116fff-699d-7bd9-7894-2f9eaf71f630 ... ==> openstack: Pausing before cleanup of step 'StepLoadFlavor'. Press enter to continue. ==> openstack: Pausing before cleanup of step 'StepLoadExtensions'. Press enter to continue. Build 'openstack' errored: Error executing salt-call: Bad exit status: 2300218

template.json:

{
  "variables": {
    "image_name": "NAME",
    "user": "root",
    "password": "PASS",
    "disk_size": "DISK_SIZE",
    "os_flavor": "FLAVOR",
    "os_source": "SOURCE_IMAGE",
    "os_availability_zone": "AVAILABILITY_ZONE",
    "os_network": "NETWORK",
    "ssh_username": "SSH_USERNAME"
  },
  "provisioners": [
    {
      "type": "shell",
      "script": "scripts/base.sh",
      "start_retry_timeout": "10s"
    },
    {
      "type": "salt-masterless",
      "local_state_tree": "salt/formula",
      "local_pillar_roots": "salt/pillar",
      "remote_state_tree": "/srv/salt/env/prd",
      "remote_pillar_roots": "/srv/salt/pillar",
      "skip_bootstrap": true,
      "custom_state": "aptly"
    }
  ],
  "builders": [
    {
      "type": "openstack",
      "image_name": "{{user `image_name`}}",
      "source_image": "{{user `os_source`}}",
      "flavor": "{{user `os_flavor`}}",
      "networks": ["{{user `os_network`}}"],
      "availability_zone": "{{user `os_availability_zone`}}",
      "use_floating_ip": true,
      "ssh_username": "{{user `ssh_username`}}"
    }
  ]
}
nywilken commented 2 years ago

With the archival of this repository all open issues will be marked as read-only. If you wish to further discuss this plugin or any of its open issues we invite you to open a discussion on the Packer community forum.

More details on the plugin archiving process for this provisioner can be found on the Plans to Archive Unmaintained Packer Provisioner Plugins blog post.