This repository has been archived by the owner on Oct 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathproject.yml
66 lines (57 loc) · 1.98 KB
/
project.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
---
- hosts: localhost
connection: local
gather_facts: false
tasks:
- name: Verify user input for required variables
tags: project
assert:
that:
- project_name is defined
- project_path is defined
- name: Ensure project directories
tags: project
with_items: "{{ project_dirs }}"
file:
state: directory
path: "{{ project_path }}/{{ project_name }}/{{ item }}"
- name: Install static files
tags: project
with_items:
- "{{ project_files|selectattr('src', 'defined')|list }}"
- "{{ project_files|selectattr('content', 'defined')|list }}"
copy:
src: "{{ item.src|default(omit) }}"
dest: "{{ project_path }}/{{ project_name }}/{{ item.dest }}"
mode: "{{ item.mode|default(0600) }}"
force: "{{ force|default(item.force)|default(false) }}"
content: "{{ item.content|default(omit) }}"
- name: Install templated files
tags: project
with_items:
- "{{ project_files|selectattr('template', 'defined')|list }}"
template:
src: "templates/{{ item.template }}"
dest: "{{ project_path }}/{{ project_name }}/{{ item.dest }}"
mode: "{{ item.mode|default(0600) }}"
force: "{{ force|default(item.force)|default(false) }}"
- name: Install empty files
tags: project
with_items: "{{ project_files|selectattr('empty', 'defined')|list }}"
copy:
dest: "{{ project_path }}/{{ project_name }}/{{ item.dest }}"
content: ""
mode: "{{ item.mode|default(0600) }}"
force: "{{ force|default(item.force)|default(false) }}"
- name: Include tasks to manage git
tags:
- project
- git
when: project_manage_with_git
include: tasks/git.yml
vars:
target: "{{ project_path }}/{{ project_name }}"
- name: baem!
tags: project
debug:
msg: "Find the Ansible project at {{ project_path }}/{{ project_name }}"