Fiche modules command: shell: # 07-07-2021 17:28
---

- name: Add virtualhost.conf
  command: a2ensite virtualhost.conf
  args:
    creates: /etc/apache2/sites-enabled/virtualhost.conf
  notify: relancer Apache

- name: a2dissite wordpress
  command: a2dissite wordpress.conf
  args:
    removes: /etc/apache2/sites-enabled/wordpress.conf

- name: download wordpress
  command: >
    wp --allow-root core download --version=4.9.12 --locale=fr_FR
    chdir=/var/www/wordpress


- name: Get running processes of clamscan
  shell: "ps aux | grep -v grep | grep 'clamscan' | awk '{print $2}'"
  register: running_processes
  ignore_errors: yes

- name: Kill running clamscan processes
  ignore_errors: yes
  shell: "kill -9 {{ item }}"
  with_items: "{{ running_processes.stdout_lines }}"


- name: Create files
  shell: |
    touch -d "15 days ago" /tmp/file15d
    touch -d "60 days ago" /tmp/file60d
  args:
    executable: /bin/bash
    warn: false


LANG: en_US.UTF-8

- name: set locale
  shell: |
    cat > /etc/sysconfig/i18n << EOF
    LANG="{{ LANG }}"
    SYSFONT="latarcyrheb-sun16"
    EOF
  args:
    executable: /bin/bash


- name: execute smart
  shell: /usr/bin/smart.sh
  args:
    executable: /bin/bash
  register: smart_out
  # avoid non-zero return code
  failed_when: "smart_out.rc not in [ 0, 1 ]"