MatthiasScholz / cos

Basic Cluster Orchestration Setup
GNU Lesser General Public License v3.0
34 stars 11 forks source link

Unable to build AMI with packer #11

Closed ThomasObenaus closed 6 years ago

ThomasObenaus commented 6 years ago

When installing consul, sudo yum update -y is called. During this process the os is not able to load some packages.

amazon-linux-ami2: Updated: amazon-linux-ami2: amazon-linux-extras.noarch 0:1.4-1.amzn2 amazon-linux-ami2: aws-cfn-bootstrap.noarch 0:1.4-30.amzn2 amazon-linux-ami2: dhclient.x86_64 12:4.2.5-58.amzn2.3.2 amazon-linux-ami2: dhcp-common.x86_64 12:4.2.5-58.amzn2.3.2 amazon-linux-ami2: dhcp-libs.x86_64 12:4.2.5-58.amzn2.3.2 amazon-linux-ami2: dotnet-host.x86_64 0:2.1.0_preview2_26411_07-1 amazon-linux-ami2: ec2-utils.noarch 0:0.5-1.amzn2.0.1 amazon-linux-ami2: kernel-tools.x86_64 0:4.14.33-59.34.amzn2 amazon-linux-ami2: mssql-server.x86_64 0:14.0.3025.34-3 amazon-linux-ami2: amazon-linux-ami2: Failed: amazon-linux-ami2: msodbcsql17.x86_64 0:17.0.1.1-1 msodbcsql17.x86_64 0:17.1.0.1-1 amazon-linux-ami2: mssql-tools.x86_64 0:17.0.1.1-1 mssql-tools.x86_64 0:17.1.0.1-1

ThomasObenaus commented 6 years ago

msodbcsql17.x86_64 0:17.0.1.1-1 msodbcsql17.x86_64 0:17.1.0.1-1 and mssql-tools.x86_64 0:17.1.0.1-1 are failing

ThomasObenaus commented 6 years ago

Why is mysql stuff loaded?

ThomasObenaus commented 6 years ago

Reason: The wrong ami was taken as basis. The packer source_ami_filter:

"source_ami_filter": {
        "filters": {
          "virtualization-type": "hvm",
          "architecture": "x86_64",
          "name": "*amzn2-ami-hvm-*",
          "block-device-mapping.volume-type": "gp2",
          "root-device-type": "ebs"
        },
        "owners": [
          "amazon"
        ],
        "most_recent": true
      },

Matches to ami-6bc91714

Because its newer than the official plain amazon linux 2 ami ami-f973ab84

ThomasObenaus commented 6 years ago

Restricting the name parameter of the source_ami_filter from: "name": "*amzn2-ami-hvm-*" to "name": "*amzn2-ami-hvm-*gp2"

ThomasObenaus commented 6 years ago

Solved with https://github.com/MatthiasScholz/cos/commit/85fad67c060ae26b3b290f308d465e935055472e