aboutsummaryrefslogtreecommitdiffstats
path: root/roles/gitlab-ci-generator/tasks/main.yml
blob: a96ae7cc6c3b948e6abb4d61d189cc20a110771e (plain)
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
---
##
# Warn if log level is high
##
- name: Warn if log level is high
  debug:
    msg: "{{ msg.split('\n') }}"
    verbosity: 3
  vars:
    msg: |
      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      !! Log level is HIGH  !                                                 !!
      !! Some sensitive data may be visible to everyone.                      !!
      !! Don't forget to clean the task output !                              !!
      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

##
# Generate the CI file
##
- name: generate the new gitlab-ci file from inventory
  run_once: true
  block:
    - name: create a tempfile
      tempfile:
        state: file
        suffix: temp
      register: tmp_file
    - copy:
        src: "{{ ci_file }}"
        dest: "{{ tmp_file.path }}"
      ignore_errors: true
    - name: generate the gitlab-ci.yml
      template:
        src: gitlab-ci.yml
        dest: "{{ ci_file }}"
  rescue:
    - name: restore gitlab-ci
      copy:
        src: "{{ tmp_file.path }}"
        dest: "{{ ci_file }}"
  always:
    - name: destroy temp file
      file:
        path: "{{ tmp_file.path }}"
        state: absent