informatica:linux:salt
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| informatica:linux:salt [2014/01/03 22:15] – javi | informatica:linux:salt [2015/04/13 20:19] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ========== Salt ========== | + | ====== Salt ====== |
| salt configuration python | salt configuration python | ||
| - | ======= Instalacion | + | ===== Instalacion ===== |
| - | ===== Servidor | + | ==== Servidor ==== |
| Instalacion normal: | Instalacion normal: | ||
| Line 20: | Line 20: | ||
| </ | </ | ||
| - | ==== Instalacion manual de zeromq ==== | + | ==== Cliente ==== |
| + | |||
| + | Instalacion normal: | ||
| + | |||
| + | sudo aptitude update; sudo aptitude install salt-minion | ||
| + | |||
| + | Para tener la ultima version en ubuntu: | ||
| + | |||
| + | < | ||
| + | echo deb http:// | ||
| + | wget -q -O- " | ||
| + | sudo apt-get update | ||
| + | apt-get install salt-minion | ||
| + | </ | ||
| + | |||
| + | ==== (Cliente y servidor) | ||
| 1. Instalar paquetes: | 1. Instalar paquetes: | ||
| Line 70: | Line 85: | ||
| sudo pip install --upgrade pyzmq | sudo pip install --upgrade pyzmq | ||
| + | ===== Claves ===== | ||
| + | ==== Aceptar las claves del cliente ==== | ||
| - | |||
| - | |||
| - | |||
| - | asdasd | ||
| - | as | ||
| - | dasd | ||
| - | as | ||
| - | |||
| - | ===== Cliente ===== | ||
| - | | ||
| - | Instalacion normal: | ||
| - | |||
| - | sudo aptitude update; sudo aptitude install salt-minion | ||
| - | | ||
| - | Para tener la ultima version en ubuntu: | ||
| - | |||
| - | < | ||
| - | echo deb http:// | ||
| - | wget -q -O- " | ||
| - | sudo apt-get update | ||
| - | apt-get install salt-minion | ||
| - | </ | ||
| - | ======= Claves ======= | ||
| - | | ||
| El cliente se tiene que registrar contra el servidor. Este proceso se realiza **una sola vez por cada cliente**: | El cliente se tiene que registrar contra el servidor. Este proceso se realiza **una sola vez por cada cliente**: | ||
| Line 109: | Line 102: | ||
| sudo salt-key -L | sudo salt-key -L | ||
| - | |||
| < | < | ||
| Unaccepted Keys: | Unaccepted Keys: | ||
| Line 119: | Line 111: | ||
| 3. (Servidor) Aceptar una clave en particular: | 3. (Servidor) Aceptar una clave en particular: | ||
| - | sudo salt-key -a client-1.example.com | + | sudo salt-key -a client.example.com |
| - | + | < | |
| - | Key for client-1.example.com accepted. | + | The following keys are going to be accepted: |
| + | Unaccepted Keys: | ||
| + | client.example.com | ||
| + | Proceed? [n/Y] Y | ||
| + | Key for minion | ||
| + | </ | ||
| 4. (Servidor) Probar: | 4. (Servidor) Probar: | ||
| Line 128: | Line 125: | ||
| client.example.com: | client.example.com: | ||
| + | | ||
| + | ==== Regenerar claves del cliente ==== | ||
| + | |||
| + | Este procedimiento es util cuando por ejemplo se clona una Maquina Virtual y se quiere registrar el cliente contra el maestro. | ||
| + | |||
| + | 1. (Cliente) para salt: | ||
| + | |||
| + | sudo service salt-minion stop | ||
| + | | ||
| + | 2. (Cliente) eliminar claves tanto propias como del servidor: | ||
| + | |||
| + | sudo rm -fr / | ||
| + | | ||
| + | 3. (Cliente) ajustar el id de minion, por ejemplo especificando el mismo valor que el hostname: | ||
| + | |||
| + | sudo vim / | ||
| + | |||
| + | cliente-2.example.com | ||
| + | | ||
| + | 4. (Cliente) arrancar salt: | ||
| + | |||
| + | sudo service salt-minion start | ||
| + | | ||
| + | 5. (Servidor) ya deberia poder ver la nueva peticion: | ||
| + | |||
| + | sudo salt-key -L | ||
| + | Accepted Keys: | ||
| + | cliente.example.com | ||
| + | Unaccepted Keys: | ||
| + | cliente-2.example.com | ||
| + | Rejected Keys: | ||
| + | |||
| + | 6. (Servidor) solo queda aceptar las claves: | ||
| + | |||
| + | sudo salt-key -a cliente-2.example.com | ||
| + | | ||
| + | < | ||
| + | The following keys are going to be accepted: | ||
| + | Unaccepted Keys: | ||
| + | cliente-2.example.com | ||
| + | Proceed? [n/Y] Y | ||
| + | Key for minion cliente-2.example.com accepted | ||
| + | </ | ||
| + | |||
| - | ======= Configuracion | + | ===== Configuracion ===== |
| - | ===== Servidor | + | ==== Servidor ==== |
| sudo cp / | sudo cp / | ||
| Line 142: | Line 183: | ||
| renderer: py | renderer: py | ||
| log_level: debug | log_level: debug | ||
| + | |||
| + | pillar_roots: | ||
| + | base: | ||
| + | - / | ||
| </ | </ | ||
| | | ||
| - | ===== Cliente | + | Para ejecutar salt-master como usuario no-privilegiado: |
| + | |||
| + | 1. Para salt: | ||
| + | |||
| + | sudo service salt-master stop | ||
| + | ps aux | grep salt | ||
| + | |||
| + | 2. Cambiar permisos (en este caso yo uso '/ | ||
| + | |||
| + | sudo chown -R usuario: | ||
| + | |||
| + | 3. Reiniciar salt: | ||
| + | |||
| + | sudo service salt-master start | ||
| + | ==== Cliente ==== | ||
| sudo cp / | sudo cp / | ||
| Line 152: | Line 211: | ||
| </ | </ | ||
| - | ======= States | + | |
| + | ===== States ===== | ||
| Son los modulos en los que se definen las acciones, mas o menos complejas, a realizar por parte de los clientes, o ' | Son los modulos en los que se definen las acciones, mas o menos complejas, a realizar por parte de los clientes, o ' | ||
| Line 175: | Line 235: | ||
| sudo salt ' | sudo salt ' | ||
| - | ======= Errores ======= | + | Salida (salt 0.17.4-1) |
| - | 2014-01-03 22:25:05,116 [salt.master | + | < |
| + | jamgo@salt-1:~$ sudo salt ' | ||
| + | client.example.com: | ||
| + | ---------- | ||
| + | State: - pkg | ||
| + | Name: virt-what | ||
| + | Function: | ||
| + | Result: | ||
| + | Comment: | ||
| + | Changes: | ||
| + | old : | ||
| + | } | ||
| + | |||
| - | **SOLUCION** seguir procedimiento | + | Summary |
| - | | + | ------------ |
| + | Succeeded: 1 | ||
| + | Failed: | ||
| + | ------------ | ||
| + | Total: | ||
| + | </ | ||
| + | |||
| + | ===== Pillars ===== | ||
| + | |||
| + | ==== Ejemplo sencillo ==== | ||
| + | |||
| + | (Salt < 0.16.2 usar ' | ||
| + | |||
| + | sudo salt '*' pillar.items | ||
| + | |||
| + | Salida: | ||
| + | |||
| + | < | ||
| + | client.example.com: | ||
| + | ---------- | ||
| + | master: | ||
| + | ---------- | ||
| + | auth_mode: | ||
| + | 1 | ||
| + | auto_accept: | ||
| + | False | ||
| + | cachedir: | ||
| + | / | ||
| + | client_acl: | ||
| + | ---------- | ||
| + | client_acl_blacklist: | ||
| + | ---------- | ||
| + | cluster_masters: | ||
| + | cluster_mode: | ||
| + | paranoid | ||
| + | conf_file: | ||
| + | / | ||
| + | config_dir: | ||
| + | /etc/salt | ||
| + | cython_enable: | ||
| + | False | ||
| + | daemon: | ||
| + | False | ||
| + | default_include: | ||
| + | master.d/*.conf | ||
| + | enable_gpu_grains: | ||
| + | False | ||
| + | enforce_mine_cache: | ||
| + | False | ||
| + | environment: | ||
| + | None | ||
| + | ext_job_cache: | ||
| + | |||
| + | ext_pillar: | ||
| + | extension_modules: | ||
| + | / | ||
| + | external_auth: | ||
| + | ---------- | ||
| + | external_nodes: | ||
| + | |||
| + | failhard: | ||
| + | False | ||
| + | file_buffer_size: | ||
| + | 1048576 | ||
| + | file_client: | ||
| + | local | ||
| + | file_ignore_glob: | ||
| + | None | ||
| + | file_ignore_regex: | ||
| + | None | ||
| + | file_recv: | ||
| + | False | ||
| + | file_roots: | ||
| + | ---------- | ||
| + | base: | ||
| + | - / | ||
| + | fileserver_backend: | ||
| + | - roots | ||
| + | fileserver_limit_traversal: | ||
| + | False | ||
| + | gitfs_base: | ||
| + | master | ||
| + | gitfs_remotes: | ||
| + | gitfs_root: | ||
| + | |||
| + | hash_type: | ||
| + | md5 | ||
| + | hgfs_branch_method: | ||
| + | branches | ||
| + | hgfs_remotes: | ||
| + | hgfs_root: | ||
| + | |||
| + | id: | ||
| + | client.example.com | ||
| + | interface: | ||
| + | 0.0.0.0 | ||
| + | ipv6: | ||
| + | False | ||
| + | job_cache: | ||
| + | True | ||
| + | keep_jobs: | ||
| + | 24 | ||
| + | key_logfile: | ||
| + | / | ||
| + | log_datefmt: | ||
| + | %H:%M:%S | ||
| + | log_datefmt_logfile: | ||
| + | %Y-%m-%d %H:%M:%S | ||
| + | log_file: | ||
| + | / | ||
| + | log_fmt_console: | ||
| + | | ||
| + | log_fmt_logfile: | ||
| + | %(asctime)s, | ||
| + | log_granular_levels: | ||
| + | ---------- | ||
| + | log_level: | ||
| + | debug | ||
| + | loop_interval: | ||
| + | 60 | ||
| + | master_ext_job_cache: | ||
| + | |||
| + | master_roots: | ||
| + | ---------- | ||
| + | base: | ||
| + | - / | ||
| + | master_tops: | ||
| + | ---------- | ||
| + | max_open_files: | ||
| + | 100000 | ||
| + | minion_data_cache: | ||
| + | True | ||
| + | nodegroups: | ||
| + | ---------- | ||
| + | open_mode: | ||
| + | False | ||
| + | order_masters: | ||
| + | False | ||
| + | outputter_dirs: | ||
| + | peer: | ||
| + | ---------- | ||
| + | permissive_pki_access: | ||
| + | False | ||
| + | pidfile: | ||
| + | / | ||
| + | pillar_opts: | ||
| + | True | ||
| + | pillar_roots: | ||
| + | ---------- | ||
| + | base: | ||
| + | - / | ||
| + | pillar_version: | ||
| + | 2 | ||
| + | pki_dir: | ||
| + | / | ||
| + | pub_hwm: | ||
| + | 1000 | ||
| + | publish_port: | ||
| + | 4505 | ||
| + | publish_session: | ||
| + | 86400 | ||
| + | range_server: | ||
| + | range:80 | ||
| + | reactor: | ||
| + | renderer: | ||
| + | py | ||
| + | ret_port: | ||
| + | 4506 | ||
| + | root_dir: | ||
| + | / | ||
| + | runner_dirs: | ||
| + | saltversion: | ||
| + | 0.17.4 | ||
| + | search: | ||
| + | |||
| + | search_index_interval: | ||
| + | 3600 | ||
| + | serial: | ||
| + | msgpack | ||
| + | sock_dir: | ||
| + | / | ||
| + | state_auto_order: | ||
| + | True | ||
| + | state_output: | ||
| + | full | ||
| + | state_top: | ||
| + | salt:// | ||
| + | state_verbose: | ||
| + | True | ||
| + | syndic_master: | ||
| + | |||
| + | syndic_wait: | ||
| + | 1 | ||
| + | timeout: | ||
| + | 5 | ||
| + | token_dir: | ||
| + | / | ||
| + | token_expire: | ||
| + | 43200 | ||
| + | user: | ||
| + | root | ||
| + | verify_env: | ||
| + | True | ||
| + | win_gitrepos: | ||
| + | - https:// | ||
| + | win_repo: | ||
| + | / | ||
| + | win_repo_mastercachefile: | ||
| + | / | ||
| + | worker_threads: | ||
| + | 5 | ||
| + | </ | ||
| + | |||
| + | ==== Especificar por minion id ==== | ||
| + | |||
| + | | ||
| | | ||
| + | < | ||
| + | base: | ||
| + | ' | ||
| + | - users | ||
| + | ' | ||
| + | - data | ||
| + | </ | ||
| + | ===== Grains ===== | ||
| + | |||
| + | ==== Listar ==== | ||
| + | |||
| + | sudo salt ' | ||
| + | |||
| + | < | ||
| + | client.example.com: | ||
| + | - biosreleasedate | ||
| + | - biosversion | ||
| + | - cpu_flags | ||
| + | - cpu_model | ||
| + | - cpuarch | ||
| + | - defaultencoding | ||
| + | - defaultlanguage | ||
| + | - domain | ||
| + | - fqdn | ||
| + | - fqdn_ip4 | ||
| + | - fqdn_ip6 | ||
| + | - gpus | ||
| + | - host | ||
| + | - id | ||
| + | - ip_interfaces | ||
| + | - ipv4 | ||
| + | - ipv6 | ||
| + | - kernel | ||
| + | - kernelrelease | ||
| + | - localhost | ||
| + | - lsb_distrib_codename | ||
| + | - lsb_distrib_description | ||
| + | - lsb_distrib_id | ||
| + | - lsb_distrib_release | ||
| + | - manufacturer | ||
| + | - master | ||
| + | - mem_total | ||
| + | - nodename | ||
| + | - num_cpus | ||
| + | - num_gpus | ||
| + | - os | ||
| + | - os_family | ||
| + | - osarch | ||
| + | - oscodename | ||
| + | - osfinger | ||
| + | - osfullname | ||
| + | - osrelease | ||
| + | - path | ||
| + | - productname | ||
| + | - ps | ||
| + | - pythonpath | ||
| + | - pythonversion | ||
| + | - saltpath | ||
| + | - saltversion | ||
| + | - saltversioninfo | ||
| + | - serialnumber | ||
| + | - server_id | ||
| + | - shell | ||
| + | - virtual | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== " | ||
| + | |||
| + | http:// | ||
| + | |||
| + | http:// | ||
| + | |||
| + | http:// | ||
| + | |||
| + | ===== Enlaces ===== | ||
| + | |||
| + | * Lista de state modules: | ||
| + | |||
| + | http:// | ||
| + | |||
| + | ===== Errores ===== | ||
| + | |||
| + | 2014-01-03 22: | ||
| + | |||
| + | **SOLUCION** seguir procedimiento [[salt# | ||
informatica/linux/salt.1388787329.txt.gz · Last modified: (external edit)
