---
- name: add line to .bashrc
  lineinfile: >
    dest=/home/vagrant/.bashrc
    insertafter=EOF
    line="cd /vagrant"
    state=present

- name: delete files if dir for website contain its
  file: >
    path="{{ vagrant_guest_folder }}"
    state=absent

- name: check if dir for website is created
  stat: >
    path="{{ vagrant_guest_folder }}"
  register: _stat
  when: vagrant_guest_folder != false

- name: create dir for website
  file: >
    group=root
    mode="0755"
    owner=root
    path="{{ vagrant_guest_folder }}"
    recurse=yes
    state=directory
  when: _stat is defined and (_stat.stat.lnk_source is not defined or _stat.stat.lnk_source != "/vagrant")

- name: create symlinks to website
  file: >
    dest="{{ vagrant_guest_folder }}"
    force=yes
    group=root
    mode="0755"
    owner=root
    src=/vagrant
    state=link
  when: _stat is defined and (_stat.stat.lnk_source is not defined or _stat.stat.lnk_source != "/vagrant")

---
- name: add line to .bashrc
  lineinfile: >
    dest=/home/vagrant/.bashrc
    insertafter=EOF
    line="cd /vagrant"
    state=present

- name: check if dir for website is created
  stat: >
    path="{{ vagrant_guest_folder }}"
  register: _stat
  when: vagrant_guest_folder != false

- name: delete files if dir for website contain its
  file: >
    path="{{ vagrant_guest_folder }}"
    state=absent
  when: _stat is defined and (_stat.stat.lnk_source is not defined or _stat.stat.lnk_source != "/vagrant")

- name: create dir for website
  file: >
    group=root
    mode="0755"
    owner=root
    path="{{ vagrant_guest_folder }}"
    recurse=yes
    state=directory
  when: _stat is defined and (_stat.stat.lnk_source is not defined or _stat.stat.lnk_source != "/vagrant")

- name: create symlinks to website
  file: >
    dest="{{ vagrant_guest_folder }}"
    force=yes
    group=root
    mode="0755"
    owner=root
    src=/vagrant
    state=link
  when: _stat is defined and (_stat.stat.lnk_source is not defined or _stat.stat.lnk_source != "/vagrant")

Fix deleting files if dir contain its
Fix deleting files if dir contain its
