garethr-docker icon indicating copy to clipboard operation
garethr-docker copied to clipboard

Add swarm_extract_token facter

Open drignoto opened this issue 8 years ago • 3 comments

I leave my last contribution, the swarm_extract_tokens facter to extract the swarm tokens with the idea of using them as exported resources, through the puppetDB, etc.

Facter swarm_extract_tokens extracts in hash format both manager and worker tokens. An output of this facter is as follows:

swarm_extract_tokens => {
  swarm_tokens => {
    manager => "SWMTKN-1-2nv8qxa5npe850c4hx3utvcn7tdmmg08d70yw6nrzlu5et1kil-f2qik9f2ui4ciuvnf6b8uuxs5",
    worker => "SWMTKN-1-2nv8qxa5npe850c4hx3utvcn7tdmmg08d70yw6nrzlu5et1kil-9unklwesgt1njskt7gjovny96"
  }
}

The facter have been tested in my working environment and put into production. I'm sorry I did not write the rspec tests, but as I already tell you because of my work urgency, I do not have time to do this. If necessary to do the pull request my master branch has the changes. I feel free to clone my changes, add what is missing and do the pull request.

Regards!

drignoto avatar May 16 '17 07:05 drignoto

Hi @drignoto Could you add the usage examples too ?

ram-devsecops avatar Jun 21 '17 15:06 ram-devsecops

Any news? That would be nice to have! 👍

HadesArchitect avatar Sep 04 '17 18:09 HadesArchitect

@rammaram06 i'm so sorry! In my case, i had the need to join nodes in swarm automatically, so i create this fact to extract the token from the master node. In profiles, i create two profiles for testing: one for master and one for the nodes who join in swarm. In profile swarm::master i use the method that create the swarm and, with PuppetDB, store the tokens. For the other side, in profile swarm::worker i use the module puppetdbquery (https://forge.puppet.com/dalen/puppetdbquery) and use the query_facts function for apply the token in swarm method.

@HadesArchitect Thanks! :+1:

drignoto avatar Sep 17 '17 19:09 drignoto