Diferències
Ací es mostren les diferències entre la revisió seleccionada i la versió actual de la pàgina.
| Ambdós costats versió prèvia Revisió prèvia Següent revisió | Revisió prèvia | ||
| info:cursos:udemy:ansible:modulos [18/09/2018 02:33] – [3:41 Windows (I)] mate | info:cursos:udemy:ansible:modulos [25/09/2018 02:05] (actual) – mate | ||
|---|---|---|---|
| Línia 34: | Línia 34: | ||
| '' | '' | ||
| - | == 3:27 Ficheros y OpenSSL (I) | + | == temario |
| - | permite trabajar con ficheros, plantillas y directorios | + | * [[info:cursos:udemy:ansible:modulos:ficheros-openssl]] |
| - | * acl : establece y obtiene información de la listas de control de acceso | + | * [[info:cursos:udemy:ansible:modulos: |
| - | * archive | + | * [[info:cursos: |
| - | * assemble | + | * [[info:cursos: |
| - | * blockinfile | + | * [[info: |
| - | * copy : copiar | + | * [[info:cursos: |
| - | * fetch : copiar del nodo remoto al servidor | + | * [[info:cursos: |
| - | * file : establece atributos a ficheros | + | * [[info:cursos: |
| - | * find : devuelve una listsa de ficheros a partir de un patrón | + | * [[info:cursos: |
| - | * inifile | + | * [[info:cursos: |
| - | * iso_extract | + | * [[info: |
| - | * lineinfile | + | |
| - | * patch : aplica parches usando GNU/Patch | + | |
| - | * replace | + | |
| - | * stat : obtiene información del fichero o del FS | + | |
| - | * synchronize | + | |
| - | * tempfile | + | |
| - | * template | + | |
| - | * unarchive | + | |
| - | * xatrr : atributos extendidos | + | |
| - | los módulos para OpenSSL: | ||
| - | * openssl_privatekeys : generar claves privadas | ||
| - | * openssl_publickey : generar claves públicas | ||
| - | |||
| - | === copy | ||
| - | [[https:// | ||
| - | * obligatorios | ||
| - | * dest = / | ||
| - | * opcionales | ||
| - | * backup = yes/no | ||
| - | * content = " | ||
| - | * force = yes/no | ||
| - | * owner = usuario | ||
| - | * group = grupo | ||
| - | * mode = modo | ||
| - | * src = / | ||
| - | |||
| - | <code yaml> | ||
| - | - name: copiar configuración | ||
| - | copy: src=apache2.conf dest=/ | ||
| - | - name: crear contenido en fichero | ||
| - | copy: content=" | ||
| - | </ | ||
| - | |||
| - | === template | ||
| - | [[https:// | ||
| - | * obligatorios | ||
| - | * dest = / | ||
| - | * src = / | ||
| - | * opcionales | ||
| - | * backup = yes/no | ||
| - | * force = yes/no | ||
| - | * owner = usuario | ||
| - | * group = grupo | ||
| - | * mode = modo | ||
| - | |||
| - | <code yaml> | ||
| - | - name: copiar pantilla de configuración | ||
| - | template: src=apache2.conf.j2 dest=/ | ||
| - | </ | ||
| - | |||
| - | === file | ||
| - | [[https:// | ||
| - | * obligatorios | ||
| - | * path = / | ||
| - | * opcionales | ||
| - | * backup = yes/no | ||
| - | * force = yes/no | ||
| - | * owner = usuario | ||
| - | * group = grupo | ||
| - | * mode = modo | ||
| - | * state | ||
| - | * file | ||
| - | * link | ||
| - | * directory | ||
| - | * hard | ||
| - | * touch | ||
| - | * absent | ||
| - | |||
| - | <code yaml> | ||
| - | ... | ||
| - | tasks: | ||
| - | - name: propiedades del fichero | ||
| - | file: path="/ | ||
| - | - name: borrar el fichero | ||
| - | file: path="/ | ||
| - | - name: verificar que directorio existe | ||
| - | file: | ||
| - | path: "/ | ||
| - | state: directory | ||
| - | owner: root | ||
| - | group: systemd-journal | ||
| - | mode: 2755 | ||
| - | notify: reiniciar_journald | ||
| - | handlers: | ||
| - | - name: reiniciar_journald | ||
| - | service: name=systemd-journald state=restarted | ||
| - | </ | ||
| - | |||
| - | == 3:28 Ficheros y OpenSSL (II) | ||
| - | === stat | ||
| - | [[https:// | ||
| - | * obligatorio | ||
| - | * path = / | ||
| - | * opcional | ||
| - | * get_attributes = True / False | ||
| - | * get_checksum = True / False | ||
| - | * get_md5 = True / False | ||
| - | * get_mime = True / False | ||
| - | |||
| - | <code yaml> | ||
| - | - name: obtener datos de fichero | ||
| - | stat: path="/ | ||
| - | register: datos_fichero | ||
| - | | ||
| - | - name: mostrar información | ||
| - | debug: var=datos_fichero | ||
| - | | ||
| - | - name: en condicional | ||
| - | debug: msg=" | ||
| - | when: datos.stat.isdir # o cualauier otro atributo | ||
| - | </ | ||
| - | |||
| - | === fetch | ||
| - | [[https:// | ||
| - | * obligatorio | ||
| - | * src : / | ||
| - | * dest : server Ansible | ||
| - | * opcional | ||
| - | * fail_on_missing = yes/no | ||
| - | * flat = yes/NO : recrea la estructura de directorios de **src** en **dest** | ||
| - | |||
| - | <code yaml> | ||
| - | - name: copiar configuración red | ||
| - | fetch: src=/ | ||
| - | </ | ||
| - | |||
| - | === unarchive | ||
| - | [[https:// | ||
| - | * obligatorio | ||
| - | * src | ||
| - | * dest | ||
| - | * opcional | ||
| - | * owner | ||
| - | * group | ||
| - | * mode | ||
| - | * remote_src = true / FALSE | ||
| - | * list_files = yes / NO -> lista los ficheros que se han extraído (se puede guardar en **registry**) | ||
| - | |||
| - | <code yaml> | ||
| - | - name: copiar y extraer fichero en remoto | ||
| - | unarchive: src=< | ||
| - | | ||
| - | -name: extraer en remoto fichero ya existente allí | ||
| - | unarchive: src=< | ||
| - | </ | ||
| - | |||
| - | === lineinfile (!) | ||
| - | [[https:// | ||
| - | * obligatorio | ||
| - | * line = " | ||
| - | * dest = / | ||
| - | * en versiones más modernas, **path** | ||
| - | * opcionales | ||
| - | * owner | ||
| - | * group | ||
| - | * mode | ||
| - | * backup = yes / NO | ||
| - | * insertafter = REGEX | ||
| - | * insertbefore = REGEX | ||
| - | * regexp = REGEX | ||
| - | * state = present / absent : ?? | ||
| - | |||
| - | <code yaml> | ||
| - | - name: deshabilita SELinux | ||
| - | lineinfile: dest=/ | ||
| - | - name: eliminar la línea que permite al grupo wheel del fichero de configuración de sudoers | ||
| - | lineinfile: dest=/ | ||
| - | - name: añadir antes de una línea | ||
| - | lineinfile: dest=/ | ||
| - | </ | ||
| - | |||
| - | === blockinfile (!) | ||
| - | [[https:// | ||
| - | * obligatorio | ||
| - | * block = " | ||
| - | * dest = / | ||
| - | * opcional | ||
| - | * owner | ||
| - | * group | ||
| - | * mode | ||
| - | * backup = yes / NO | ||
| - | * insertafter = REGEX | ||
| - | * insertbefore = REGEX | ||
| - | * marker = REGEX | ||
| - | * state = present / absent : ?? | ||
| - | |||
| - | <code yaml> | ||
| - | - name: asegurar que el texto está en el fichero | ||
| - | dest: / | ||
| - | block: | | ||
| - | Match user monitor | ||
| - | Password Authentication no | ||
| - | </ | ||
| - | |||
| - | === openssl_privatekey (!) | ||
| - | [[https:// | ||
| - | * obligatorio | ||
| - | * path = / | ||
| - | * opcional | ||
| - | * force = true / false | ||
| - | * size = 4096 | ||
| - | * state = present / absent | ||
| - | * type = RSA / DSA | ||
| - | |||
| - | <code yaml> | ||
| - | - name: instalar módulo phyton requerido | ||
| - | apt: name=phyton-openssl state=latest | ||
| - | - name: generar clave privada | ||
| - | openssl_privatekey: | ||
| - | </ | ||
| - | |||
| - | === openssl_publickey (!) | ||
| - | [[https:// | ||
| - | * obligatorio | ||
| - | * path = / | ||
| - | * privatekey_path = / | ||
| - | * opcional | ||
| - | * force = false / true | ||
| - | * state = present / absent | ||
| - | |||
| - | <code yaml> | ||
| - | - name: generar clave pública | ||
| - | openssl_publickey: | ||
| - | path: / | ||
| - | privatekey_path: | ||
| - | </ | ||
| - | == 3:29 Gestor Paquetes (I) | ||
| - | para lenguajes de programación: | ||
| - | |||
| - | * bower : desarrollo web | ||
| - | * bundler : dependencias Ruby Gem | ||
| - | * composer : librerias PHP | ||
| - | * cpam : gestor módulos Perl | ||
| - | * easy_install : gestión módulos / librerias Phyton | ||
| - | * gem : gestiona Ruby Gems | ||
| - | * maven_artifact : descarga **artifacts** desde un repositorio **maven** | ||
| - | * npm : gestiona paquetes node.js | ||
| - | * pear : paquetes pear / pcl | ||
| - | * pip : gestión módulos / librerias Phyton (más que easy_install) | ||
| - | |||
| - | para OS: | ||
| - | * apk : gestión paquetes android | ||
| - | * apt : | ||
| - | * apt_key: | ||
| - | * apt_repositiry | ||
| - | * dnf : fedora | ||
| - | * macports : paquetes macports OSX | ||
| - | * openbsd_pkg : paquetes openBSD | ||
| - | * opkg : paquetes OpenWRT (routers, firmware) | ||
| - | * package : módulo genérico que llama a los otros módulos (wrapper) | ||
| - | * pacman : paquetes arch linux | ||
| - | * pkg5 : paquetes Solaris 11 | ||
| - | * pkgin : paquetes SmartOS, NetBsd y otros | ||
| - | * pkgng : paquetes FreeBSD >= 9.0 | ||
| - | * portage : Gentoo | ||
| - | * redhat_subscription : administra repositorios y subscripciones Red Hat, usando el comando **subscription-manager** | ||
| - | * slackpkg : paquetes slackware >=12.2 | ||
| - | * swdepot : paquetes HP_UX | ||
| - | * yum : | ||
| - | * yum_repository | ||
| - | * zypper : paquetes / repositorios OpenSuse / Suse | ||
| - | * zypper_respository | ||
| - | |||
| - | === cpanm | ||
| - | PERL\\ | ||
| - | [[https:// | ||
| - | * from_path = ruta | ||
| - | * name = nombre | ||
| - | * localib = ruta | ||
| - | * mirror = mirror | ||
| - | * mirror_only = no / yes | ||
| - | * notest = no / yes | ||
| - | * version = version | ||
| - | * system_lib = directorio | ||
| - | * < | ||
| - | |||
| - | <code yaml> | ||
| - | - name: instalar gcc | ||
| - | yum: name=gcc state=latest | ||
| - | - name: instalar paquete básico | ||
| - | yum: name=perl-App-cpanminus state=latest | ||
| - | - name: instalar módulo DBI | ||
| - | cpanm : name=DBI | ||
| - | - name: instalar versión específica | ||
| - | cpanm: name=DBI version=" | ||
| - | </ | ||
| - | |||
| - | === easy_install | ||
| - | [[https:// | ||
| - | * obligatorio | ||
| - | * name = nombre | ||
| - | * opcional | ||
| - | * state = present | latest | ||
| - | * virtualenv = no / yes | ||
| - | * virtualenv_command = comando | ||
| - | * virtualenv_site_packages = no / yes | ||
| - | * exectutable = ruta ejecución easy_install | ||
| - | |||
| - | <code yaml> | ||
| - | - name: instalar PiP | ||
| - | easy_install: | ||
| - | # se usa PiP en lugar easy_install | ||
| - | </ | ||
| - | |||
| - | === pip | ||
| - | [[https:// | ||
| - | * obligatorio | ||
| - | * name = nombre | ||
| - | * opcional | ||
| - | * state = present | latest | absent | forcereinstall | ||
| - | * virtualenv = no / yes | ||
| - | * virtualenv_command = comando | ||
| - | * virtualenv_site_packages = no / yes | ||
| - | * exectutable = ruta ejecución | ||
| - | * requirements = fichero.txt (dependencias) -> requirements.txt | ||
| - | * version = version | ||
| - | * chdir = ruta | ||
| - | |||
| - | <code yaml> | ||
| - | - name: instalar módulo requests | ||
| - | pip: name=requests state=latest | ||
| - | </ | ||
| - | == 3:30 Gestor Paquetes (II) | ||
| - | === apt | ||
| - | [[https:// | ||
| - | * name = nombre[=versión] | ||
| - | * state = { latest | absent | PRESENT | build-dep } | ||
| - | * latest : a la última | ||
| - | * absent : eliminar | ||
| - | * build-dep : dependencias | ||
| - | * upgrade = { no | yes | safe | full | dist } | ||
| - | * force = no / yes | ||
| - | * update_cache = no / yes | ||
| - | * purge = no / yes | ||
| - | * deb = ruta/ | ||
| - | * autoremove = no / yes | ||
| - | * default_release = release | ||
| - | |||
| - | <code yaml> | ||
| - | - name: actualizar lista paquetes | ||
| - | apt: update_cache=yes | ||
| - | - name: actualizar paquetes | ||
| - | apt: upgrade=dist | ||
| - | - name: instalar nginx | ||
| - | apt: | ||
| - | name: nginx | ||
| - | state: latest | ||
| - | </ | ||
| - | |||
| - | === apt_key | ||
| - | [[https:// | ||
| - | * data = contenido de la key a añadir (desde Ansible Server) | ||
| - | * file = ubicación fichero en nodo remoto | ||
| - | * id = identificador | ||
| - | * keyring = / | ||
| - | * keyserver = servidor | ||
| - | * state = { PRESENT | absent } | ||
| - | * url = dirección | ||
| - | * validate_certs = yes / no | ||
| - | |||
| - | <code yaml> | ||
| - | - name: añadir clave usando servidor | ||
| - | apt_key: | ||
| - | keyserver: keyserver.ubuntu.com | ||
| - | id: 36A1D7869245C8950F... | ||
| - | | ||
| - | - name: añadir utilizando un fichero adjunto | ||
| - | apt_key: | ||
| - | url: " | ||
| - | state: present | ||
| - | </ | ||
| - | == 3:31 Gestor Paquetes (III) | ||
| - | === apt_repository | ||
| - | [[https:// | ||
| - | * obligatorio | ||
| - | * repo = origen | ||
| - | * opcional | ||
| - | * state = { PRESENT | absent } | ||
| - | * filename = nombre fichero repositorio | ||
| - | * update_cache = yes / no | ||
| - | * validate_certs = yes / no | ||
| - | * mode = modo_fichero | ||
| - | |||
| - | <code yaml> | ||
| - | - name: anyadir repositorio google chrome | ||
| - | apt_repository: | ||
| - | repo: "deb http:// | ||
| - | state: present | ||
| - | filename: " | ||
| - | - name: anaydir en Ububtu a través de PPA | ||
| - | apt_repository: | ||
| - | repo: " | ||
| - | </ | ||
| - | |||
| - | === package | ||
| - | wrapper, usar si no requerimos alguna opción concreta de otro módulo de paquetes\\ | ||
| - | [[https:// | ||
| - | * requerido | ||
| - | * name = origen | ||
| - | * state = { present | absent | latest } | ||
| - | * opcional | ||
| - | * use = { auto | yum | apt } | ||
| - | |||
| - | <code yaml> | ||
| - | - name instalar ntpdate | ||
| - | package: | ||
| - | name: ntpupdate | ||
| - | state: latest | ||
| - | </ | ||
| - | </ | ||
| - | |||
| - | === redhat_subscription | ||
| - | [[https:// | ||
| - | * state = { present | absent } | ||
| - | * activationkey | ||
| - | * username | ||
| - | * password | ||
| - | * autosubscribe = yes / no | ||
| - | * server_hostname = nombre servidor | ||
| - | * org_id = organización | ||
| - | * pool = nombre | ||
| - | * force_register = yes / no | ||
| - | |||
| - | <code yaml> | ||
| - | - name: registrar sistema | ||
| - | redhat_subscription: | ||
| - | state: present | ||
| - | username: usuario@dominio | ||
| - | password: contraseña | ||
| - | autosubscribe: | ||
| - | - name: registrar sistema 2 | ||
| - | redhat_subscription: | ||
| - | state: present | ||
| - | activationkey: | ||
| - | org_id: 2468 | ||
| - | pool "^Red Hat Enterprise Server$" | ||
| - | </ | ||
| - | |||
| - | === yum | ||
| - | [[https:// | ||
| - | * requerido | ||
| - | * name = nombre / ruta | ||
| - | * opcional | ||
| - | * state = { present | absent | latest } | ||
| - | * conf_file = / | ||
| - | * disable_gpg_check = true / false | ||
| - | * disablerepo = nombre (desactiva temporalmente) | ||
| - | * enablerepo = nombre (activa temporalmente) | ||
| - | * update_cache = yes / no | ||
| - | |||
| - | <code yaml> | ||
| - | - name: instalar última versión apache | ||
| - | yum: | ||
| - | name: httpd | ||
| - | state: latest | ||
| - | - name: actualizar todos los paquetes | ||
| - | yum: | ||
| - | name: " | ||
| - | state: latest | ||
| - | - name: Instalar grupo | ||
| - | yum: | ||
| - | name: " | ||
| - | state: present | ||
| - | </ | ||
| - | |||
| - | === yum_repository | ||
| - | [[https:// | ||
| - | * requerido | ||
| - | * name = nombre / ruta | ||
| - | * opcional | ||
| - | * state = { present | absent } | ||
| - | * description = descripción | ||
| - | * baseurl = dirección | ||
| - | * file = nombre_fichero | ||
| - | * mirrorlist = dirección | ||
| - | * enabled = YES / no | ||
| - | * gpgcheck = YES / no | ||
| - | |||
| - | <code yaml> | ||
| - | - name: añadir EPEL | ||
| - | yum_repository: | ||
| - | name: epel | ||
| - | state: present | ||
| - | description: | ||
| - | baseurl: http:// | ||
| - | </ | ||
| - | == 3:32 Comando Utilidades (I) | ||
| - | ejecución de comandos en el nodo remoto | ||
| - | * command | ||
| - | * expect : ejecuta un comando y responde a la introducción de dataos | ||
| - | * raw : envía comandos sin filtrar por SSH | ||
| - | * script : transfiere y ejecuta un script | ||
| - | * shell : permite uso de && || >> (command no lo permite) | ||
| - | |||
| - | === command | ||
| - | [[https:// | ||
| - | * chdir : cambiar directorio ejecución | ||
| - | * creates : si existe el fichero, NO ejecuta | ||
| - | * executable : ruta binario | ||
| - | * removes : si no existe el fichero, NO ejecuta | ||
| - | <code yaml> | ||
| - | - name: obtener uname | ||
| - | command: uname -a | ||
| - | register: salida_uname | ||
| - | - name: crear base de datos si no existe | ||
| - | command: / | ||
| - | args: | ||
| - | chdir: / | ||
| - | creates: / | ||
| - | - name: ejecutar si existe | ||
| - | command uname -a removes=/ | ||
| - | </ | ||
| - | |||
| - | |||
| - | === expect | ||
| - | [[https:// | ||
| - | * requerido | ||
| - | * command = comando | ||
| - | * response = respuestas | ||
| - | * opcional | ||
| - | * chdir | ||
| - | * creates | ||
| - | * removes | ||
| - | * echo | ||
| - | * timeout | ||
| - | |||
| - | <code yaml> | ||
| - | - name: instalar pexpect, necesario en el nodo remoto | ||
| - | yum: name=pexpect state=latest | ||
| - | - name: cambiar contraseña usuario | ||
| - | expect: | ||
| - | command: passwd usuario | ||
| - | responses: (? | ||
| - | </ | ||
| - | instalar versión específica (en módulo Phyton): '' | ||
| - | |||
| - | | ||
| - | == 3:33 Comando Utilidades (II) | ||
| - | === raw | ||
| - | usar en casos muy concretos (dispositivos sin Phyton o versiones viejas), viaja sin encriptar\\ | ||
| - | [[https:// | ||
| - | * executable = / | ||
| - | <code yaml> | ||
| - | - name: actualizar paquetes e instalar uno | ||
| - | raw: apt-get update && apt-get install vim | ||
| - | </ | ||
| - | |||
| - | |||
| - | === script | ||
| - | copia el script en el nodo y se ejecuta allí\\ | ||
| - | [[https:// | ||
| - | * creates = / | ||
| - | * removes = / | ||
| - | * decrypt = true / false <- vault | ||
| - | |||
| - | <code yaml> | ||
| - | - name: copia y ejecuta el script | ||
| - | script: / | ||
| - | </ | ||
| - | |||
| - | === shell | ||
| - | ejecuta comandos, pero permite (**command** no lo hace) el uso de tuberías, redirecciones, | ||
| - | [[https:// | ||
| - | * chdir = /directorio | ||
| - | * creates = / | ||
| - | * removes = / | ||
| - | * executable | ||
| - | |||
| - | <code yaml> | ||
| - | - name: obtener uname | ||
| - | shell: uname -a | tee fichero.log | ||
| - | register: salida_uname | ||
| - | - name obtener uname 2 | ||
| - | shell: uname -a | tee fichero.log | ||
| - | args: | ||
| - | executable: /bin/bash | ||
| - | chdir: /tmp | ||
| - | </ | ||
| - | |||
| - | === assert | ||
| - | asegurarse que se cumplen ciertas condiciones\\ | ||
| - | [[https:// | ||
| - | * that : condiciones | ||
| - | * msg : mensaje a mostrar | ||
| - | <code yaml> | ||
| - | - vars: | ||
| - | - numero: 50 | ||
| - | - assert: | ||
| - | that: | ||
| - | - numero <= 100 | ||
| - | - numero > 0 | ||
| - | msg: " | ||
| - | </ | ||
| - | |||
| - | ===debug | ||
| - | muestra un texto personalizado o el valor de una variable\\ | ||
| - | [[https:// | ||
| - | * msg = " | ||
| - | * var= variable | ||
| - | * verbosity = [0-3] | ||
| - | <code yaml> | ||
| - | - debug: msg=" | ||
| - | - debug: var=salida # muestra todo el array, se puede especificar cualquiera de ellos | ||
| - | </ | ||
| - | |||
| - | === pause | ||
| - | [[https:// | ||
| - | * prompt = "texto a mostrar" | ||
| - | * minutes = minutos | ||
| - | * seconds = segundos | ||
| - | |||
| - | === fail | ||
| - | generar mensaje error y salir\\ | ||
| - | [[https:// | ||
| - | |||
| - | * msg = " | ||
| - | <code yaml> | ||
| - | - fail: msg=" | ||
| - | when: valor not in [' | ||
| - | </ | ||
| - | |||
| - | == 3:34 Comando Utilidades (III) | ||
| - | === include | ||
| - | incluir otro playbook / tareas\\ | ||
| - | [[https:// | ||
| - | <code yaml; / | ||
| - | include: name=" | ||
| - | include: name=" | ||
| - | include: name=" | ||
| - | </ | ||
| - | |||
| - | |||
| - | === include_role | ||
| - | incluir rol\\ | ||
| - | [[https:// | ||
| - | * obligatorio | ||
| - | * name | ||
| - | * opcional | ||
| - | * private = true / false | ||
| - | * tasks_from = main | ||
| - | * vars_from = main | ||
| - | * defaults_from = main | ||
| - | * allow_duplicates = true / false | ||
| - | |||
| - | === include_vars | ||
| - | incluir | ||
| - | [[https:// | ||
| - | |||
| - | |||
| - | |||
| - | |||
| - | <code yaml; playbook> | ||
| - | --- | ||
| - | - hosts: localhost | ||
| - | - vars: | ||
| - | - numero: 10 | ||
| - | - tasks: | ||
| - | - include_vars: | ||
| - | - include_rol: | ||
| - | </ | ||
| - | <code yaml; variables.yml> | ||
| - | otronumero: 20 | ||
| - | </ | ||
| - | |||
| - | === self_fact | ||
| - | establece un fact\\ | ||
| - | [[https:// | ||
| - | |||
| - | permite modificar textos / variables | ||
| - | |||
| - | <code yaml> | ||
| - | - tasks: | ||
| - | - set_fact: nombre=" | ||
| - | - debug: var=nombre | ||
| - | - set_fact: nombre2=" | ||
| - | </ | ||
| - | |||
| - | |||
| - | === wait_for | ||
| - | espera que se cumpla una condición para continuar (conexión SSH o si un fichero existe, por ejemplo)\\ | ||
| - | [[http:// | ||
| - | |||
| - | * state = { present | absent | started | stopped } | ||
| - | * files: present/ | ||
| - | * port = puerto | ||
| - | * timeout = segundos de espera a conectar si no hay respuesta | ||
| - | * host = servidor al que conectar | ||
| - | * connection_timeout = | ||
| - | * search_regex = cadena esperada (ya sea conexión o fichero) | ||
| - | * delay = segundos de espera antes de empezar a enviar peticiiones | ||
| - | * path = / | ||
| - | * exclude_hosts | ||
| - | |||
| - | <code yaml> | ||
| - | - hosts: localhost | ||
| - | tasks: | ||
| - | - name: esperando al puerto 8080 | ||
| - | wait_for: port=8080 delay=2 | ||
| - | - name: esperando a que exista el fichero | ||
| - | wait_for: path=/ | ||
| - | - name: esperando a que no exista el fichero | ||
| - | wait_for: path=/ | ||
| - | </ | ||
| - | <code yaml> | ||
| - | - name: esperando a server | ||
| - | wait_for: | ||
| - | port: 22 | ||
| - | host: "{{ ansible_hostname ]]" | ||
| - | search_regex: | ||
| - | delay: 10 | ||
| - | delegate_to: | ||
| - | </ | ||
| - | '' | ||
| - | |||
| - | |||
| - | |||
| - | == 3:35 Notificaciones | ||
| - | sistemas de mensajería: | ||
| - | * cisco_spark | ||
| - | * flowdock | ||
| - | * hipchat | ||
| - | * irc | ||
| - | * jabber | ||
| - | * mattermost : tipo **slack** pero de código abierto | ||
| - | * mqt : mensajería IoT | ||
| - | * nexmo : SMS | ||
| - | * pushbullet : móbiles | ||
| - | * pushover : móbiles | ||
| - | * rocketchat | ||
| - | * sendgrid | ||
| - | * slack | ||
| - | * sns : Simple Notification Service Amazon | ||
| - | * telegram | ||
| - | * twilo | ||
| - | |||
| - | === hipchat | ||
| - | [[https:// | ||
| - | * requeridos | ||
| - | * token | ||
| - | * msg | ||
| - | * room | ||
| - | * opcional | ||
| - | * api | ||
| - | * color | ||
| - | * from | ||
| - | * msg_format = { text | html } | ||
| - | * notify = yes / no | ||
| - | * validate_certs = YES / no | ||
| - | |||
| - | <code yaml> | ||
| - | --- | ||
| - | - hosts: localhost | ||
| - | connection: localhost | ||
| - | vars: | ||
| - | - notificar: " | ||
| - | tasks: | ||
| - | - hipchat: | ||
| - | api: https:// | ||
| - | token: " | ||
| - | room: destinatario | ||
| - | msg: "Tarea finalizada" | ||
| - | when: notificar == " | ||
| - | - mail: | ||
| - | subject: "Tarea finalizada" | ||
| - | delegate_to: | ||
| - | when: notificar == " | ||
| - | - pip: name=pushbullet.py | ||
| - | when: notificar == " | ||
| - | </ | ||
| - | | ||
| - | | ||
| - | |||
| - | [[https:// | ||
| - | * requerido | ||
| - | * subject | ||
| - | * opcional | ||
| - | * host | ||
| - | * port | ||
| - | * user | ||
| - | * password | ||
| - | * to | ||
| - | * body | ||
| - | * cc | ||
| - | * bcc | ||
| - | * secure = { always | never | try | starttls } | ||
| - | |||
| - | <code yaml> | ||
| - | --- | ||
| - | - hosts: localhost | ||
| - | connection: localhost | ||
| - | vars: | ||
| - | - notificar: " | ||
| - | tasks: | ||
| - | - mail: | ||
| - | subject: "Tarea finalizada" | ||
| - | host: servidor.correo | ||
| - | port: 25 | ||
| - | to: alberto@correo | ||
| - | delegate_to: | ||
| - | when: notificar == " | ||
| - | </ | ||
| - | |||
| - | === pushbullet | ||
| - | [[https:// | ||
| - | * requerido | ||
| - | * api_key | ||
| - | * title | ||
| - | * opcional | ||
| - | * body | ||
| - | * channel | ||
| - | * device | ||
| - | * push_type | ||
| - | |||
| - | <code yaml> | ||
| - | --- | ||
| - | - hosts: localhost | ||
| - | connection: localhost | ||
| - | vars: | ||
| - | - notificar: " | ||
| - | tasks: | ||
| - | - name: instalar pushbullet.py | ||
| - | pip: name=pushbullet.py state=latest | ||
| - | when: notificar == " | ||
| - | - name: enviar notificación | ||
| - | pushbullet: | ||
| - | api_key: < | ||
| - | device: < | ||
| - | title: " | ||
| - | when: notificar == " | ||
| - | </ | ||
| - | |||
| - | === pushover | ||
| - | [[https:// | ||
| - | * requeridos | ||
| - | * app_token | ||
| - | * user_key | ||
| - | * msg | ||
| - | * opcional | ||
| - | * pri = prioridad | ||
| - | |||
| - | === rocketchat | ||
| - | [[https:// | ||
| - | * requeridos: | ||
| - | * token | ||
| - | * domain | ||
| - | * opcional | ||
| - | * mdg | ||
| - | * channel | ||
| - | * username | ||
| - | * color = { normal | good | warning | danger } | ||
| - | * protocol = { https | http } | ||
| - | * validate_certs = true /false | ||
| - | |||
| - | === slack | ||
| - | [[https:// | ||
| - | * requerido | ||
| - | * token | ||
| - | * opcional | ||
| - | * msg | ||
| - | * channel = #canal | ||
| - | * username | ||
| - | * color = { normal | good | warning | danger } | ||
| - | * validate_certs = true / false | ||
| - | |||
| - | == 3:36 Bases Datos | ||
| - | |||
| - | * mysql: | ||
| - | * mysql_db : añade o elimina BBDD | ||
| - | * mysql_replication : administra replicación | ||
| - | * mysql_user : administra usuarios | ||
| - | * mysql_variables : administra variables globales | ||
| - | * postgresql | ||
| - | * postgres_db : añade o elimina BBDD | ||
| - | * postgres_ext : administra extensiones | ||
| - | * postgres_lang : administra procedimientos almacenados | ||
| - | * postgres_privs : administra privilegios | ||
| - | * postgres_schema : administra esquemas | ||
| - | * postgres_user : administra usuarios | ||
| - | * MongoDB | ||
| - | * mongodb_parameter : gestionar parámetros | ||
| - | * mongodb_user : administrar usuarios | ||
| - | * Influxdb | ||
| - | * influxdb_database: | ||
| - | * retention_policy: | ||
| - | * Vertica (HPE) | ||
| - | * Miscelanea | ||
| - | * elasticsearch_plugin | ||
| - | * kibana_plugin | ||
| - | * redis | ||
| - | * riak | ||
| - | |||
| - | === mysql_db | ||
| - | * requiere | ||
| - | * name = nombre BDD | ||
| - | * opcional | ||
| - | * state = { present | absent | dump | import } | ||
| - | * login_host | ||
| - | * login_password | ||
| - | * login_port | ||
| - | * login_user | ||
| - | * login_unix.socket | ||
| - | * encoding | ||
| - | * collation : (idioma) es_ES.UTF8 | ||
| - | * target | ||
| - | |||
| - | <code yaml> | ||
| - | - name: Instalar libreria requerida | ||
| - | pip: name=pytho_mysql state=latest | ||
| - | |||
| - | - name: crear si no existe la BDD | ||
| - | mysql_db: | ||
| - | name: <bdd> | ||
| - | state: present | ||
| - | | ||
| - | - name: copia de seguridad todas las BDD | ||
| - | mysql_db: | ||
| - | state: dump | ||
| - | name: all # palabra clave | ||
| - | target: /tmp/{{ ansible.hostname }}.sql | ||
| - | </ | ||
| - | |||
| - | === mysql_user | ||
| - | * requerido | ||
| - | * name = nombre | ||
| - | * opcional | ||
| - | * state = { present | absent } | ||
| - | * password | ||
| - | * encrypted = no / yes | ||
| - | * login_host | ||
| - | * login_password | ||
| - | * login_port | ||
| - | * login_user | ||
| - | * login_unix.socket | ||
| - | * priv = dbtabla: | ||
| - | * append_privs = yes / no <- añadir o sustituir | ||
| - | |||
| - | <code yaml> | ||
| - | - name: crear usuario y darle permisos | ||
| - | mysql_user: | ||
| - | name: < | ||
| - | password: < | ||
| - | state: present | ||
| - | priv: "< | ||
| - | </ | ||
| - | |||
| - | === postgres_db | ||
| - | * requerido | ||
| - | * name = nombreBDD | ||
| - | * opcional | ||
| - | * state = { present | absent } | ||
| - | * login_host | ||
| - | * login_password | ||
| - | * port | ||
| - | * login_user | ||
| - | * login_unix.socket | ||
| - | * encoding | ||
| - | * lc_collate | ||
| - | * template | ||
| - | |||
| - | <code yaml> | ||
| - | - name: instalarlibrería requerida | ||
| - | pip: name=pstcopg2 state=latest | ||
| - | - name: crear si no existe | ||
| - | postgresql_db: | ||
| - | name: < | ||
| - | state: present | ||
| - | encoding: utf-8 | ||
| - | become_user: | ||
| - | </ | ||
| - | |||
| - | === postgres_user | ||
| - | * requerido | ||
| - | * name = usuaroi | ||
| - | * opcionales | ||
| - | * state = { present | absent } | ||
| - | * login_host | ||
| - | * login_password | ||
| - | * port = 5432 | ||
| - | * login_user | ||
| - | * login_unix.socket | ||
| - | * password | ||
| - | * encrypted = yes / no | ||
| - | * priv = tabla: | ||
| - | * role_attr_flags | ||
| - | * (NO)SUPERUSER | ||
| - | * (NO)CREATEROL | ||
| - | * (NO)CREATEUSER | ||
| - | * (NO)CREATEDB | ||
| - | * (NO)INHERIT | ||
| - | * (NO)LOGIN | ||
| - | * (NO)REPLICATION | ||
| - | * db | ||
| - | |||
| - | <code yaml> | ||
| - | - name: crear si no existe | ||
| - | postgresql_user: | ||
| - | db: <base de datos> | ||
| - | name: < | ||
| - | state: present | ||
| - | password: < | ||
| - | priv: ALL | ||
| - | </ | ||
| - | |||
| - | === mongodb_user | ||
| - | * requerido | ||
| - | * name = usuario | ||
| - | * database = nombre | ||
| - | * opcional | ||
| - | * state = { present | absent } | ||
| - | * password = contraseña usuario | ||
| - | * login_host | ||
| - | * login_password | ||
| - | * login_port = 27017 | ||
| - | * login_user | ||
| - | * roles | ||
| - | * READWRITE | ||
| - | * read | ||
| - | * dbAdmin | ||
| - | * userAdmin | ||
| - | * clusterAdmin | ||
| - | * ... | ||
| - | |||
| - | <code yaml> | ||
| - | - name: instalar librería requerida | ||
| - | pip: name=pymongo state=latest | ||
| - | - name: crear usuario | ||
| - | mongodb_user: | ||
| - | database: admin | ||
| - | name: < | ||
| - | password: < | ||
| - | state: present | ||
| - | </ | ||
| - | == 3:37 Gestionar Sistema (I) | ||
| - | * alternatives : gestionar alternativas (versiones) para comandos | ||
| - | * ''/ | ||
| - | * at : programar ejecución de comandos | ||
| - | * authorized_keys : gestión ficheros claves | ||
| - | * cron : gestión de cron | ||
| - | * crypttab : cifrado de dispositivos | ||
| - | * filesystem : sistema de ficheros | ||
| - | * firewald : equivalente en CentOS/ | ||
| - | * gluster-volume : gestión de volumenes GlusterFS | ||
| - | * group : gestión de grupos | ||
| - | * hostname : gestión nombre servidor | ||
| - | * iptables : gestión reglas firewall | ||
| - | * known_hosts : gestsionar claves de otros servidores | ||
| - | * lvg : LVM | ||
| - | * lvol : LVM | ||
| - | * | ||
| - | * mount : montaje de FS | ||
| - | * open_iscsi : gestión dispositivos icsci | ||
| - | * openwrt_init : gestionar servicios OpenWRT | ||
| - | * pam_limits : gestión límites PAM | ||
| - | * pamd : gestión módulos PAM | ||
| - | * ping : comprobar conexión | ||
| - | * seboolean | ||
| - | * selcontext | ||
| - | * selinux | ||
| - | * selinux_permisive | ||
| - | * seport : soporte SELinux | ||
| - | * service : gestión servicios | ||
| - | * setup : información del sistema | ||
| - | * gather_facts: | ||
| - | * sysctl : configurar / | ||
| - | * systemd : gestión de servicios | ||
| - | * timezone : zonas horarias | ||
| - | * user: gestión usuarios | ||
| - | |||
| - | === alternatives | ||
| - | gestión de **/ | ||
| - | [[https:// | ||
| - | * requerido | ||
| - | * name = nombre | ||
| - | * path = / | ||
| - | * opcional | ||
| - | * link = / | ||
| - | * priority = 50 | ||
| - | <code yaml> | ||
| - | - name: fijar la versión de Java a 8 | ||
| - | alternatives: | ||
| - | name: java | ||
| - | path: / | ||
| - | </ | ||
| - | ''/ | ||
| - | |||
| - | === authorized_keys | ||
| - | [[https:// | ||
| - | * requerido | ||
| - | * user = < | ||
| - | * key = < | ||
| - | * opcional | ||
| - | * state = { present | absent } | ||
| - | * path = ~/ | ||
| - | * manage_dir = yes / no <- crea carpeta / fichero y ajusta permisos | ||
| - | * key_options = opciones | ||
| - | * exclusive = no / yes <- si ya existe no se añade | ||
| - | |||
| - | <code yaml> | ||
| - | - name: autorizar clave pública | ||
| - | authorized_keys: | ||
| - | user: < | ||
| - | key: " | ||
| - | </ | ||
| - | |||
| - | === cron | ||
| - | [[https:// | ||
| - | * name = nombre | ||
| - | * job = comando | ||
| - | * state = { present | absent } | ||
| - | * minute = [0 - 59] | ||
| - | * hour = [0 - 23] | ||
| - | * weekday = [0-6] | ||
| - | * month = [1-12] | ||
| - | * day = [1-31] | ||
| - | * special_time = { reboot | yearly | annualy | monthly | weekly | daily | hourly } | ||
| - | * cron_file = nombre <- crea el fichero en **/ | ||
| - | * backup = yes / no | ||
| - | |||
| - | |||
| - | == 3:38 Gestionar Sistema (II) | ||
| - | === filesystem | ||
| - | [[https:// | ||
| - | * requerido | ||
| - | * dev = dispositivo | ||
| - | * fstype = sistema de ficheros | ||
| - | * opcionales | ||
| - | * force = no / yes | ||
| - | * opts = opciones | ||
| - | * resicefs = no /yes | ||
| - | |||
| - | <code yaml> | ||
| - | - name: crear FS xfs | ||
| - | filesystem: | ||
| - | dev: /dev/sdX1 | ||
| - | fstype: xfs | ||
| - | </ | ||
| - | |||
| - | === firewalld | ||
| - | control del firewall en sistemas CentOS/RH\\ | ||
| - | [[https:// | ||
| - | * requerido | ||
| - | * state = { enabled | disabled } | ||
| - | * permanent = true / false <- hace falta **+reload** (handler) | ||
| - | * opcional | ||
| - | * servicio | ||
| - | * zone | ||
| - | * port | ||
| - | * source | ||
| - | * rol_rule | ||
| - | * immediate = false / true | ||
| - | |||
| - | <code yaml> | ||
| - | - name: permitir acceso http/https | ||
| - | firewalld: | ||
| - | state: present | ||
| - | service: "{{ item }}" | ||
| - | permanent: true | ||
| - | with_items: | ||
| - | - " | ||
| - | - " | ||
| - | </ | ||
| - | <code yaml> | ||
| - | - name: permitir acceso http/https | ||
| - | firewalld: | ||
| - | state: present | ||
| - | service: "{{ item }}" | ||
| - | permanent: true | ||
| - | with_items: | ||
| - | - " | ||
| - | - " | ||
| - | </ | ||
| - | |||
| - | === group | ||
| - | [[https:// | ||
| - | * requerido | ||
| - | * name = nombre | ||
| - | * opcional | ||
| - | * state = { present | absent } | ||
| - | * gid = idgrupo | ||
| - | * system = yes / no | ||
| - | |||
| - | <code yaml> | ||
| - | - name: crear grupo para aplicación | ||
| - | group: | ||
| - | name: jboss | ||
| - | state: present | ||
| - | gid: 185 | ||
| - | </ | ||
| - | |||
| - | === hostname | ||
| - | [[https:// | ||
| - | * name = nombre | ||
| - | |||
| - | <code yaml> | ||
| - | - name: cambiar el nombre del servidor | ||
| - | hostname: | ||
| - | name: servidor.dominio.com | ||
| - | </ | ||
| - | |||
| - | === ping ? | ||
| - | [[https:// | ||
| - | <code yaml> | ||
| - | - name: comprobar conexión | ||
| - | ping: | ||
| - | </ | ||
| - | |||
| - | === timezone | ||
| - | [[https:// | ||
| - | * hwclock = true / false | ||
| - | * name = Area/Ciudad | ||
| - | |||
| - | <code yaml> | ||
| - | - name definir huso horario | ||
| - | timezone: | ||
| - | name: Europe/ | ||
| - | </ | ||
| - | |||
| - | == 3:39 Gestionar Sistema (III) | ||
| - | === iptables | ||
| - | [[https:// | ||
| - | * state = { present | absent } | ||
| - | * chain = { INPUT | FORWARD | OUTPUT | PREROUTING | POSTROUTING | SECMARK | CONNSEMARK } | ||
| - | * source = dirección | ||
| - | * jump = { ACCEPT | DROP | ... } | ||
| - | * in_interface | ||
| - | * out_interface | ||
| - | * protocol = { tcp | udp | icmp } | ||
| - | * destination_port = puerto | ||
| - | * to_ports = puerto | ||
| - | * cstate = { INVALID | NEW | ESTABLISHED | RELATED | UNTRACKED | SNAT | DNAT } | ||
| - | |||
| - | <code yaml> | ||
| - | - name: permitir acceso puerto 80 | ||
| - | iptables: | ||
| - | chain: INPUT | ||
| - | source: 0.0.0.0 | ||
| - | destination_port: | ||
| - | jump: ACCEPT | ||
| - | protocol: tcp | ||
| - | </ | ||
| - | |||
| - | === lvg | ||
| - | [[https:// | ||
| - | * requerido | ||
| - | * vg = grupo de volumen | ||
| - | * opcional | ||
| - | * state = { present | absent } | ||
| - | * pvs = /dev/vbX | ||
| - | * pesize = 4 (Mb) | ||
| - | * vg_options = opciones vgcreate | ||
| - | * force = yes / no | ||
| - | |||
| - | <code yaml> | ||
| - | - name: crear grupo de volúmenes | ||
| - | lvg: | ||
| - | vg: datavg | ||
| - | pvs: /dev/vda1 | ||
| - | state: present | ||
| - | </ | ||
| - | '' | ||
| - | |||
| - | === lvol | ||
| - | [[https:// | ||
| - | |||
| - | * requerido | ||
| - | * vg = nombre VG existente | ||
| - | * lv = nombre volumen lógico | ||
| - | * opcional | ||
| - | * state = { present | absent } | ||
| - | * size = tamaño | ||
| - | * pvs = /dev/vg1 | ||
| - | * opts = opciones | ||
| - | * active = yes / no | ||
| - | * force = yes / no | ||
| - | |||
| - | <code yaml> | ||
| - | - name: creación volumen lógico | ||
| - | lvol: vg=datavg lv=web size=2G state=present | ||
| - | </ | ||
| - | '' | ||
| - | |||
| - | === mount | ||
| - | [[https:// | ||
| - | * requerido | ||
| - | * name = | ||
| - | * state = { present | absent | mounted |unmounted } | ||
| - | * opcional | ||
| - | * pstype = tipo FS | ||
| - | * opts = opciones | ||
| - | * src = dispositivo | ||
| - | * dump = 0 | ||
| - | * passno = 0 | ||
| - | |||
| - | <code yaml> | ||
| - | - name: montar partición WWW | ||
| - | - filesystem: dev=/ | ||
| - | - mount: src=/ | ||
| - | </ | ||
| - | |||
| - | == 3:40 Gestionar Sistema (IV) | ||
| - | === service | ||
| - | [[https:// | ||
| - | * requerido | ||
| - | * name | ||
| - | * opcional | ||
| - | * state = { started | stopped | restarted | reloaded } | ||
| - | * enabled = yes / no | ||
| - | * arguments = argumentos | ||
| - | * sleep = segundos | ||
| - | |||
| - | <code yaml> | ||
| - | - name: iniciar y habilitar servicio | ||
| - | service: | ||
| - | name: apache2 | ||
| - | state: started | ||
| - | enabled: true | ||
| - | </ | ||
| - | |||
| - | === setup | ||
| - | [[https:// | ||
| - | * fact_path = / | ||
| - | * filter = * | ||
| - | * gather_subset = { all | hardware | network | virtual } | ||
| - | * gather_timeout = 10 | ||
| - | |||
| - | <code yaml> | ||
| - | - name: obtiene facts | ||
| - | setup | ||
| - | | ||
| - | </ | ||
| - | |||
| - | === sysctl | ||
| - | cambios en el kernel\\ | ||
| - | [[https:// | ||
| - | * requerido | ||
| - | * name | ||
| - | * opcional | ||
| - | * value = valor | ||
| - | * state { PRESENT | absent } | ||
| - | * reload = yes / no <- '' | ||
| - | * systcl_file = / | ||
| - | * sysctl_set = yes / no <- establecer valores | ||
| - | * ignoreerrors = no / yes | ||
| - | |||
| - | <code yaml> | ||
| - | - name: permitir redirigir el tráfico | ||
| - | sysctl: | ||
| - | name: net.ipv4.ip_forward | ||
| - | value: 1 | ||
| - | sysctl_set: yes | ||
| - | state: present | ||
| - | reload: yes | ||
| - | </ | ||
| - | '' | ||
| - | |||
| - | === systemd | ||
| - | [[https:// | ||
| - | * name = nombre | ||
| - | * state = {started | stopped | restarted | reloaded } | ||
| - | * enabled = yes / no | ||
| - | * daemon_reload = no /yes | ||
| - | * masked = yes / no | ||
| - | |||
| - | <code yaml> | ||
| - | - name: habilitar servicio y recargar systemd | ||
| - | systemd: | ||
| - | name: apache2 | ||
| - | enabled: yes | ||
| - | state: started | ||
| - | daemon_reload: | ||
| - | </ | ||
| - | |||
| - | === user | ||
| - | [[https:// | ||
| - | * requerido | ||
| - | * name = nombre | ||
| - | * opcional | ||
| - | * state = { PRESENT | absent } | ||
| - | * group = grupo | ||
| - | * groups = grupo1, | ||
| - | * append = yes / no <- añadir a los grupos existentes | ||
| - | * createhome = yes / no | ||
| - | * uid = id_usuario | ||
| - | * home = directorio | ||
| - | * shell = /bin/sh | ||
| - | * password = clave | ||
| - | * remove = yes / no <- eliminar direcotorio al hacer un **absent** | ||
| - | * system = yes / no | ||
| - | |||
| - | <code yaml> | ||
| - | - name: crear usuario | ||
| - | user: | ||
| - | name: pepito | ||
| - | id: 1001 | ||
| - | home: / | ||
| - | shell: /bin/false | ||
| - | state: present | ||
| - | </ | ||
| - | == 3:41 Windows (I) | ||
| - | * win_acl : permisos ficheros/ | ||
| - | * win_chocolatey : repositorio paquetes | ||
| - | * win_command : ejecución comandos | ||
| - | * win_copy : copiar fichero a nodos remotos | ||
| - | * win_environment : modificar variables entorno | ||
| - | * win_feature : activar/des características | ||
| - | * win_file : crear/ | ||
| - | * win_get_url: | ||
| - | * win_group: gestión grupos locales | ||
| - | * win_lineinfile: | ||
| - | * win_msi: instalar o desinstalar paquetes MSI | ||
| - | * win_package : idem, pero fichero local o URL | ||
| - | * win_ping : ping | ||
| - | * win_reboot : reiniciar | ||
| - | * win_regedit : gestión registro | ||
| - | * win_schedule_task : gestión tareas | ||
| - | * win_service : gestión de servicios | ||
| - | * win_share : gestión puntos de montaje | ||
| - | * win_shell : comandos de consola | ||
| - | * win_stat : información de un fichero | ||
| - | * win_template : copia y procesa plantillas | ||
| - | * win_timezone : establecer zona horaria | ||
| - | * win_unzip : descomprimir fichero | ||
| - | * win_updates : descargar e instalar actualizaciones | ||
| - | * win_uri : interactuar con servicios web | ||
| - | * win_user: administrar usuarios locales | ||
| - | |||
| - | === win_command | ||
| - | * chdir = directorio | ||
| - | * creates = c: | ||
| - | * removes = c: | ||
| - | |||
| - | <code yaml> | ||
| - | -name: quien soy | ||
| - | | ||
| - | | ||
| - | - win_command: | ||
| - | register: usuario | ||
| - | - debug: var=usuario | ||
| - | </ | ||
| - | |||
| - | === win_copy | ||
| - | * requerido | ||
| - | * src = / | ||
| - | * dest = c: | ||
| - | |||
| - | <code yaml> | ||
| - | ... | ||
| - | - name: copiar fichero | ||
| - | win_copy: | ||
| - | src: config.txt | ||
| - | dest: c: | ||
| - | </ | ||
| - | |||
| - | === win_file | ||
| - | * requerido | ||
| - | * path = /ruta | ||
| - | * opcional | ||
| - | * state = { file | directory | touch | absent } | ||
| - | |||
| - | <code yaml> | ||
| - | - name: crear estructura de directorios | ||
| - | win_file: | ||
| - | path: c: | ||
| - | state: directory | ||
| - | </ | ||
| - | |||
| - | === win_lineinfile | ||
| - | * requerido | ||
| - | * path / dest (para >2.3) | ||
| - | * opcional | ||
| - | * state = { present | absent } | ||
| - | * line = línea | ||
| - | * newline = { windows | unix } -> \r\n o \n | ||
| - | * insertafter = EOF / REGEX | ||
| - | * insertbefore = BOF / REGEX | ||
| - | * create = no / yes | ||
| - | * backup = no / yes | ||
| - | * regexp = REGEX | ||
| - | |||
| - | <code yaml> | ||
| - | ... | ||
| - | - name: editar puerto | ||
| - | win_lineinfile: | ||
| - | path: c: | ||
| - | state: present | ||
| - | line: Listen 8080 | ||
| - | regexp: " | ||
| - | </ | ||
| - | |||
| - | == 3:42 Windows (II) | ||
| - | == 3:43 Control Versiones | ||
| - | == 3:44 Infra Web | ||
| - | == 3:45 Cloud Cluster | ||
| - | == 3:46 Monitorización | ||
| - | * datalog_event | ||
| - | * datalog_monitor | ||
| - | * logicmonitor | ||
| - | * logicmonitor_facts | ||
| - | * monit | ||
| - | * nagios | ||
| - | * newrelic_deployment : notifica sobre despliegue de aplicaciones en NewRelic | ||
| - | * pagerduty : crear ventanas de mantenimiento de en PagerDuty | ||
| - | * pagerduty_alert | ||
| - | * sensu_check | ||
| - | * sensu_subscription | ||
| - | * zabbix_group | ||
| - | * zabbix_host | ||
| - | * zabbix_maintenance | ||
| - | * zabbix_screen | ||
| - | * zabbix_hostmacro | ||
| - | |||
| - | <code yaml> | ||
| - | - name: Modulos monitoring | ||
| - | hosts: localhost | ||
| - | tasks: | ||
| - | - pip: name=zabbix-api state=latest | ||
| - | - name: Create host groups | ||
| - | zabbix_group: | ||
| - | server_url: http:// | ||
| - | login_user: ansible | ||
| - | login_password: | ||
| - | state: present | ||
| - | host_groups: | ||
| - | - oforte | ||
| - | - zabbix_host: | ||
| - | server_url: <...> | ||
| - | login_user: <...> | ||
| - | login_password: | ||
| - | state: present | ||
| - | status: enabled | ||
| - | host_name: lab.oforte.net | ||
| - | host_groups: | ||
| - | - oforte | ||
| - | interfaces: | ||
| - | - type: 1 | ||
| - | main: 1 | ||
| - | useip: 1 | ||
| - | ip: 10.0.0.x | ||
| - | dns: "" | ||
| - | port: 10050 | ||
| - | </ | ||