---
# This playbook installs the data directory

- name: install packages for repos
  sudo: yes
  apt: pkg={{ item }} state=installed
  with_items:
    - git
    - php5
    - libapache2-mod-php5
    - php5-curl

- name: clone git repository
  git: repo={{ git_protocol }}github.com/nhsengland/datadirectory
       dest=/home/ubuntu/datadirectory
       version=master

- name: copy apache2 config
  sudo: yes
  copy: src=config/apache2_ckan_default dest=/etc/apache2/sites-available/ckan_default.conf mode=0644 owner=root

- name: restart Apache
  sudo: yes
  service: name=apache2 state=restarted

- name: delete nginx cache
  sudo: yes
  command: rm -rf /tmp/nginx_cache

---
# This playbook installs the data directory

- name: install packages for repos
  become: true
  apt: pkg={{ item }} state=installed
  with_items:
    - git
    - php5
    - libapache2-mod-php5
    - php5-curl

- name: clone git repository
  git:
    repo: '{{ git_protocol }}github.com/nhsengland/datadirectory'
    dest: /home/ubuntu/datadirectory
    version: master

- name: copy apache2 config
  become: true
  template:
    src: config/apache2_ckan_default
    dest: /etc/apache2/sites-available/ckan_default.conf
    mode: 0644
    owner: root

- name: restart Apache
  become: true
  service: name=apache2 state=restarted

- name: delete nginx cache
  become: true
  file:
    path: /tmp/nginx_cache
    state: absent

Update data directory playbook to match syntactic tweaks elsewhere
Update data directory playbook to match syntactic tweaks elsewhere

* Use become instead of sudo
* Split sub attributes onto new lines
* Use template instead of copy
* Use file instead of command
