Feature #13963
openSupport multiple SSH keys in Katello cloud-init
Description
I'm Tryining provisioning a new instance on amazon the instance is created and is up and running but never register with katello and is failed as per the following error on cloud-init.output.log
2016-03-01 02:18:33,754 - util.py[WARNING]: Failed loading yaml blob
2016-03-01 02:18:33,877 - util.py[WARNING]: Failed loading yaml blob
2016-03-01 02:18:33,878 - util.py[WARNING]: Failed at merging in cloud config pa rt from part-001
This was working very well on katello 2.3 i just check the template on katello 2.3 and copy the same in my katello 2.4 but still tell error
This is the generated file on the machine and is no creating the foreman file on /tmp becuase is failed by the error previously paste it
#cloud-config hostname: aatest2 fqdn: aatest2.test.aws.syd.internal manage_etc_hosts: true ssh_authorized_keys: - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+fYWlaMKXFkXdG9prDNIRpPOi86XjlJaxxhIEHZzcpaDr0W71vA1yInZtUyv+StGDVBX91uNXmMylRdLm/sdseET2Q9KdBWya/4jqNDp26q/I4trO1vGeJ1a4dQCg/GVmFehfQVQgYhM2Zxd6pnpIZ5MPui6h/NKsVqipysByJ903Aq8MlqNooKJCA+Q1JBWkGE1VjU2GpszIkhuQbbbkxRqpxpRWNvkMLH8ba4HTrYhOtiFLwuAIMEeylBRAZXe4dQ8yGKHo8f/Oo1yfenvn7MIS7jiguGT9hYvu/8UtBWFL5Ee0ssz+yu1lfnnxc7thTtEhcjExd/00YAnV5Cbr foreman-proxy@capsule01.example.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDzU2DpXyeJIgjS/KSAc+vYgIklDmuBmRfFhHklr+13VctpJ3CCf8GHvfbUkra4du7p0rPkbdHCgs1+iBfz/C0GpyTkziCBazXAdowzM+6mdeljZIsCeAsXrmyMbiwcG0Ulc16A/BPIYQ5K/yrZC128aOuF2PvQmqbcbLkthvC5QTCyzMzATJuYl4RPd4Zq2sY3CgJXsiAxQOhK/AkvH7s725KCyEfBvspKozpCs5hLN7JzFt8EXJMWj5DeActM4WnD1NBRzVbA5u5oNPl5dhSFJU2UuP/e6kFvELlrpo6LC9fQa75JnRqCchQK7tVBg4qzZlsp/sqZj72JFmWZHxN9 root@capsule01.example.com write_files: - path: /tmp/foreman-userdata.sh permissions: '0755' content: | #!/bin/bash # add subscription manager yum -t -y -e 0 install subscription-manager rpm -ivh http://awscapsule01.test.aws.syd.internal/pub/katello-ca-consumer-latest.noarch.rpm echo "Registering the System" subscription-manager register --org="Verifone" --name="aatest2.test.aws.syd.vficonnect.internal" --activationkey="BaseOS" echo "Installing Katello Agent" yum -t -y -e 0 install katello-agent chkconfig goferd on # update all the base packages from the updates repository yum -t -y -e 0 update yum install -y puppet cat > /etc/puppet/puppet.conf << EOF [main] vardir = /var/lib/puppet logdir = /var/log/puppet rundir = /var/run/puppet ssldir = \$vardir/ssl [agent] pluginsync = true report = true ignoreschedules = true daemon = false ca_server = awscapsule01.test.aws.syd.vficonnect.internal certname = aatest2.test.aws.syd.vficonnect.internal environment = KT_Verifone_Library_BaseOS_2 server = awscapsule01.test.aws.syd.vficonnect.internal EOF # Setup puppet to run on system reboot /sbin/chkconfig --level 345 puppet on /usr/bin/puppet agent --config /etc/puppet/puppet.conf --onetime --tags no_such_tag --server awscapsule01.test.aws.syd.internal --no-daemonize /sbin/service puppet start phone_home: url: http://nz2zmsosat01.pp.vficonnect.net.nz:80/unattended/built?token=4e052b3e-b2ef-48df-a131-0262d785e76a post: [] tries: 10 runcmd: - [ cloud-init-per, once, foreman-userdata, /tmp/foreman-userdata.sh ] output: {all: '| tee -a /root/install.userdata.log'}
i don't see anything on the capsule
Updated by Dominic Cleal almost 9 years ago
- Description updated (diff)
- Category set to Compute resources - EC2
- Status changed from New to Feedback
The error is from cloud-init trying to parse the template, which doesn't validate as YAML. The SSH keys look malformed, there's a line break and no "-" before the second key. This doesn't look like a bug in Foreman.
Updated by Mario Gamboa almost 9 years ago
Ok Dominic let remove the second key i just add it into foreman and as you can see is how is generated the cloud-init configuration let me remove the second key and test if works again i going to add the second key and if fail well that could be the bug , thank you for you point i will let you know in a few hours
Updated by Mario Gamboa almost 9 years ago
Hi Dominc
Sorry for the delay you right if i remove my second sshkey the provisioning works fine in this case could be the bug if you add a second ssh-key is making a malformed output of the configuration i tested again putting back the second sshkey and is fail , and of course i can add a second as ssh_key parameter because is already used by the first one, possible i'm doing wrong but is no documentation about this
Updated by Dominic Cleal almost 9 years ago
This is a problem in the template you're using if it doesn't format it properly. It doesn't look like one shipped with Foreman.
Updated by Mario Gamboa almost 9 years ago
Ah ok if i understand in this part of the normal katello user data
<%# Allow user to specify additional SSH key as host paramter ->
< if @host.params['sshkey'] ->
ssh_authorized_keys:
- <= @host.params['sshkey'] >
< end -%>
must be something like this
<%# Allow user to specify additional SSH key as host paramter ->
< if @host.params['sshkey'] ->
ssh_authorized_keys:
- <= @host.params['sshkey'] >
- <= @host.params['sshkey2'] >
< end -%>
to add my secondary sshkey right no need to put both keys in the sshkey parameter because cause the issue we got.
Updated by Dominic Cleal almost 9 years ago
- Project changed from Foreman to Katello
- Category deleted (
Compute resources - EC2) - Status changed from Feedback to New
Doesn't appear to come from Foreman's templates, moving.
Updated by Eric Helms almost 9 years ago
- Category set to 83
- Assignee set to Stephen Benjamin
- Translation missing: en.field_release set to 86
Updated by Stephen Benjamin almost 9 years ago
- Tracker changed from Bug to Feature
- Subject changed from Provisioning to Amazon is not working to Support multiple SSH keys in Katello cloud-init
Katello's cloud-init only supports 1 SSH key, you can't put multiple because Foreman's host parameters are rather simplistic and only support string values.
The way you solved it is basically how to do it, use multiple parameters or modify the template to split the parameter value on a "|" or something.
Someday if foreman supports richer global parameters, then we'll adjust the template accordingly.
Updated by Stephen Benjamin almost 9 years ago
- Blocked by Feature #4127: Array, Boolean and other types support in "hostgroup parameters" added
Updated by Stephen Benjamin almost 9 years ago
- Assignee deleted (
Stephen Benjamin) - Priority changed from High to Normal
Updated by Stephen Benjamin almost 9 years ago
- Translation missing: en.field_release changed from 86 to 114