---
- name: Installation de apt-transport-https
  apt: name=apt-transport-https state=present

- name: Installation de ca-certificates
  apt: name=ca-certificates state=present

- name: Installation de gnupg2
  apt: name=gnupg2 state=present

- name: Installation de software-properties-common
  apt: name=software-properties-common state=present

- name: Installation de sudo
  apt: name=sudo state=present

- name: Installation de docker
  shell: export https_proxy=http://10.121.38.1:8080  && curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -

- name: Récupération des paquets docker-ce et docker-compose
  shell: sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"

- name: Création du répertoire docker.service.d
  file:
    path: /etc/systemd/system/docker.service.d
    state: directory
    owner: root
    group: root
    mode: 0775
    recurse: yes

- name: Copie https_proxy.conf
  copy: src=https_proxy.conf dest=/etc/systemd/system/docker.service.d/
  notify:
    - restart docker

- name: Vérification des nouveaux paquets
  shell: sudo apt-get update

- name: Installation de docker-ce
  shell: sudo apt-get install -y docker-ce

- name: Installation de docker-compose
  shell: export https_proxy=http://10.121.38.1:8080 && curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

- name: Modification des droits de docker-compose
  shell: chmod +x /usr/local/bin/docker-compose

- name: Copie du fichier fstab
  copy: src=fstab dest=/etc/

- name: Création du répertoire graylog
  shell: mkdir /root/graylog

- name: Copie du docker-compose.yml graylog
  copy: src=docker-compose.yml dest=/root/graylog

- name: Changement du système de fichier de /dev/sdb1 en ext4
  shell: mkfs.ext4 /dev/sdb1

- name: Montage /dev/sdb1 sur /var/lib/docker
  shell: mount /dev/sdb1 /var/lib/docker
