SALTSTACK - DEPENDENCIAS Y REQUISITOS DEL STATE

En esta sesión exploramos como se implementan y usan los requisitos y dependencias en la definición de un State de SaltStack

Cargando video...

NOTA: Solo puedes ver una versión limitada del video a baja resolución, si quieres ver la versión completa por favor regístrate y obtén alguno de nuestros planes!

Descripción del Vídeo

El uso y manejo de dependencia se define de la siguiente forma: un state depende de  otro state para su perfecto funcionamiento.

$> vi /srv/salt/nginx.sls
install_nginx:
  pkg.installed:
    - name: nginx

make sure nginx is running:
  service.running:
    - name: nginx
    - enable: True
    - require:
      - pkg: install_nginx

$>  sudo salt "*" state.sls nginx
myminion:
----------
          ID: install_nginx
    Function: pkg.installed
        Name: nginx
      Result: True
     Comment: Package nginx is already installed
     Started: 20:44:34.699559
    Duration: 897.456 ms
     Changes:   
----------
          ID: make sure nginx is running
    Function: service.running
        Name: nginx
      Result: True
     Comment: The service nginx is already running
     Started: 20:44:35.597968
    Duration: 194.745 ms
     Changes:   

Summary for myminion
------------
Succeeded: 2
Failed:    0
------------
Total states run:     2
Total run time:   1.092 

sudo salt "*" state.sls nginx 
myminion:
----------
          ID: install_nginx
    Function: pkg.installed
        Name: nginx
      Result: True
     Comment: Package nginx is already installed
     Started: 05:44:12.233199
    Duration: 898.965 ms
     Changes:   
----------
          ID: make sure nginx is running
    Function: service.running
        Name: nginx
      Result: True
     Comment: Service nginx has been enabled, and is in the desired state
     Started: 05:44:13.132727
    Duration: 634.416 ms
     Changes:   
              ----------
              nginx:
                  True

Summary for myminion
------------
Succeeded: 2 (changed=1)
Failed:    0
------------
Total states run:     2
Total run time:   1.533 s

Rating

Global

Ver video en playlist

comments powered by Disqus