|
51 | 51 | loop: "{{ crts.results }}"
|
52 | 52 | when: not item.stat.exists or item.stat.mtime | older_than(days=80)
|
53 | 53 |
|
54 |
| - - name: generate lets encrypt ssl |
| 54 | + - name: generate lets encrypt ssl (testing) |
55 | 55 | acme_certificate:
|
56 | 56 | acme_version: 2
|
57 | 57 | account_key: "{{ account_key }}"
|
|
60 | 60 | chain_dest: "{{ item.invocation.module_args.path | dirname }}/crt.intermediate.new"
|
61 | 61 | fullchain_dest: "{{ item.invocation.module_args.path | dirname }}/crt.chained.new"
|
62 | 62 | terms_agreed: "{{ agreed | default('no') }}"
|
63 |
| - acme_directory: https://acme-v02.api.letsencrypt.org/directory |
| 63 | + acme_directory: https://acme-staging-v02.api.letsencrypt.org/directory |
64 | 64 | loop: "{{ crts.results }}"
|
65 |
| - when: not item.stat.exists or item.stat.mtime | older_than(days=80) |
| 65 | + when: testing and (not item.stat.exists or item.stat.mtime | older_than(days=80)) |
66 | 66 | register: data
|
67 | 67 |
|
| 68 | + - name: generate lets encrypt ssl (production) |
| 69 | + acme_certificate: |
| 70 | + acme_version: 2 |
| 71 | + account_key: "{{ account_key }}" |
| 72 | + csr: "{{ item.invocation.module_args.path | dirname }}/csr.new" |
| 73 | + dest: "{{ item.invocation.module_args.path | dirname }}/crt.thin.new" |
| 74 | + chain_dest: "{{ item.invocation.module_args.path | dirname }}/crt.intermediate.new" |
| 75 | + fullchain_dest: "{{ item.invocation.module_args.path | dirname }}/crt.chained.new" |
| 76 | + terms_agreed: "{{ agreed | default('no') }}" |
| 77 | + acme_directory: https://acme-v02.api.letsencrypt.org/directory |
| 78 | + loop: "{{ crts.results }}" |
| 79 | + when: not testing and (not item.stat.exists or item.stat.mtime | older_than(days=80)) |
| 80 | + register: data |
| 81 | + |
68 | 82 | - name: create directories for challanges
|
69 | 83 | file:
|
70 | 84 | path: "/var/www/{{ item.invocation.module_args.fullchain_dest | dirname | basename }}/{{ item | acme_get('resource') | dirname }}"
|
|
82 | 96 | when: item.changed
|
83 | 97 | loop: "{{ data.results }}"
|
84 | 98 |
|
85 |
| - - name: ask letsencrypt to validate |
| 99 | + - name: ask letsencrypt to validate (testing) |
86 | 100 | acme_certificate:
|
87 | 101 | acme_version: 2
|
88 | 102 | account_key: "{{ account_key }}"
|
|
93 | 107 | terms_agreed: "{{ agreed | default('no') }}"
|
94 | 108 | acme_directory: https://acme-v02.api.letsencrypt.org/directory
|
95 | 109 | data: "{{ item }}"
|
96 |
| - when: item.changed |
| 110 | + when: testing and item.changed |
97 | 111 | loop: "{{ data.results }}"
|
98 | 112 |
|
| 113 | + |
| 114 | + - name: ask letsencrypt to validate (production) |
| 115 | + acme_certificate: |
| 116 | + acme_version: 2 |
| 117 | + account_key: "{{ account_key }}" |
| 118 | + csr: "{{ item.invocation.module_args.dest | dirname }}/csr.new" |
| 119 | + dest: "{{ item.invocation.module_args.dest }}" |
| 120 | + chain_dest: "{{ item.invocation.module_args.chain_dest }}" |
| 121 | + fullchain_dest: "{{ item.invocation.module_args.fullchain_dest}}" |
| 122 | + terms_agreed: "{{ agreed | default('no') }}" |
| 123 | + acme_directory: https://acme-v02.api.letsencrypt.org/directory |
| 124 | + data: "{{ item }}" |
| 125 | + when: not testing and item.changed |
| 126 | + loop: "{{ data.results }}" |
| 127 | + |
| 128 | + |
99 | 129 | - name: rename crt.chained.new -> crt.chained
|
100 | 130 | copy:
|
101 | 131 | force: yes
|
|
0 commit comments