---
- name: generate random string for project
  set_fact:
    rand_string: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
- name: Generate manual project dir name
  set_fact:
    project_name: "manual project {{ rand_string }}"

- name: Generate manual project dir name
  set_fact:
    project_dir_name: "proj_{{ rand_string }}"

- name: create a project directory for manual project
  import_tasks: create_project_dir.yml

- name: Create a manual project
  tower_project:
    name: "{{ project_name }}"
    organization: Default
    scm_type: manual
    local_path: "{{ project_dir_name }}"
  register: result

- assert:
    that:
      - "result is changed"

- name: Delete a manual project
  tower_project:
    name: "{{ project_name }}"
    organization: Default
    state: absent
  register: result

- assert:
    that:
      - "result is changed"
