TyMac
TyMac

Reputation: 803

How can knife ec2 honor the "--bootstrap-version" argument?

It would appear that "knife ec2" does not honor the "--bootstrap-version" argument that works with "knife bootstrap".

For Instance, this does not work:

knife ec2 server create -I ami-932c5be9 -f t2.small -S chef -i /home/ted/chef_key --ssh-user ted --subnet subnet-4cd9d113 --json-attributes '{"policy_name": "web_server", "policy_group": "prod"}' -N teds_apache_server -g "sg-dec3f883" --tags Lifecycle="PROD",Installer="Ted",Application="Apache",--region us-east-1 --server-connect-attribute private_ip_address --bootstrap-template /home/ted/chef-repo/.chef/bootstrap/bootstrap_prd.erb --availability-zone us-east-1c --bootstrap-version 13.6.4

Afterwards this instance would deploy but would not have the chef-client version 13.6.4 installed. I would have to do a knife node delete, knife client delete and ssh to the instance and uninstall the chef-client package. After that I can run:

knife bootstrap [email protected] -i /home/ted/chef_key --sudo --ssh-user chef --json-attributes '{"policy_name": "web_server", "policy_group": "prod"}' -N teds_apache_server --bootstrap-template /home/ted/chef-repo/.chef/bootstrap/bootstrap_prd.erb --bootstrap-version 13.6.4

...this will install the latest version. Any ideas on how to get this to work with knife ec2?

Upvotes: 0

Views: 107

Answers (1)

Roland
Roland

Reputation: 1426

You're using a custom bootstrap-template file which probably ignores the bootstrap version attribute chef_version. Check https://github.com/juliandunn/chef-bootstrap-templates for a collection of bootstrap templates and the use of the chef_version variable as suggestion for your own.

Chefs default build-in-template respects the version to build the latest_current_chef_version_string value, see lib/chef/knife/core/bootstrap_context.rb

Upvotes: 0

Related Questions