# Data Science Toolbox base setup
---
- hosts: 127.0.0.1
  sudo: yes
  connection: local
  vars:
    - ipython_pem_file: "/home/{{ dst_username }}/.ssh/ipython_dst.pem"
  vars_prompt:
    - name: "ipython_password"
      prompt: "IPython notebook password"
      private: yes
      confirm: yes
  tasks:
    - name: Encrypt password
      shell: ./passwd.py {{ ipython_password }}
    - name: Load password
      include_vars: passwd_hash.yml
    - name: Make sure that the notebooks directory exists
      file: path=/home/{{ dst_username }}/notebooks state=directory owner={{ dst_username }} group={{ dst_username }}
    - name: Create IPython profile
      shell: "ipython profile create dst --ipython-dir=/home/{{ dst_username }}/.ipython"
    - name: Remove password file
      shell: rm passwd_hash.yml
    - name: Create self-signed SSL certificate
      shell: openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout {{ ipython_pem_file }} -out {{ ipython_pem_file }} -batch
    - name: Update IPython configuration
      template: src=ipython_notebook_config.py.j2 dest=/home/{{ dst_username }}/.ipython/profile_dst/ipython_notebook_config.py owner={{ dst_username }} group={{ dst_username }} mode=0644 backup=true
    - name: IPython -- Change IPython owner.
      file: path=/home/{{ dst_username }} /.ipython owner={{ dst_username }} recurse=yes state=directory

# Data Science Toolbox base setup
---
- hosts: 127.0.0.1
  sudo: yes
  connection: local
  vars:
    - ipython_pem_file: "/home/{{ dst_username }}/.ssh/ipython_dst.pem"
  vars_prompt:
    - name: "ipython_password"
      prompt: "IPython notebook password"
      private: yes
      confirm: yes
  tasks:
    - name: Encrypt password
      shell: ./passwd.py {{ ipython_password }}
    - name: Load password
      include_vars: passwd_hash.yml
    - name: Make sure that the notebooks directory exists
      file: path=/home/{{ dst_username }}/notebooks state=directory owner={{ dst_username }} group={{ dst_username }}
    - name: Create IPython profile
      shell: "ipython profile create dst --ipython-dir=/home/{{ dst_username }}/.ipython"
    - name: Remove password file
      shell: rm passwd_hash.yml
    - name: Create self-signed SSL certificate
      shell: openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout {{ ipython_pem_file }} -out {{ ipython_pem_file }} -batch
    - name: Update IPython configuration
      template: src=ipython_notebook_config.py.j2 dest=/home/{{ dst_username }}/.ipython/profile_dst/ipython_notebook_config.py owner={{ dst_username }} group={{ dst_username }} mode=0644 backup=true
    - name: Change owner
      file: path=/home/{{ dst_username }} state=directory owner={{ dst_username }} group={{ dst_username }} recurse=yes

Change owner of home directory
Change owner of home directory
