# Directories and files
- name: ensure release directory exists
  file: path=~/releases state=directory mode=0755

- name: ensure logs directory exists
  become: yes
  become_user: root
  file: path=/logs state=directory mode=0755 owner=clojars group=clojars

- name: ensure data directory exists
  file: path=~/data state=directory mode=0755

- name: copy service template
  template: src=clojars.service.conf.j2 dest=/etc/init/clojars.conf mode=0644
  become: yes
  become_user: root

- name: copy clojars config
  template: src=config.clj.j2 dest=~/data/etc

- name: create indexer folder
  file: path=~/indexer state=directory mode=0755
- file: path=~/indexer/index-{{ indexer_version }} state=directory mode=0755

- name: create main repo folder
  file: path=~/repo state=directory mode=0755

- name: create bin directory
  file: path=~/bin state=directory mode=0755

- name: copy bin scripts
  copy: src=bin-scripts/ dest=~/bin

- name: create www directory
  file: path=/var/www state=directory mode=0755
  become: yes
  become_user: root

- name: copy clojars website root
  copy: src=wwwroot dest=/var/www/clojars
  become: yes
  become_user: root

# Directories and files
- name: ensure release directory exists
  file: path=~/releases state=directory mode=0755

- name: ensure logs directory exists
  become: yes
  become_user: root
  file: path=/logs state=directory mode=0755 owner=clojars group=clojars

- name: ensure data directory exists
  file: path=~/data state=directory mode=0755

- name: copy service template
  template: src=clojars.service.conf.j2 dest=/etc/init/clojars.conf mode=0644
  become: yes
  become_user: root

- name: copy clojars config
  template: src=config.clj.j2 dest=~/data/etc

- name: create indexer folder
  file: path=~/indexer state=directory mode=0755
- file: path=~/indexer/index-{{ indexer_version }} state=directory mode=0755

- name: create main repo folder
  file: path=~/repo state=directory mode=0755

- name: create bin directory
  file: path=~/bin state=directory mode=0755

- name: copy bin scripts
  copy: src=bin-scripts/ dest=~/bin

- name: create www directory
  file: path=/var/www state=directory mode=0755
  become: yes
  become_user: root

# TODO: use synchronize instead of copy, it's much faster, but permissions
# are a bit trickier.
- name: copy clojars website root
  copy: src=wwwroot dest=/var/www/clojars
  become: yes
  become_user: root

Add comment to use synchronize in the future
Add comment to use synchronize in the future
