Search code examples
puppetmcollective

Export facter variable using MCollective


I'm trying to export factor system variable using Mcollective shell agent. But once check the factor list new variable is not set properly. What could be the reason here ?

Setting this variable though puppet is not possible as puppet catalog run lookup for this custom factor and then resolve the node. So the facter variable must be set before puppet run.

Is there any other Mcollective agents which could use for this purpose.

mco shell run "export FACTER_deployment_pattern='pattern2'"; factor

  • [ ============================================================> ] 2 / 2

puppetagent:

qaa-node-5:

Finished processing 2 / 2 hosts in 146.06 ms


Solution

  • The exported environment variable would only be available to processes spawned by the shell spawned by this command. In other words, it doesn't really do anything because it spawns a shell, sets an environment variable, then the shell exits.

    In order to create a Facter external fact that is actually available to other processes you can create a file in a path dependent on your installation.