Re: [packer] How do I do Windows update via amazon;ebs via WinRm? or anu other way to do updates. really Stuck he

218 views
Skip to first unread message
Message has been deleted

Alvaro Miranda Aguilera

unread,
Dec 14, 2017, 2:03:58 PM12/14/17
to packe...@googlegroups.com
yup thats how people do it. 

any issues? doesn't work?

On Thu, Dec 14, 2017 at 7:08 PM, <rprin...@gmail.com> wrote:
How do I do Windows update via amazon;ebs via WinRm? or any other way to do updates. Really Stuck here


{
 "_comment": "This template is used to build a Dotnet core build server AMI.",

 "variables": {
      "aws_access_key": "AKIAJLHWXRUQRJ5F7CVA",
      "aws_secret_key": "rLgQJkhFMVt32sCKcj7GN7ptahgUyZ+cSoO4ZphI"
},

 "builders": [
    {
      "type": "amazon-ebs",
      "region": "us-east-1",
      "source_ami": "ami-27a58d5c",
      "instance_type": "t2.medium",
      "ami_name": "CCP-DotNetCore-Build-Server-{{timestamp}}",
      "security_group_id": "sg-cb9b7eb5",
      "user_data_file": "{{template_dir}}/setup_winrm.ps1",
      "communicator": "winrm",
      "winrm_username": "Administrator",
      "winrm_use_ssl": true,
      "winrm_insecure": true,
      "access_key": "{{user `aws_access_key`}}",
      "secret_key": "{{user `aws_secret_key`}}",
      "vpc_id": "vpc-51c74037",
      "subnet_id": "subnet-13b09f5a",
      "associate_public_ip_address": true,
      "launch_block_device_mappings": [
        {
          "device_name": "/dev/sda1",
          "volume_size": 60,
          "volume_type": "gp2",
          "delete_on_termination": true
        }
      ]
    }
  ],

 "provisioners": [
    {
      "type": "powershell",
      "script": "provision.ps1"
    },
    {
      "type": "file",
      "source": "/Users/ron.prince/work/workshop/cookbooks",
      "destination": "C:\\chef",
      "pause_before": "30s"
    },
    {
      "type": "powershell",
      "inline": ["dir c:\\chef\\cookbooks"],
      "pause_before": "10s"
    },
    {
      "type": "powershell",
      "script": "chef.ps1",
      "pause_before": "20s"
    },
    {
      "type": "powershell",
      "script": "windows-updates.ps1"
    },
    {
      "type": "windows-restart",
      "restart_timeout": "30m"
    }
  ]
}

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/bc634f42-54ba-4746-bd65-224ccf9a5761%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Ron Prince

unread,
Dec 14, 2017, 2:06:06 PM12/14/17
to packe...@googlegroups.com
Not able to run the wsus client cookbook


is there an another way to do it?

You received this message because you are subscribed to a topic in the Google Groups "Packer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/packer-tool/1HSAMw9FOtg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/CAHqq0ez5-x4-CwOQaSn6XYs67iN3J4ZqaB7TQeaLub_5tq597A%40mail.gmail.com.

Alvaro Miranda Aguilera

unread,
Dec 14, 2017, 2:31:20 PM12/14/17
to packe...@googlegroups.com
packer can run  powershell/bat scripts.

if you can script it, then packer can run it.

how you do it without packer today?

Ron Prince

unread,
Dec 14, 2017, 2:45:46 PM12/14/17
to packe...@googlegroups.com
run the wsus-client cookbook.

--
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 a topic in the Google Groups "Packer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/packer-tool/1HSAMw9FOtg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to packer-tool+unsubscribe@googlegroups.com.

Jordan Borean

unread,
Dec 14, 2017, 10:42:46 PM12/14/17
to Packer
I don't know what the wsus-client cookbook is but looking at your packer.json you are just calling a powershell script. Unfortunately WUA cannot be called in a WinRM logon as it is restricted by Microsoft. People usually get around this by running it under a scheduled task as it runs under a batch logon which can access WUA.  The elevated_command is designed to do this for you https://www.packer.io/docs/provisioners/powershell.html#execute_command.

rprin...@gmail.com

unread,
Dec 15, 2017, 10:54:56 AM12/15/17
to Packer
Thank you for the input.
Reply all
Reply to author
Forward
0 new messages