Windows
3:41 Windows (I)
- win_acl : permisos ficheros/directorios, a usuario/grupos
- 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/eliminar ficheros/directorios
- win_get_url: descargar fichero de URL
- win_group: gestión grupos locales
- win_lineinfile: verifica la existencia de una línea en un fichero
- 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
https://docs.ansible.com/ansible/latest/modules/win_command_module.html#win-command-module
- chdir = directorio
- creates = c:\ruta\fichero
- removes = c:\ruta\fichero
-name: quien soy hosts: windows01 tasks: - win_command: whoami register: usuario - debug: var=usuario
win_copy
https://docs.ansible.com/ansible/latest/modules/win_copy_module.html#win-copy-module
- requerido
- src = /fichero/a/copiar
- dest = c:\path\destino
... - name: copiar fichero win_copy: src: config.txt dest: c:\config.txt
win_file
https://docs.ansible.com/ansible/latest/modules/win_file_module.html#win-file-module
- requerido
- path = /ruta
- opcional
- state = { file | directory | touch | absent }
- name: crear estructura de directorios win_file: path: c:\users\alberto\Documents\apache2\conf state: directory
win_lineinfile
https://docs.ansible.com/ansible/latest/modules/win_lineinfile_module.html#win-lineinfile-module
- 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
... - name: editar puerto win_lineinfile: path: c:\httpd.conf state: present line: Listen 8080 regexp: "^Listen"
3:42 Windows (II)
win_service
https://docs.ansible.com/ansible/latest/modules/win_service_module.html#win-service-module
- requerido
- name = nombre
- opcional
- state = { started | stopped | restarted }
- start_mode = { auto | manual | disabled | delayed }
- name: reiniciar servicio win_service: name: spooler start_mode: manual state: stopped
win_shell
https://docs.ansible.com/ansible/latest/modules/win_shell_module.html#win-shell-module
- chdir
- creates : c:\path\fichero ← ejecutar si el fichero existe
- executable
- removes : c:\path\fichero ← ejecutar si el fichero no existe
name: ejecutar script win_shell: c:\script.ps1 args: chdir: c:\
win_template
https://docs.ansible.com/ansible/latest/modules/win_template_module.html#win-template-module
- requerido
- src
- dest
j2 = jinga2
- name: copiar plantilla win_template: src: info.j2 dest: c:\info.txt
win_user
https://docs.ansible.com/ansible/latest/modules/win_user_module.html#win-user-module
- requerido
- name = usuario
- opcional
- account_disabled = no / yes
- account_locked = no / yes
- description = descripción
- fullname
- groups
- group_action = { replace | add | remove }
- password
- password_expired = yes / no
- password_never_expires = yes / no
- state = { present | absent | query }
- update_password = { always | on_create }
- user_cannot_change_password = no / yes
-name: crear usuario win_user: name: oforte password: oforte123 state: present groups: - users