Debian Codegraph @

ansible_collections/community/crypto/tests/integration/targets/acme_account_info/tasks/impl.yml

raw
1 ---
2 # Copyright (c) Ansible Project
3 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 - block:
7 - name: Generate account keys
8 community.crypto.openssl_privatekey:
9 path: "{{ remote_tmp_dir }}/{{ item }}.pem"
10 type: ECC
11 curve: secp256r1
12 force: true
13 loop: "{{ account_keys }}"
14
15 - name: Parse account keys (to ease debugging some test failures)
16 community.crypto.openssl_privatekey_info:
17 path: "{{ remote_tmp_dir }}/{{ item }}.pem"
18 return_private_key_data: true
19 loop: "{{ account_keys }}"
20
21 vars:
22 account_keys:
23 - accountkey
24 - accountkey2
25
26 - name: Check that account does not exist
27 community.crypto.acme_account_info:
28 select_crypto_backend: "{{ select_crypto_backend }}"
29 account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
30 acme_version: 2
31 acme_directory: "{{ acme_directory_url }}"
32 validate_certs: false
33 register: account_not_created
34
35 - name: Create it now
36 community.crypto.acme_account:
37 select_crypto_backend: "{{ select_crypto_backend }}"
38 account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
39 acme_version: 2
40 acme_directory: "{{ acme_directory_url }}"
41 validate_certs: false
42 state: present
43 allow_creation: true
44 terms_agreed: true
45 contact:
46 - mailto:[email protected]
47
48 - name: Check that account exists
49 community.crypto.acme_account_info:
50 select_crypto_backend: "{{ select_crypto_backend }}"
51 account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
52 acme_version: 2
53 acme_directory: "{{ acme_directory_url }}"
54 validate_certs: false
55 register: account_created
56
57 - name: Read account key
58 ansible.builtin.slurp:
59 src: '{{ remote_tmp_dir }}/accountkey.pem'
60 register: slurp
61
62 - name: Clear email address
63 community.crypto.acme_account:
64 select_crypto_backend: "{{ select_crypto_backend }}"
65 account_key_content: "{{ slurp.content | b64decode }}"
66 acme_version: 2
67 acme_directory: "{{ acme_directory_url }}"
68 validate_certs: false
69 state: present
70 allow_creation: false
71 contact: []
72
73 - name: Check that account was modified
74 community.crypto.acme_account_info:
75 select_crypto_backend: "{{ select_crypto_backend }}"
76 account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
77 acme_version: 2
78 acme_directory: "{{ acme_directory_url }}"
79 validate_certs: false
80 account_uri: "{{ account_created.account_uri }}"
81 register: account_modified
82
83 - name: Check with wrong account URI
84 community.crypto.acme_account_info:
85 select_crypto_backend: "{{ select_crypto_backend }}"
86 account_key_src: "{{ remote_tmp_dir }}/accountkey.pem"
87 acme_version: 2
88 acme_directory: "{{ acme_directory_url }}"
89 validate_certs: false
90 account_uri: "{{ account_created.account_uri }}test1234doesnotexists"
91 register: account_not_exist
92
93 - name: Check with wrong account key
94 community.crypto.acme_account_info:
95 select_crypto_backend: "{{ select_crypto_backend }}"
96 account_key_src: "{{ remote_tmp_dir }}/accountkey2.pem"
97 acme_version: 2
98 acme_directory: "{{ acme_directory_url }}"
99 validate_certs: false
100 account_uri: "{{ account_created.account_uri }}"
101 ignore_errors: true
102 register: account_wrong_key