/etc/alternatives/java
gestión de /etc/alternatives
https://docs.ansible.com/ansible/latest/modules/alternatives_module.html#alternatives-module
- name: fijar la versión de Java a 8 alternatives: name: java path: /usr/lib/jvm/java-8-openjdk-amd64/bin/java
/usr/bin/java → /etc/alternatives/java → /usr/lib/jvm/java-8-openjdk-amd64/bin/java
https://docs.ansible.com/ansible/latest/modules/authorized_key_module.html#authorized-key-module
- name: autorizar clave pública authorized_keys: user: <user> key: "..."
https://docs.ansible.com/ansible/latest/modules/cron_module.html#cron-module
https://docs.ansible.com/ansible/latest/modules/filesystem_module.html#filesystem-module
- name: crear FS xfs filesystem: dev: /dev/sdX1 fstype: xfs
control del firewall en sistemas CentOS/RH
https://docs.ansible.com/ansible/latest/modules/firewalld_module.html#firewalld-module
- name: permitir acceso http/https firewalld: state: present service: "{{ item }}" permanent: true with_items: - "http" - "https"
- name: permitir acceso http/https firewalld: state: present service: "{{ item }}" permanent: true with_items: - "http" - "https"
https://docs.ansible.com/ansible/latest/modules/group_module.html#group-module
- name: crear grupo para aplicación group: name: jboss state: present gid: 185
https://docs.ansible.com/ansible/latest/modules/hostname_module.html#hostname-module
- name: cambiar el nombre del servidor hostname: name: servidor.dominio.com
https://docs.ansible.com/ansible/latest/modules/ping_module.html#ping-module
- name: comprobar conexión ping:
https://docs.ansible.com/ansible/latest/modules/timezone_module.html#timezone-module
- name definir huso horario timezone: name: Europe/Barcelona
https://docs.ansible.com/ansible/latest/modules/iptables_module.html#iptables-module
- name: permitir acceso puerto 80 iptables: chain: INPUT source: 0.0.0.0 destination_port: 80 jump: ACCEPT protocol: tcp
https://docs.ansible.com/ansible/latest/modules/lvg_module.html#lvg-module
- name: crear grupo de volúmenes lvg: vg: datavg pvs: /dev/vda1 state: present
vgs vgdisplay pvdisplay
https://docs.ansible.com/ansible/latest/modules/lvol_module.html#lvol-module
- name: creación volumen lógico lvol: vg=datavg lv=web size=2G state=present
lvscan
https://docs.ansible.com/ansible/latest/modules/mount_module.html#mount-module
- name: montar partición WWW - filesystem: dev=/dev/datavg/web fstype=xfs # formatea - mount: src=/dev/datavg/web name=/var/www fstype=xfs # monta
https://docs.ansible.com/ansible/latest/modules/service_module.html#service-module
- name: iniciar y habilitar servicio service: name: apache2 state: started enabled: true
https://docs.ansible.com/ansible/latest/modules/setup_module.html#setup-module
- name: obtiene facts setup gather_subset: all
cambios en el kernel
https://docs.ansible.com/ansible/latest/modules/sysctl_module.html#sysctl-module
sysctl -p- name: permitir redirigir el tráfico sysctl: name: net.ipv4.ip_forward value: 1 sysctl_set: yes state: present reload: yes
sysctl -a | grep ip_forward
https://docs.ansible.com/ansible/latest/modules/systemd_module.html#systemd-module
- name: habilitar servicio y recargar systemd systemd: name: apache2 enabled: yes state: started daemon_reload: yes
https://docs.ansible.com/ansible/latest/modules/user_module.html#user-module
- name: crear usuario user: name: pepito id: 1001 home: /home/pepito shell: /bin/false state: present