Reputation: 13
Im new to Chef /Inspec test writing. What Im trying to do is validate a host name/IP address within a file and match it to what is in DNS. If the IP address in file doesnt match what is in DNS, the test should fail.
example
describe host('example.com') do
it { should be_resolvable }
its('ipaddress') { should include '12.34.56.78' }
its('stdout') { should match 'ipaddress' }
end
the 'example.com' would be a $variable that comes from within a file
the ''12.34.56.78' would also be a $variable that comes from within a file however should match what is in DNS
Is this even possible to do? do I need to or can I use a bash script within the inspec file that has some awk commands?
describe bash('filename.sh') do
it { should be_resolvable }
its('stdout') { should match 'ipaddress' }
its('stderr') { should eq '' }
its('ipaddress') { should include '12.34.56.78' }
end
Any help or guidance is much appreciated. Thank you!!
Upvotes: 0
Views: 354