Project

General

Profile

Tâche #24357

Scénario #24263: Epic 13: Créer un message permettant de récupérer les données d'environnement d'un serveur

Récupérer le grain du minion vers le master le mettre dans salt-master

Added by Gwenael Remond over 4 years ago. Updated over 4 years ago.

Status:
Fermé
Priority:
Normal
Assigned To:
Gwenael Remond
Start date:
06/25/2018
Due date:
% Done:

0%

Estimated time:
0.00 h
Spent time:
Remaining (hours):
0.0

Description

lancer la commande salt "*" grains.ls

History

#1 Updated by Gwenael Remond over 4 years ago

  • Parent task changed from #24269 to #24263

#2 Updated by Scrum Master over 4 years ago

  • Status changed from Nouveau to En cours

#3 Updated by Scrum Master over 4 years ago

  • Status changed from En cours to Résolu

#4 Updated by Gwenael Remond over 4 years ago

  • Estimated time set to 0.00 h
  • Remaining (hours) set to 0.0

#5 Updated by Gwenael Remond over 4 years ago

La page des grains https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.grains.html
Les grains personnalisés : https://docs.saltstack.com/en/latest/topics/grains/#writing-grains

Côté salt-master, dans /srv/salt/_grains mettre un fichier python

root@5608141b4061:/srv/salt/_grains# cat essai.py 
def yourfunction():
     # initialize a grains dictionary
     grains = {}
     # Some code for logic that sets grains like
     grains['yourcustomgrain'] = True
     grains['anothergrain'] = 'somevalue'
     return grains
root@5608141b4061:/srv/salt/_grains# 

Ne pas oublier de lancer une synchronisation :

salt "10"  saltutil.sync_grains

Puis récupérer le grain depuis le master :

root@5608141b4061:/srv/salt/_grains# salt "10" grains.get anothergrain
10:
    somevalue

#6 Updated by Joël Cuissinat over 4 years ago

  • Status changed from Résolu to Fermé

Also available in: Atom PDF