remove-extras.yml 847 B

12345678910111213141516171819202122232425262728293031
  1. ---
  2. - name: Find enabled sites
  3. shell: ls -1 {{nginx_conf_dir}}/sites-enabled
  4. register: enabled_sites
  5. changed_when: False
  6. tags: [configuration,nginx]
  7. - name: Disable unmanaged sites
  8. file: path={{nginx_conf_dir}}/sites-enabled/{{ item }} state=absent
  9. with_items: enabled_sites.stdout_lines
  10. # 'item.conf' => 'item'
  11. when: item[:-5] not in nginx_sites.keys()
  12. notify:
  13. - reload nginx
  14. tags: [configuration,nginx]
  15. - name: Find config files
  16. shell: ls -1 {{nginx_conf_dir}}/conf.d
  17. register: config_files
  18. changed_when: False
  19. tags: [configuration,nginx]
  20. - name: Remove unmanaged config files
  21. file: name={{nginx_conf_dir}}/conf.d/{{ item }} state=absent
  22. with_items: config_files.stdout_lines
  23. # 'item.conf' => 'item'
  24. when: item[:-5] not in nginx_configs.keys()
  25. notify:
  26. - reload nginx
  27. tags: [configuration,nginx]