Skip to content

Commit

Permalink
Improved tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tersmitten committed May 21, 2021
1 parent c008bf8 commit a25a311
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 34 deletions.
29 changes: 0 additions & 29 deletions tests/pre.yml

This file was deleted.

32 changes: 32 additions & 0 deletions tests/tasks/pre.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# pre test file
---
- name: install dependencies
apt:
name:
- openssl
state: "{{ apt_install_state | default('latest') }}"
update_cache: true
cache_valid_time: "{{ apt_update_cache_valid_time | default(3600) }}"

- block:

- name: generate key
command: >
openssl genrsa -out {{ ca_certificates_certificate_key_file }} 2048;
args:
creates: "{{ ca_certificates_certificate_key_file }}"

- name: generate crt
shell: >
openssl req \
-subj '/C=NL/ST=NH/L=Amsterdam/O=Oefenweb.nl B.V./OU=Systeembeheer/CN=oefenweb.nl/[email protected]/' \
-x509 -new -nodes \
-key {{ ca_certificates_certificate_key_file }} \
-days 1 \
-out {{ ca_certificates_certificate_crt_file }} \
;
args:
creates: "{{ ca_certificates_certificate_crt_file }}"

connection: local
become: false
5 changes: 3 additions & 2 deletions tests/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
become: true
pre_tasks:
- name: include vars
include_vars: main.yml
- import_tasks: pre.yml
include_vars: "{{ playbook_dir }}/vars/main.yml"
- name: include tasks
include: "{{ playbook_dir }}/tasks/pre.yml"
roles:
- ../../
5 changes: 3 additions & 2 deletions tests/vagrant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
become: true
pre_tasks:
- name: include vars
include_vars: main.yml
- import_tasks: pre.yml
include_vars: "{{ playbook_dir }}/vars/main.yml"
- name: include tasks
include: "{{ playbook_dir }}/tasks/pre.yml"
roles:
- ../../
7 changes: 6 additions & 1 deletion tests/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# vars file
---
ca_certificates_certificate_map:
- src: ca-oefenweb-nl.crt
- src: "{{ ca_certificates_certificate_crt_file | basename }}"
dest: oefenweb/Oefenweb_nl-B_V.crt

ca_certificates_certificate_directory: "{{ playbook_dir }}/../files"
ca_certificates_certificate_file: "{{ ca_certificates_certificate_directory }}/ca-oefenweb-nl"
ca_certificates_certificate_key_file: "{{ ca_certificates_certificate_file }}.key"
ca_certificates_certificate_crt_file: "{{ ca_certificates_certificate_file }}.crt"

0 comments on commit a25a311

Please sign in to comment.