Skip to content

Instantly share code, notes, and snippets.

@adz
Created November 16, 2015 22:49
Show Gist options
  • Save adz/e298bff83fcd97d47ca0 to your computer and use it in GitHub Desktop.
Save adz/e298bff83fcd97d47ca0 to your computer and use it in GitHub Desktop.
# get contents of conf dir
- shell: ls -1 {{ nginx_conf_dir }}/*.conf
register: contents
when: nginx_sites
# so we can delete the ones we don't manage
- name: empty old confs
file: path="{{ item }}" state=absent
with_items: contents.stdout_lines
when: nginx_sites and item not in nginx_confs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment