There was a recent thread discussing this topic. However, I don't think they mentioned a solution to allow you to include multiple files in a BLPackage and then deploy a specific file from the package to a server based on the server property: OS type.
How many possible OS types do you currently have? I can imagine 8-12 for Windows 2003/2008 (r2) /2012 (r2) and about 6-8 for Redhat.
There might be a way to use pre install and post install scripts to modify the file once its deployed. For instance, identify the OS type and run a command to alter the text file once its deployed, commenting out unneeded lines. although that may be confusing having multiple Windows entries in a file related to Unix or vice versa.
Hey, thanks for reply. Yes, you're correct - there will be 10 or more OSes. Any solution is fine as long as final job (the one to be executed) is the one where you select targets. It can be more BLPackages than just one, I just don't know how to discover OS type and then execute another job that will target only discovered targets.
I made Component Template which targets all servers and in Discover tab has rule ??TARGET.OS?? = "Windows", but don't know how to execute another job that would target only those servers. It could work if I could put this in batch job.
expanding on what I said before have one BLPackage with multiple files in it. Deploy the package and unpack on target servers, then run a post install script to identify the OS and then select and install the correct file from the extracted BLPackage.
Then perform cleanup of /tmp/stage directory to remove additional unneeded files. It's a bit clumsy, but I don't believe you can dynamically pick a file from a BLPackage based on a server property or component template.
That should give you what you want.
you would create various compliance rules and have the rule fail on the targets you want to deploy to. like ??TARGET.OS?? is not Windows and ??TARGET.OS_VERSION?? is not 2012 for example. then there is a blpackage set to be the remediation for that rule and you have auto-remediate setup in the template and on the rule.
I did that, but it says if I only check OS and OS_VERSION then all discovered targets are compliant (which makes sense) and remediation is not run. Since my BLPackage contains only file (that is also located in Depot), I could compare content (if BSA allows for this).
I tried to do above myself, however if I cannot find any options to compare content of the file to content of file in depot. I can insert value that should be matching manually, but it is not gonna work for my case.
So far I created component template, successfully added compliancy rule to match ??TARGET.OS?? = "Windows" and added remediation package. Now I would like to check if content of exports file is valid (up to date) and if not, update it via remediation package.
you understand that in order for remediation to be triggered, the rule has to fail for the target right? so if you want to do something on a windows 2012 host then you need to make the rule fail on the 2012 host. eg using a NOT.
I believe there have been (or still are) ideas about allowing conditional deploy jobs with rules such as the ones that can be used in a compliance job, which would cover this use case in a much more appropriate way. Having to design a reverse logic rule is sometimes very tricky (rule has to fail to trigger the deploy)...
Yes, that is why I want to compare content of BLPackage and, if different, remediate it - is my thinking incorrect? I would like to avoid creating negated conditions - it is way too complicated to maintain (maybe easy if you have one component template to make, I'll end up with at least 10).
You can go that route, but what’s the issue w/ using the os properties ?
But I am using OS properties... as rules in compliance.
Ok, and what are your rules? and you have the rules setup so that they fail only on the os you need to deploy the associated blpackage to ?
Yes, I know, that's is why I later asked if there is possibility to compare content of file in depot (soft linked to BLPackage too, if need be) to file on target server.
My current rule:
- ??TARGET.OS?? = "Windows"
For obvious reason it will not remediate BLPackage, because any Windows is compliant with this. In Discovery tab I also selected
- ??TARGET.OS?? = "Windows"
so it matches only Windows servers - this is what I want. Any OS other than Windows is not targeted yet. Now, I would like to check if file in Depot, for simplicity let's call it exportsA is same as file on target server, on Windows this would be C:\Windows\rsc\exports.
For this very reason I want to create another rule in compliance tab that will compare both files, and remediate BLPackage if they're different.
This means, that if my exportsA file has content:
and both of my servers, say A and B have C:\Windows\rsc\exports files with content:
and I would execute compliance job against both of those servers, BSA first will check if OS type is Windows (which in this example is), then will check if exportsA is same as exports file on target server (which in this example is not). It will be non-compliant and it should remediate.
At this point, my concern is how to compare both files. I would like exportsA to be in depot, because this file will be updated from time to time.
so use NOT ??TARGET.OS?? = Windows ?