{
  "description"               : "Prepare Ubuntu 16.04 for REmbleton's ETL activities",
  "prerequisiteGraphUri"      : "prep-ubuntu-16.04-server-00.json",
  "options"                   : {
    "displayExecutionGraphDescription": true
  },
  "asynchronousCommands"      : [
    {
      "description"                : "[sudo] add-apt-repository ppa:ubuntu-toolchain-r/test",
      "suppressOutput"             : false,
      "suppressDiagnostics": true,
      "showPreAndPostSpawnMessages": true,
      "useSudo"                    : true,
      "command"                    : "add-apt-repository",
      "args"                       : [
        "-y",
        "ppa:ubuntu-toolchain-r/test"
      ]
    },
    {
      "description"                : "[sudo] useradd etl -s /bin/bash -m -g sudo,docker",
      "suppressOutput"             : false,
      "suppressDiagnostics": true,
      "showPreAndPostSpawnMessages": true,
      "outputColor"                : "",
      "useSudo"                    : true,
      "command"                    : "/bin/bash",
      "args"                       : [
        "-c",
        "useradd -m -p `perl -e 'printf(\"%s\n\", crypt(\"password\",\"password\"))'` -s /bin/bash etl -G sudo,docker"
      ]
    },
    {
      "description"                : "wget Anaconda2-4.4.0-Linux-x86_64.sh",
      "suppressOutput"             : false,
      "suppressDiagnostics": true,
      "showPreAndPostSpawnMessages": true,
      "outputColor"                : "",
      "useSudo"                    : true,
      "command"                    : "/bin/bash",
      "args"                       : [
        "-c",
        "wget https://repo.continuum.io/archive/Anaconda2-4.4.0-Linux-x86_64.sh -O /tmp/Anaconda2-4.4.0-Linux-x86_64.sh"
      ]
    }
  ],
  "serialSynchronizedCommands": [
    {
      "description"                : "[sudo] Add [nopasswd] to etl/sudoer's entry",
      "suppressOutput"             : false,
      "suppressDiagnostics": true,
      "showPreAndPostSpawnMessages": true,
      "useSudo"                    : true,
      "command"                    : "/bin/bash",
      "args"                       : [
        "-c",
        "echo \"\netl ALL=(ALL) NOPASSWD: ALL\" >> /etc/sudoers"
      ]
    },
    {
      "description"                : "[sudo] Install Anaconda2-4.4.0",
      "suppressOutput"             : false,
      "suppressDiagnostics": true,
      "showPreAndPostSpawnMessages": true,
      "useSudo"                    : true,
      "command"                    : "/bin/bash",
      "args"                       : [
        "-c",
        "echo password | sudo -S --user=etl -- /bin/bash -c '/bin/bash /tmp/Anaconda2-4.4.0-Linux-x86_64.sh -b -p /home/etl/anaconda2'"
      ]
    },
    {
      "description"                : "[sudo] Add Anaconda activation to /home/etl/.bashrc",
      "suppressOutput"             : false,
      "suppressDiagnostics": true,
      "showPreAndPostSpawnMessages": true,
      "outputColor"                : "",
      "useSudo"                    : true,
      "command"                    : "/usr/bin/env",
      "args"                       : [
        "bash",
        "-c",
        "echo 'source ~/anaconda2/bin/activate' >> /home/etl/.profile"
      ]
    },
    {
      "description"                : "[sudo] apt-get update",
      "suppressOutput"             : false,
      "suppressDiagnostics": true,
      "showPreAndPostSpawnMessages": true,
      "useSudo"                    : true,
      "command"                    : "apt-get",
      "args"                       : [
        "update"
      ]
    },
    {
      "description"                : "apt-get install [...]",
      "suppressOutput"             : false,
      "suppressDiagnostics": true,
      "showPreAndPostSpawnMessages": true,
      "useSudo"                    : true,
      "command"                    : "apt-get",
      "args"                       : [
        "install",
        "-y",
        "software-properties-common",
        "gcc-4.8",
        "g++-4.8",
        "gcc-6",
        "g++-6",
        "gcc-snapshot",
        "python-dev",
        "mysql-client-core-5.7",
        "libmysqlclient-dev"
      ]
    },
    {
      "description"                : "update-alternatives --install gcc-6",
      "suppressOutput"             : false,
      "suppressDiagnostics": true,
      "showPreAndPostSpawnMessages": true,
      "useSudo"                    : true,
      "command"                    : "update-alternatives",
      "args"                       : [
        "--install",
        "/usr/bin/gcc",
        "gcc",
        "/usr/bin/gcc-6",
        "60",
        "--slave",
        "/usr/bin/g++",
        "g++",
        "/usr/bin/g++-6"
      ]
    },
    {
      "description"                : "update-alternatives --install gcc-4.8",
      "suppressOutput"             : false,
      "suppressDiagnostics": true,
      "showPreAndPostSpawnMessages": true,
      "useSudo"                    : true,
      "command"                    : "update-alternatives",
      "args"                       : [
        "--install",
        "/usr/bin/gcc",
        "gcc",
        "/usr/bin/gcc-4.8",
        "60",
        "--slave",
        "/usr/bin/g++",
        "g++",
        "/usr/bin/g++-4.8"
      ]
    },
    {
      "description"                : "Install pip packages",
      "suppressOutput"             : false,
      "suppressDiagnostics": true,
      "showPreAndPostSpawnMessages": true,
      "useSudo"                    : true,
      "command"                    : "/bin/bash",
      "args"                       : [
        "-c",
        "echo password | sudo -S --user=etl -- /bin/bash -c 'source /home/etl/anaconda2/bin/activate && pip --no-cache-dir install MySQL-python pymongo csv2es python-dateutil elasticsearch tangelo'"
      ]
    }
  ]
}
