--- - name: Ejemplo de modulo fetch hosts: clientes remote_user: root tasks: - name: Utilizando modulo lineinfile para modificar la configuracion de selinux lineinfile: path=/etc/sysconfig/selinux regexp="^SELINUX=" line="SELINUX=disabled" - name: Eliminar una linea de un fichero, en este caso del arvhivo sudoers la linea de %wheel lineinfile: dest=/etc/sudoers state=absent regexp="^%wheel" - name: Añadir una linea de configuracion al archivo de apache httpd.conf lineinfile: path: /etc/httpd/conf/httpd.conf regexp: '^Listen ' insertafter: '^#Listen ' line: 'Listen 8080' - name: Añadir una linea despues de la expresinon buscada en un archivo lineinfile: path: /etc/services regexp: '^# port for http' insertbefore: '^www.*80/tcp' line: '# port for http by default' - name: touch a file, using symbolic modes to set the permissions (equivalent to 0644) file: path: /tmp/testfile state: touch mode: "u=rw,g=r,o=r" - name: Add a line to a file if it does not exist, without passing regexp lineinfile: path: /tmp/testfile line: '192.168.1.99 foo.lab.net foo' ...