---
- name: Check if nova user exists
  action: shell getent passwd nova
  register: nova_user
  ignore_errors: True
  changed_when: False

- name: nova user
  user: name=nova shell=/bin/false createhome=no
  when: nova_user.rc == 0

- name: nova user
  user: name=nova comment=nova shell=/bin/false system=yes home=/nonexistent createhome=no
  when: nova_user.rc != 0

- apt: pkg=python-numpy

# Workaround issue with Ansible git module not working
- file: dest=/opt/stack/nova state=absent

- command: git clone --branch {{nova.rev}} --depth 20 {{ openstack.git_mirror }}/nova.git /opt/stack/nova
  notify:
    - pip install nova
    - nova rootwrap
    - restart nova services
- meta: flush_handlers

- file: dest=/etc/nova state=directory
- file: dest=/var/lib/nova state=directory owner=nova
- file: dest=/var/cache/nova state=directory mode=0700 owner=nova group=nova

- name: nova config
  action: template src={{ item }} dest=/etc/nova mode=0644
  with_fileglob: ../templates/etc/nova/*
  notify:
    - restart nova services

- name: nova sudoer
  template: src=etc/sudoers.d/nova dest=/etc/sudoers.d/nova owner=root group=root mode=0440

---
- name: Check if nova user exists
  action: shell getent passwd nova
  register: nova_user
  ignore_errors: True
  changed_when: False

- name: nova user
  user: name=nova shell=/bin/false createhome=no
  when: nova_user.rc == 0

- name: nova user
  user: name=nova comment=nova shell=/bin/false system=yes home=/nonexistent createhome=no
  when: nova_user.rc != 0

- apt: pkg=python-numpy

- name: get nova source repo
  git: repo={{ openstack.git_mirror }}/nova.git dest=/opt/stack/nova version={{ nova.rev }}
  notify:
    - pip install nova
    - nova rootwrap
    - restart nova services
- meta: flush_handlers

- file: dest=/etc/nova state=directory
- file: dest=/var/lib/nova state=directory owner=nova
- file: dest=/var/cache/nova state=directory mode=0700 owner=nova group=nova

- name: nova config
  action: template src={{ item }} dest=/etc/nova mode=0644
  with_fileglob: ../templates/etc/nova/*
  notify:
    - restart nova services

- name: nova sudoer
  template: src=etc/sudoers.d/nova dest=/etc/sudoers.d/nova owner=root group=root mode=0440

Switch back to ansible git module, but drop the shallow clone since the ref don't match on shallow clones
Switch back to ansible git module, but drop the shallow clone since the ref don't match on shallow clones
