Skip to content

Instantly share code, notes, and snippets.

@asmacdo
Created August 1, 2014 14:47
Show Gist options
  • Save asmacdo/dce90969b500f8be96b2 to your computer and use it in GitHub Desktop.
Save asmacdo/dce90969b500f8be96b2 to your computer and use it in GitHub Desktop.
Create multiple directories with ansible
- name: Make sure the sites-available, sites-enabled and conf.d directories exist
file:
path: "{{nginx_dir}}/{{item}}"
owner: root
group: root
mode: 0755
recurse: yes
state: directory
with_items: ["sites-available", "sites-enabled", "conf.d"]
@Nikongen
Copy link

Nikongen commented Jun 5, 2024

Exactly what i was searching for. Thanks a lot :) 👍

@asmacdo
Copy link
Author

asmacdo commented Jun 5, 2024

Wow! I have no memory of creating this gist, but I'm glad it was useful! <3

How in the world did you find this?

@Nikongen
Copy link

Nikongen commented Jun 6, 2024

I was trying to configure a nginx reverse proxy with ansible and had the problem that some folders were not available. So I googled for "ansible mkdir -p". This gist was the first result and also perfectly matching my usecase.

Have a nice day! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment