-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(feat) provisioning lists of images from a file #78
Conversation
This is related to this commit in MOTD puppetlabs/puppetlabs-motd@6e66d71 Having a simple file for common provisioning steps will simplify appveyor and CI templates. The command is call like so: the provision file looks like ---
default:
provisioner: docker
images: ['centos:7']
travis_deb:
provisioner: docker
images: ['debian:8', 'debian:9', 'ubuntu:14.04', 'ubuntu:16.04', 'ubuntu:18.04']
travis_el:
provisioner: docker
images: ['centos:6', 'centos:7', 'oraclelinux:6', 'oraclelinux:7', 'scientificlinux/sl:6',
'scientificlinux/sl:7'] |
Took a quick look and have the following comments;
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be good to add some docs, like a .yaml.example
file or in the README.
@@ -83,6 +83,28 @@ def run_local_command(command) | |||
end | |||
end | |||
|
|||
desc "provision list of machines from provision.yaml file. 'bundle exec rake 'litmus:provision_list[default]'" | |||
task :provision_list, [:key] do |_task, args| | |||
provision_hash = YAML.load_file('./provision.yaml') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some bikeshedding: perhaps litmus.yaml
? Also feels like this should be configurable - perhaps an env var with a default?
lib/puppet_litmus/rake_tasks.rb
Outdated
desc "provision list of machines from provision.yaml file. 'bundle exec rake 'litmus:provision_list[default]'" | ||
task :provision_list, [:key] do |_task, args| | ||
provision_hash = YAML.load_file('./provision.yaml') | ||
provisioner = provision_hash['default']['provisioner'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nice error if default
doesn't exist would be nice. Same below for the key
.
include PuppetLitmus | ||
Rake::Task['spec_prep'].invoke | ||
config_data = { 'modulepath' => File.join(Dir.pwd, 'spec', 'fixtures', 'modules') } | ||
raise "the provision module was not found in #{config_data['modulepath']}, please amend the .fixtures.yml file" unless File.directory?(File.join(config_data['modulepath'], 'provision')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is repeated in various tasks. It'd be good to at least add a helper for this.
results = run_task("provision::#{provisioner}", 'localhost', params, config: config_data, inventory: nil) | ||
results.each do |result| | ||
if result['status'] != 'success' | ||
puts "Failed on #{result['node']}\n#{result}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be on stderr?
From the Foreman perspective we have various tools where it's important to have a FQDN. This means we always set a hostname to |
Completely agree with @ekohl . Setting the hostname to a well-defined value is a must. |
Hi @ekohl @trevor-vaughan , many many thanks for the feedback. I want to keep the conversation going and still keep producing useful building blocks for litmus.
Where i think you have issue is deployment, which is a separate problem but it pairs tightly with provisioning. Deployment in my head, is where we start to impart shape and definition on the machines that have been provisioned. I want to provision a debian systems. set a hostname then install puppet agent 5. This would look like this
The above can also be performed with bolt tasks or a bolt plan. If a 'very' specific deployment pattern is needed. The above is just an example of what could be possible. |
@tphoney This makes sense. The deployment scenarios that I see are:
In terms of provisioning, why wrap it in something else and not just use Bolt, full stop? |
Could you explain the example? Some things that don't make sense to me:
There are also other reasons why long term this might mess up. For example, in libvirt I have it set up that the requested hostname via DHCP automatically gets a DNS record (within a certain domain). This allows me to connect to any guest without messing with hosts files. It also automatically allows connections between VMs. That said, I haven't done any cross host testing with beaker so it may be overkill. What I expect from a tool is:
If you want to allow testing complex applications, then network connectivity is also important. It may be fine to consider this out of scope initially. That means you may want to version the YAML file ( |
The comment from @ekohl just reminded me that you need to support running tests inside different modules at the same time. This means that the 'unique' names that are used in Docker/libvirt/Virtualbox/whatever must be globally unique so that you don't have tests trying to tear down systems from other tests that are running at the same time. |
@ekohl i fixed the example. my fault. On to what @ekohl said. for complex deployments, we can utilise bolt tasks / command and bolt plans for these kind of things. or we could use a file format similar to my example. in terms of unique names they are handled by the inventory.yaml file. this is how we reference the various systems. ie the handle in inventory is not necessarily the same as the host name. alias i think is their euphemism |
@tphoney What's the benefit of yet another random format?
|
Closing this PR moving the features requested for deployment, setting hostname / hardware / multimachine setup into #72 If i missed something, please feel free to add it. |
No description provided.