mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
* Remove superfluous test.
* Use remote_temp_dir instead of output_dir on remote.
* Read certificate from correct place.
* Adjust more places.
* Fix boolean.
* Improve cryptography setup.
* Fix java_keystore changes.
* Need to copy binary from remote.
* Use correct Python for serve script.
* Sleep before downloading.
* Use correct Python interpreter.
* Avoid failing shebang test.
* Fix permission error with macOS 11.1.
* Avoid shebang trouble.
(cherry picked from commit 7c43cc3faa
)
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
ad3efa9719
commit
c76e598d61
68 changed files with 440 additions and 394 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
dependencies:
|
||||||
|
- setup_remote_tmp_dir
|
|
@ -50,7 +50,7 @@
|
||||||
###################################################
|
###################################################
|
||||||
- name:
|
- name:
|
||||||
set_fact:
|
set_fact:
|
||||||
reqs_file: '{{ output_dir }}/reqs.yaml'
|
reqs_file: '{{ remote_tmp_dir }}/reqs.yaml'
|
||||||
|
|
||||||
- name: Copy requirements file
|
- name: Copy requirements file
|
||||||
copy:
|
copy:
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
- setup_pkg_mgr
|
- setup_pkg_mgr
|
||||||
|
- setup_remote_tmp_dir
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
register: backports_lzma_pip
|
register: backports_lzma_pip
|
||||||
|
|
||||||
- name: prep our files
|
- name: prep our files
|
||||||
copy: src={{ item }} dest={{output_dir}}/{{ item }}
|
copy: src={{ item }} dest={{remote_tmp_dir}}/{{ item }}
|
||||||
with_items:
|
with_items:
|
||||||
- foo.txt
|
- foo.txt
|
||||||
- bar.txt
|
- bar.txt
|
||||||
|
|
|
@ -3,29 +3,29 @@
|
||||||
- name: Create link - broken link ({{ format }})
|
- name: Create link - broken link ({{ format }})
|
||||||
file:
|
file:
|
||||||
src: /nowhere
|
src: /nowhere
|
||||||
dest: "{{ output_dir }}/nowhere.txt"
|
dest: "{{ remote_tmp_dir }}/nowhere.txt"
|
||||||
state: link
|
state: link
|
||||||
force: yes
|
force: yes
|
||||||
|
|
||||||
- name: Archive - broken link ({{ format }})
|
- name: Archive - broken link ({{ format }})
|
||||||
archive:
|
archive:
|
||||||
path: "{{ output_dir }}/*.txt"
|
path: "{{ remote_tmp_dir }}/*.txt"
|
||||||
dest: "{{ output_dir }}/archive_broken_link.{{ format }}"
|
dest: "{{ remote_tmp_dir }}/archive_broken_link.{{ format }}"
|
||||||
format: "{{ format }}"
|
format: "{{ format }}"
|
||||||
|
|
||||||
- name: Verify archive exists - broken link ({{ format }})
|
- name: Verify archive exists - broken link ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/archive_broken_link.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_broken_link.{{ format }}"
|
||||||
state: file
|
state: file
|
||||||
|
|
||||||
- name: Remove archive - broken link ({{ format }})
|
- name: Remove archive - broken link ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/archive_broken_link.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_broken_link.{{ format }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Remove link - broken link ({{ format }})
|
- name: Remove link - broken link ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/nowhere.txt"
|
path: "{{ remote_tmp_dir }}/nowhere.txt"
|
||||||
state: absent
|
state: absent
|
||||||
# 'zip' does not support symlink's
|
# 'zip' does not support symlink's
|
||||||
when: format != 'zip'
|
when: format != 'zip'
|
||||||
|
|
|
@ -25,14 +25,14 @@
|
||||||
# Core functionality tests
|
# Core functionality tests
|
||||||
- name: Archive - no options ({{ format }})
|
- name: Archive - no options ({{ format }})
|
||||||
archive:
|
archive:
|
||||||
path: "{{ output_dir }}/*.txt"
|
path: "{{ remote_tmp_dir }}/*.txt"
|
||||||
dest: "{{ output_dir }}/archive_no_opts.{{ format }}"
|
dest: "{{ remote_tmp_dir }}/archive_no_opts.{{ format }}"
|
||||||
format: "{{ format }}"
|
format: "{{ format }}"
|
||||||
register: archive_no_options
|
register: archive_no_options
|
||||||
|
|
||||||
- name: Verify that archive exists - no options ({{ format }})
|
- name: Verify that archive exists - no options ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{output_dir}}/archive_no_opts.{{ format }}"
|
path: "{{remote_tmp_dir}}/archive_no_opts.{{ format }}"
|
||||||
state: file
|
state: file
|
||||||
|
|
||||||
- name: Verify that archive result is changed and includes all files - no options ({{ format }})
|
- name: Verify that archive result is changed and includes all files - no options ({{ format }})
|
||||||
|
@ -44,20 +44,20 @@
|
||||||
|
|
||||||
- name: Remove the archive - no options ({{ format }})
|
- name: Remove the archive - no options ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/archive_no_options.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_no_options.{{ format }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Archive - file options ({{ format }})
|
- name: Archive - file options ({{ format }})
|
||||||
archive:
|
archive:
|
||||||
path: "{{ output_dir }}/*.txt"
|
path: "{{ remote_tmp_dir }}/*.txt"
|
||||||
dest: "{{ output_dir }}/archive_file_options.{{ format }}"
|
dest: "{{ remote_tmp_dir }}/archive_file_options.{{ format }}"
|
||||||
format: "{{ format }}"
|
format: "{{ format }}"
|
||||||
mode: "u+rwX,g-rwx,o-rwx"
|
mode: "u+rwX,g-rwx,o-rwx"
|
||||||
register: archive_file_options
|
register: archive_file_options
|
||||||
|
|
||||||
- name: Retrieve archive file information - file options ({{ format }})
|
- name: Retrieve archive file information - file options ({{ format }})
|
||||||
stat:
|
stat:
|
||||||
path: "{{ output_dir }}/archive_file_options.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_file_options.{{ format }}"
|
||||||
register: archive_file_options_stat
|
register: archive_file_options_stat
|
||||||
|
|
||||||
- name: Test that the file modes were changed
|
- name: Test that the file modes were changed
|
||||||
|
@ -69,19 +69,19 @@
|
||||||
|
|
||||||
- name: Remove the archive - file options ({{ format }})
|
- name: Remove the archive - file options ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/archive_file_options.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_file_options.{{ format }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Archive - non-ascii ({{ format }})
|
- name: Archive - non-ascii ({{ format }})
|
||||||
archive:
|
archive:
|
||||||
path: "{{ output_dir }}/*.txt"
|
path: "{{ remote_tmp_dir }}/*.txt"
|
||||||
dest: "{{ output_dir }}/archive_nonascii_くらとみ.{{ format }}"
|
dest: "{{ remote_tmp_dir }}/archive_nonascii_くらとみ.{{ format }}"
|
||||||
format: "{{ format }}"
|
format: "{{ format }}"
|
||||||
register: archive_nonascii
|
register: archive_nonascii
|
||||||
|
|
||||||
- name: Retrieve archive file information - non-ascii ({{ format }})
|
- name: Retrieve archive file information - non-ascii ({{ format }})
|
||||||
stat:
|
stat:
|
||||||
path: "{{ output_dir }}/archive_nonascii_くらとみ.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_nonascii_くらとみ.{{ format }}"
|
||||||
register: archive_nonascii_stat
|
register: archive_nonascii_stat
|
||||||
|
|
||||||
- name: Test that archive exists - non-ascii ({{ format }})
|
- name: Test that archive exists - non-ascii ({{ format }})
|
||||||
|
@ -92,13 +92,13 @@
|
||||||
|
|
||||||
- name: Remove the archive - non-ascii ({{ format }})
|
- name: Remove the archive - non-ascii ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/archive_nonascii_くらとみ.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_nonascii_くらとみ.{{ format }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Archive - single target ({{ format }})
|
- name: Archive - single target ({{ format }})
|
||||||
archive:
|
archive:
|
||||||
path: "{{ output_dir }}/foo.txt"
|
path: "{{ remote_tmp_dir }}/foo.txt"
|
||||||
dest: "{{ output_dir }}/archive_single_target.{{ format }}"
|
dest: "{{ remote_tmp_dir }}/archive_single_target.{{ format }}"
|
||||||
format: "{{ format }}"
|
format: "{{ format }}"
|
||||||
register: archive_single_target
|
register: archive_single_target
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@
|
||||||
- block:
|
- block:
|
||||||
- name: Retrieve contents of archive - single target ({{ format }})
|
- name: Retrieve contents of archive - single target ({{ format }})
|
||||||
ansible.builtin.unarchive:
|
ansible.builtin.unarchive:
|
||||||
src: "{{ output_dir }}/archive_single_target.{{ format }}"
|
src: "{{ remote_tmp_dir }}/archive_single_target.{{ format }}"
|
||||||
dest: .
|
dest: .
|
||||||
list_files: true
|
list_files: true
|
||||||
check_mode: true
|
check_mode: true
|
||||||
|
@ -135,22 +135,22 @@
|
||||||
|
|
||||||
- name: Remove archive - single target ({{ format }})
|
- name: Remove archive - single target ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/archive_single_target.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_single_target.{{ format }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Archive - path list ({{ format }})
|
- name: Archive - path list ({{ format }})
|
||||||
archive:
|
archive:
|
||||||
path:
|
path:
|
||||||
- "{{ output_dir }}/empty.txt"
|
- "{{ remote_tmp_dir }}/empty.txt"
|
||||||
- "{{ output_dir }}/foo.txt"
|
- "{{ remote_tmp_dir }}/foo.txt"
|
||||||
- "{{ output_dir }}/bar.txt"
|
- "{{ remote_tmp_dir }}/bar.txt"
|
||||||
dest: "{{ output_dir }}/archive_path_list.{{ format }}"
|
dest: "{{ remote_tmp_dir }}/archive_path_list.{{ format }}"
|
||||||
format: "{{ format }}"
|
format: "{{ format }}"
|
||||||
register: archive_path_list
|
register: archive_path_list
|
||||||
|
|
||||||
- name: Verify that archive exists - path list ({{ format }})
|
- name: Verify that archive exists - path list ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{output_dir}}/archive_path_list.{{ format }}"
|
path: "{{remote_tmp_dir}}/archive_path_list.{{ format }}"
|
||||||
state: file
|
state: file
|
||||||
|
|
||||||
- name: Assert that archive contains all files - path list ({{ format }})
|
- name: Assert that archive contains all files - path list ({{ format }})
|
||||||
|
@ -161,16 +161,16 @@
|
||||||
|
|
||||||
- name: Remove archive - path list ({{ format }})
|
- name: Remove archive - path list ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/archive_path_list.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_path_list.{{ format }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Archive - missing paths ({{ format }})
|
- name: Archive - missing paths ({{ format }})
|
||||||
archive:
|
archive:
|
||||||
path:
|
path:
|
||||||
- "{{ output_dir }}/*.txt"
|
- "{{ remote_tmp_dir }}/*.txt"
|
||||||
- "{{ output_dir }}/dne.txt"
|
- "{{ remote_tmp_dir }}/dne.txt"
|
||||||
exclude_path: "{{ output_dir }}/foo.txt"
|
exclude_path: "{{ remote_tmp_dir }}/foo.txt"
|
||||||
dest: "{{ output_dir }}/archive_missing_paths.{{ format }}"
|
dest: "{{ remote_tmp_dir }}/archive_missing_paths.{{ format }}"
|
||||||
format: "{{ format }}"
|
format: "{{ format }}"
|
||||||
register: archive_missing_paths
|
register: archive_missing_paths
|
||||||
|
|
||||||
|
@ -179,10 +179,10 @@
|
||||||
that:
|
that:
|
||||||
- archive_missing_paths is changed
|
- archive_missing_paths is changed
|
||||||
- "archive_missing_paths.dest_state == 'incomplete'"
|
- "archive_missing_paths.dest_state == 'incomplete'"
|
||||||
- "'{{ output_dir }}/dne.txt' in archive_missing_paths.missing"
|
- "'{{ remote_tmp_dir }}/dne.txt' in archive_missing_paths.missing"
|
||||||
- "'{{ output_dir }}/foo.txt' not in archive_missing_paths.missing"
|
- "'{{ remote_tmp_dir }}/foo.txt' not in archive_missing_paths.missing"
|
||||||
|
|
||||||
- name: Remove archive - missing paths ({{ format }})
|
- name: Remove archive - missing paths ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/archive_missing_paths.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_missing_paths.{{ format }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
---
|
---
|
||||||
- name: Archive - exclusion patterns ({{ format }})
|
- name: Archive - exclusion patterns ({{ format }})
|
||||||
archive:
|
archive:
|
||||||
path: "{{ output_dir }}/*.txt"
|
path: "{{ remote_tmp_dir }}/*.txt"
|
||||||
dest: "{{ output_dir }}/archive_exclusion_patterns.{{ format }}"
|
dest: "{{ remote_tmp_dir }}/archive_exclusion_patterns.{{ format }}"
|
||||||
format: "{{ format }}"
|
format: "{{ format }}"
|
||||||
exclusion_patterns: b?r.*
|
exclusion_patterns: b?r.*
|
||||||
register: archive_exclusion_patterns
|
register: archive_exclusion_patterns
|
||||||
|
@ -15,26 +15,26 @@
|
||||||
|
|
||||||
- name: Remove archive - exclusion patterns ({{ format }})
|
- name: Remove archive - exclusion patterns ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/archive_exclusion_patterns.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_exclusion_patterns.{{ format }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Archive - exclude path ({{ format }})
|
- name: Archive - exclude path ({{ format }})
|
||||||
archive:
|
archive:
|
||||||
path:
|
path:
|
||||||
- "{{ output_dir }}/sub/subfile.txt"
|
- "{{ remote_tmp_dir }}/sub/subfile.txt"
|
||||||
- "{{ output_dir }}"
|
- "{{ remote_tmp_dir }}"
|
||||||
exclude_path:
|
exclude_path:
|
||||||
- "{{ output_dir }}"
|
- "{{ remote_tmp_dir }}"
|
||||||
dest: "{{ output_dir }}/archive_exclude_paths.{{ format }}"
|
dest: "{{ remote_tmp_dir }}/archive_exclude_paths.{{ format }}"
|
||||||
format: "{{ format }}"
|
format: "{{ format }}"
|
||||||
register: archive_excluded_paths
|
register: archive_excluded_paths
|
||||||
|
|
||||||
- name: Assert that excluded paths do not influence archive root - exclude path ({{ format }})
|
- name: Assert that excluded paths do not influence archive root - exclude path ({{ format }})
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- archive_excluded_paths.arcroot != output_dir
|
- archive_excluded_paths.arcroot != remote_tmp_dir
|
||||||
|
|
||||||
- name: Remove archive - exclude path ({{ format }})
|
- name: Remove archive - exclude path ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/archive_exclude_paths.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_exclude_paths.{{ format }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
---
|
---
|
||||||
- name: Archive - file content idempotency ({{ format }})
|
- name: Archive - file content idempotency ({{ format }})
|
||||||
archive:
|
archive:
|
||||||
path: "{{ output_dir }}/*.txt"
|
path: "{{ remote_tmp_dir }}/*.txt"
|
||||||
dest: "{{ output_dir }}/archive_file_content_idempotency.{{ format }}"
|
dest: "{{ remote_tmp_dir }}/archive_file_content_idempotency.{{ format }}"
|
||||||
format: "{{ format }}"
|
format: "{{ format }}"
|
||||||
register: file_content_idempotency_before
|
register: file_content_idempotency_before
|
||||||
|
|
||||||
|
@ -10,12 +10,12 @@
|
||||||
lineinfile:
|
lineinfile:
|
||||||
line: bar.txt
|
line: bar.txt
|
||||||
regexp: "^foo.txt$"
|
regexp: "^foo.txt$"
|
||||||
path: "{{ output_dir }}/foo.txt"
|
path: "{{ remote_tmp_dir }}/foo.txt"
|
||||||
|
|
||||||
- name: Archive second time - file content idempotency ({{ format }})
|
- name: Archive second time - file content idempotency ({{ format }})
|
||||||
archive:
|
archive:
|
||||||
path: "{{ output_dir }}/*.txt"
|
path: "{{ remote_tmp_dir }}/*.txt"
|
||||||
dest: "{{ output_dir }}/archive_file_content_idempotency.{{ format }}"
|
dest: "{{ remote_tmp_dir }}/archive_file_content_idempotency.{{ format }}"
|
||||||
format: "{{ format }}"
|
format: "{{ format }}"
|
||||||
register: file_content_idempotency_after
|
register: file_content_idempotency_after
|
||||||
|
|
||||||
|
@ -28,29 +28,29 @@
|
||||||
|
|
||||||
- name: Remove archive - file content idempotency ({{ format }})
|
- name: Remove archive - file content idempotency ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/archive_file_content_idempotency.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_file_content_idempotency.{{ format }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Modify file back - file content idempotency ({{ format }})
|
- name: Modify file back - file content idempotency ({{ format }})
|
||||||
lineinfile:
|
lineinfile:
|
||||||
line: foo.txt
|
line: foo.txt
|
||||||
regexp: "^bar.txt$"
|
regexp: "^bar.txt$"
|
||||||
path: "{{ output_dir }}/foo.txt"
|
path: "{{ remote_tmp_dir }}/foo.txt"
|
||||||
|
|
||||||
- name: Archive - file name idempotency ({{ format }})
|
- name: Archive - file name idempotency ({{ format }})
|
||||||
archive:
|
archive:
|
||||||
path: "{{ output_dir }}/*.txt"
|
path: "{{ remote_tmp_dir }}/*.txt"
|
||||||
dest: "{{ output_dir }}/archive_file_name_idempotency.{{ format }}"
|
dest: "{{ remote_tmp_dir }}/archive_file_name_idempotency.{{ format }}"
|
||||||
format: "{{ format }}"
|
format: "{{ format }}"
|
||||||
register: file_name_idempotency_before
|
register: file_name_idempotency_before
|
||||||
|
|
||||||
- name: Rename file - file name idempotency ({{ format }})
|
- name: Rename file - file name idempotency ({{ format }})
|
||||||
command: "mv {{ output_dir}}/foo.txt {{ output_dir }}/fii.txt"
|
command: "mv {{ remote_tmp_dir }}/foo.txt {{ remote_tmp_dir }}/fii.txt"
|
||||||
|
|
||||||
- name: Archive again - file name idempotency ({{ format }})
|
- name: Archive again - file name idempotency ({{ format }})
|
||||||
archive:
|
archive:
|
||||||
path: "{{ output_dir }}/*.txt"
|
path: "{{ remote_tmp_dir }}/*.txt"
|
||||||
dest: "{{ output_dir }}/archive_file_name_idempotency.{{ format }}"
|
dest: "{{ remote_tmp_dir }}/archive_file_name_idempotency.{{ format }}"
|
||||||
format: "{{ format }}"
|
format: "{{ format }}"
|
||||||
register: file_name_idempotency_after
|
register: file_name_idempotency_after
|
||||||
|
|
||||||
|
@ -63,16 +63,16 @@
|
||||||
|
|
||||||
- name: Remove archive - file name idempotency ({{ format }})
|
- name: Remove archive - file name idempotency ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/archive_file_name_idempotency.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_file_name_idempotency.{{ format }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Rename file back - file name idempotency ({{ format }})
|
- name: Rename file back - file name idempotency ({{ format }})
|
||||||
command: "mv {{ output_dir }}/fii.txt {{ output_dir }}/foo.txt"
|
command: "mv {{ remote_tmp_dir }}/fii.txt {{ remote_tmp_dir }}/foo.txt"
|
||||||
|
|
||||||
- name: Archive - single file content idempotency ({{ format }})
|
- name: Archive - single file content idempotency ({{ format }})
|
||||||
archive:
|
archive:
|
||||||
path: "{{ output_dir }}/foo.txt"
|
path: "{{ remote_tmp_dir }}/foo.txt"
|
||||||
dest: "{{ output_dir }}/archive_single_file_content_idempotency.{{ format }}"
|
dest: "{{ remote_tmp_dir }}/archive_single_file_content_idempotency.{{ format }}"
|
||||||
format: "{{ format }}"
|
format: "{{ format }}"
|
||||||
register: single_file_content_idempotency_before
|
register: single_file_content_idempotency_before
|
||||||
|
|
||||||
|
@ -80,12 +80,12 @@
|
||||||
lineinfile:
|
lineinfile:
|
||||||
line: bar.txt
|
line: bar.txt
|
||||||
regexp: "^foo.txt$"
|
regexp: "^foo.txt$"
|
||||||
path: "{{ output_dir }}/foo.txt"
|
path: "{{ remote_tmp_dir }}/foo.txt"
|
||||||
|
|
||||||
- name: Archive second time - single file content idempotency ({{ format }})
|
- name: Archive second time - single file content idempotency ({{ format }})
|
||||||
archive:
|
archive:
|
||||||
path: "{{ output_dir }}/foo.txt"
|
path: "{{ remote_tmp_dir }}/foo.txt"
|
||||||
dest: "{{ output_dir }}/archive_single_file_content_idempotency.{{ format }}"
|
dest: "{{ remote_tmp_dir }}/archive_single_file_content_idempotency.{{ format }}"
|
||||||
format: "{{ format }}"
|
format: "{{ format }}"
|
||||||
register: single_file_content_idempotency_after
|
register: single_file_content_idempotency_after
|
||||||
|
|
||||||
|
@ -98,29 +98,29 @@
|
||||||
|
|
||||||
- name: Remove archive - single file content idempotency ({{ format }})
|
- name: Remove archive - single file content idempotency ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/archive_single_file_content_idempotency.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_single_file_content_idempotency.{{ format }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Modify file back - single file content idempotency ({{ format }})
|
- name: Modify file back - single file content idempotency ({{ format }})
|
||||||
lineinfile:
|
lineinfile:
|
||||||
line: foo.txt
|
line: foo.txt
|
||||||
regexp: "^bar.txt$"
|
regexp: "^bar.txt$"
|
||||||
path: "{{ output_dir }}/foo.txt"
|
path: "{{ remote_tmp_dir }}/foo.txt"
|
||||||
|
|
||||||
- name: Archive - single file name idempotency ({{ format }})
|
- name: Archive - single file name idempotency ({{ format }})
|
||||||
archive:
|
archive:
|
||||||
path: "{{ output_dir }}/foo.txt"
|
path: "{{ remote_tmp_dir }}/foo.txt"
|
||||||
dest: "{{ output_dir }}/archive_single_file_name_idempotency.{{ format }}"
|
dest: "{{ remote_tmp_dir }}/archive_single_file_name_idempotency.{{ format }}"
|
||||||
format: "{{ format }}"
|
format: "{{ format }}"
|
||||||
register: single_file_name_idempotency_before
|
register: single_file_name_idempotency_before
|
||||||
|
|
||||||
- name: Rename file - single file name idempotency ({{ format }})
|
- name: Rename file - single file name idempotency ({{ format }})
|
||||||
command: "mv {{ output_dir}}/foo.txt {{ output_dir }}/fii.txt"
|
command: "mv {{ remote_tmp_dir }}/foo.txt {{ remote_tmp_dir }}/fii.txt"
|
||||||
|
|
||||||
- name: Archive again - single file name idempotency ({{ format }})
|
- name: Archive again - single file name idempotency ({{ format }})
|
||||||
archive:
|
archive:
|
||||||
path: "{{ output_dir }}/fii.txt"
|
path: "{{ remote_tmp_dir }}/fii.txt"
|
||||||
dest: "{{ output_dir }}/archive_single_file_name_idempotency.{{ format }}"
|
dest: "{{ remote_tmp_dir }}/archive_single_file_name_idempotency.{{ format }}"
|
||||||
format: "{{ format }}"
|
format: "{{ format }}"
|
||||||
register: single_file_name_idempotency_after
|
register: single_file_name_idempotency_after
|
||||||
|
|
||||||
|
@ -134,8 +134,8 @@
|
||||||
|
|
||||||
- name: Remove archive - single file name idempotency ({{ format }})
|
- name: Remove archive - single file name idempotency ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/archive_single_file_name_idempotency.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_single_file_name_idempotency.{{ format }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Rename file back - single file name idempotency ({{ format }})
|
- name: Rename file back - single file name idempotency ({{ format }})
|
||||||
command: "mv {{ output_dir }}/fii.txt {{ output_dir }}/foo.txt"
|
command: "mv {{ remote_tmp_dir }}/fii.txt {{ remote_tmp_dir }}/foo.txt"
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
---
|
---
|
||||||
- name: Archive - remove source files ({{ format }})
|
- name: Archive - remove source files ({{ format }})
|
||||||
archive:
|
archive:
|
||||||
path: "{{ output_dir }}/*.txt"
|
path: "{{ remote_tmp_dir }}/*.txt"
|
||||||
dest: "{{ output_dir }}/archive_remove_source_files.{{ format }}"
|
dest: "{{ remote_tmp_dir }}/archive_remove_source_files.{{ format }}"
|
||||||
format: "{{ format }}"
|
format: "{{ format }}"
|
||||||
remove: yes
|
remove: yes
|
||||||
register: archive_remove_source_files
|
register: archive_remove_source_files
|
||||||
|
|
||||||
- name: Verify archive exists - remove source files ({{ format }})
|
- name: Verify archive exists - remove source files ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/archive_remove_source_files.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_remove_source_files.{{ format }}"
|
||||||
state: file
|
state: file
|
||||||
|
|
||||||
- name: Verify all files were archived - remove source files ({{ format }})
|
- name: Verify all files were archived - remove source files ({{ format }})
|
||||||
|
@ -20,13 +20,13 @@
|
||||||
|
|
||||||
- name: Remove Archive - remove source files ({{ format }})
|
- name: Remove Archive - remove source files ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/archive_remove_source_files.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_remove_source_files.{{ format }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Assert that source files were removed - remove source files ({{ format }})
|
- name: Assert that source files were removed - remove source files ({{ format }})
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "'{{ output_dir }}/{{ item }}' is not exists"
|
- "'{{ remote_tmp_dir }}/{{ item }}' is not exists"
|
||||||
with_items:
|
with_items:
|
||||||
- foo.txt
|
- foo.txt
|
||||||
- bar.txt
|
- bar.txt
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
- name: Copy source files - remove source directory ({{ format }})
|
- name: Copy source files - remove source directory ({{ format }})
|
||||||
copy:
|
copy:
|
||||||
src: "{{ item }}"
|
src: "{{ item }}"
|
||||||
dest: "{{ output_dir }}/{{ item }}"
|
dest: "{{ remote_tmp_dir }}/{{ item }}"
|
||||||
with_items:
|
with_items:
|
||||||
- foo.txt
|
- foo.txt
|
||||||
- bar.txt
|
- bar.txt
|
||||||
|
@ -43,13 +43,13 @@
|
||||||
|
|
||||||
- name: Create temporary directory - remove source directory ({{ format }})
|
- name: Create temporary directory - remove source directory ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/tmpdir"
|
path: "{{ remote_tmp_dir }}/tmpdir"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: Copy source files to temporary directory - remove source directory ({{ format }})
|
- name: Copy source files to temporary directory - remove source directory ({{ format }})
|
||||||
copy:
|
copy:
|
||||||
src: "{{ item }}"
|
src: "{{ item }}"
|
||||||
dest: "{{ output_dir }}/tmpdir/{{ item }}"
|
dest: "{{ remote_tmp_dir }}/tmpdir/{{ item }}"
|
||||||
with_items:
|
with_items:
|
||||||
- foo.txt
|
- foo.txt
|
||||||
- bar.txt
|
- bar.txt
|
||||||
|
@ -57,15 +57,15 @@
|
||||||
|
|
||||||
- name: Archive - remove source directory ({{ format }})
|
- name: Archive - remove source directory ({{ format }})
|
||||||
archive:
|
archive:
|
||||||
path: "{{ output_dir }}/tmpdir"
|
path: "{{ remote_tmp_dir }}/tmpdir"
|
||||||
dest: "{{ output_dir }}/archive_remove_source_directory.{{ format }}"
|
dest: "{{ remote_tmp_dir }}/archive_remove_source_directory.{{ format }}"
|
||||||
format: "{{ format }}"
|
format: "{{ format }}"
|
||||||
remove: yes
|
remove: yes
|
||||||
register: archive_remove_source_directory
|
register: archive_remove_source_directory
|
||||||
|
|
||||||
- name: Verify archive exists - remove source directory ({{ format }})
|
- name: Verify archive exists - remove source directory ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/archive_remove_source_directory.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_remove_source_directory.{{ format }}"
|
||||||
state: file
|
state: file
|
||||||
|
|
||||||
- name: Verify archive contains all files - remove source directory ({{ format }})
|
- name: Verify archive contains all files - remove source directory ({{ format }})
|
||||||
|
@ -76,23 +76,23 @@
|
||||||
|
|
||||||
- name: Remove archive - remove source directory ({{ format }})
|
- name: Remove archive - remove source directory ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/archive_remove_source_directory.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_remove_source_directory.{{ format }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Verify source directory was removed - remove source directory ({{ format }})
|
- name: Verify source directory was removed - remove source directory ({{ format }})
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "'{{ output_dir }}/tmpdir' is not exists"
|
- "'{{ remote_tmp_dir }}/tmpdir' is not exists"
|
||||||
|
|
||||||
- name: Create temporary directory - remove source excluding path ({{ format }})
|
- name: Create temporary directory - remove source excluding path ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/tmpdir"
|
path: "{{ remote_tmp_dir }}/tmpdir"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: Copy source files to temporary directory - remove source excluding path ({{ format }})
|
- name: Copy source files to temporary directory - remove source excluding path ({{ format }})
|
||||||
copy:
|
copy:
|
||||||
src: "{{ item }}"
|
src: "{{ item }}"
|
||||||
dest: "{{ output_dir }}/tmpdir/{{ item }}"
|
dest: "{{ remote_tmp_dir }}/tmpdir/{{ item }}"
|
||||||
with_items:
|
with_items:
|
||||||
- foo.txt
|
- foo.txt
|
||||||
- bar.txt
|
- bar.txt
|
||||||
|
@ -100,16 +100,16 @@
|
||||||
|
|
||||||
- name: Archive - remove source excluding path ({{ format }})
|
- name: Archive - remove source excluding path ({{ format }})
|
||||||
archive:
|
archive:
|
||||||
path: "{{ output_dir }}/tmpdir/*"
|
path: "{{ remote_tmp_dir }}/tmpdir/*"
|
||||||
dest: "{{ output_dir }}/archive_remove_source_excluding_path.{{ format }}"
|
dest: "{{ remote_tmp_dir }}/archive_remove_source_excluding_path.{{ format }}"
|
||||||
format: "{{ format }}"
|
format: "{{ format }}"
|
||||||
remove: yes
|
remove: yes
|
||||||
exclude_path: "{{ output_dir }}/tmpdir/empty.txt"
|
exclude_path: "{{ remote_tmp_dir }}/tmpdir/empty.txt"
|
||||||
register: archive_remove_source_excluding_path
|
register: archive_remove_source_excluding_path
|
||||||
|
|
||||||
- name: Verify archive exists - remove source excluding path ({{ format }})
|
- name: Verify archive exists - remove source excluding path ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/archive_remove_source_excluding_path.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_remove_source_excluding_path.{{ format }}"
|
||||||
state: file
|
state: file
|
||||||
|
|
||||||
- name: Verify all files except excluded are archived - remove source excluding path ({{ format }})
|
- name: Verify all files except excluded are archived - remove source excluding path ({{ format }})
|
||||||
|
@ -120,18 +120,18 @@
|
||||||
|
|
||||||
- name: Remove archive - remove source excluding path ({{ format }})
|
- name: Remove archive - remove source excluding path ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/archive_remove_source_excluding_path.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_remove_source_excluding_path.{{ format }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Verify that excluded file still exists - remove source excluding path ({{ format }})
|
- name: Verify that excluded file still exists - remove source excluding path ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/tmpdir/empty.txt"
|
path: "{{ remote_tmp_dir }}/tmpdir/empty.txt"
|
||||||
state: file
|
state: file
|
||||||
|
|
||||||
- name: Copy source files to temporary directory - remove source excluding sub path ({{ format }})
|
- name: Copy source files to temporary directory - remove source excluding sub path ({{ format }})
|
||||||
copy:
|
copy:
|
||||||
src: "{{ item }}"
|
src: "{{ item }}"
|
||||||
dest: "{{ output_dir }}/tmpdir/{{ item }}"
|
dest: "{{ remote_tmp_dir }}/tmpdir/{{ item }}"
|
||||||
with_items:
|
with_items:
|
||||||
- foo.txt
|
- foo.txt
|
||||||
- bar.txt
|
- bar.txt
|
||||||
|
@ -142,33 +142,33 @@
|
||||||
- name: Archive - remove source excluding sub path ({{ format }})
|
- name: Archive - remove source excluding sub path ({{ format }})
|
||||||
archive:
|
archive:
|
||||||
path:
|
path:
|
||||||
- "{{ output_dir }}/tmpdir/*.txt"
|
- "{{ remote_tmp_dir }}/tmpdir/*.txt"
|
||||||
- "{{ output_dir }}/tmpdir/sub/*"
|
- "{{ remote_tmp_dir }}/tmpdir/sub/*"
|
||||||
dest: "{{ output_dir }}/archive_remove_source_excluding_sub_path.{{ format }}"
|
dest: "{{ remote_tmp_dir }}/archive_remove_source_excluding_sub_path.{{ format }}"
|
||||||
format: "{{ format }}"
|
format: "{{ format }}"
|
||||||
remove: yes
|
remove: yes
|
||||||
exclude_path: "{{ output_dir }}/tmpdir/sub/subfile.txt"
|
exclude_path: "{{ remote_tmp_dir }}/tmpdir/sub/subfile.txt"
|
||||||
register: archive_remove_source_excluding_sub_path
|
register: archive_remove_source_excluding_sub_path
|
||||||
|
|
||||||
- name: Verify archive exists - remove source excluding sub path ({{ format }})
|
- name: Verify archive exists - remove source excluding sub path ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/archive_remove_source_excluding_sub_path.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_remove_source_excluding_sub_path.{{ format }}"
|
||||||
state: file
|
state: file
|
||||||
|
|
||||||
- name: Remove archive - remove source excluding sub path ({{ format }})
|
- name: Remove archive - remove source excluding sub path ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/archive_remove_source_excluding_sub_path.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_remove_source_excluding_sub_path.{{ format }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Verify that sub path still exists - remove source excluding sub path ({{ format }})
|
- name: Verify that sub path still exists - remove source excluding sub path ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/tmpdir/sub/subfile.txt"
|
path: "{{ remote_tmp_dir }}/tmpdir/sub/subfile.txt"
|
||||||
state: file
|
state: file
|
||||||
|
|
||||||
- name: Copy source files to temporary directory - remove source with nested paths ({{ format }})
|
- name: Copy source files to temporary directory - remove source with nested paths ({{ format }})
|
||||||
copy:
|
copy:
|
||||||
src: "{{ item }}"
|
src: "{{ item }}"
|
||||||
dest: "{{ output_dir }}/tmpdir/{{ item }}"
|
dest: "{{ remote_tmp_dir }}/tmpdir/{{ item }}"
|
||||||
with_items:
|
with_items:
|
||||||
- foo.txt
|
- foo.txt
|
||||||
- bar.txt
|
- bar.txt
|
||||||
|
@ -178,20 +178,20 @@
|
||||||
|
|
||||||
- name: Archive - remove source with nested paths ({{ format }})
|
- name: Archive - remove source with nested paths ({{ format }})
|
||||||
archive:
|
archive:
|
||||||
path: "{{ output_dir }}/tmpdir/"
|
path: "{{ remote_tmp_dir }}/tmpdir/"
|
||||||
dest: "{{ output_dir }}/archive_remove_source_nested_paths.{{ format }}"
|
dest: "{{ remote_tmp_dir }}/archive_remove_source_nested_paths.{{ format }}"
|
||||||
format: "{{ format }}"
|
format: "{{ format }}"
|
||||||
remove: yes
|
remove: yes
|
||||||
register: archive_remove_nested_paths
|
register: archive_remove_nested_paths
|
||||||
|
|
||||||
- name: Verify archive exists - remove source with nested paths ({{ format }})
|
- name: Verify archive exists - remove source with nested paths ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/archive_remove_source_nested_paths.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_remove_source_nested_paths.{{ format }}"
|
||||||
state: file
|
state: file
|
||||||
|
|
||||||
- name: Verify source files were removed - remove source with nested paths ({{ format }})
|
- name: Verify source files were removed - remove source with nested paths ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/tmpdir"
|
path: "{{ remote_tmp_dir }}/tmpdir"
|
||||||
state: absent
|
state: absent
|
||||||
register: archive_remove_nested_paths_status
|
register: archive_remove_nested_paths_status
|
||||||
|
|
||||||
|
@ -203,5 +203,5 @@
|
||||||
|
|
||||||
- name: Remove archive - remove source with nested paths ({{ format }})
|
- name: Remove archive - remove source with nested paths ({{ format }})
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/archive_remove_source_nested_paths.{{ format }}"
|
path: "{{ remote_tmp_dir }}/archive_remove_source_nested_paths.{{ format }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
|
@ -2,3 +2,4 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
- setup_pkg_mgr
|
- setup_pkg_mgr
|
||||||
- setup_openssl
|
- setup_openssl
|
||||||
|
- setup_remote_tmp_dir
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
vars:
|
vars:
|
||||||
consul_version: 1.5.0
|
consul_version: 1.5.0
|
||||||
consul_uri: https://s3.amazonaws.com/ansible-ci-files/test/integration/targets/consul/consul_{{ consul_version }}_{{ ansible_system | lower }}_{{ consul_arch }}.zip
|
consul_uri: https://s3.amazonaws.com/ansible-ci-files/test/integration/targets/consul/consul_{{ consul_version }}_{{ ansible_system | lower }}_{{ consul_arch }}.zip
|
||||||
consul_cmd: '{{ output_dir }}/consul'
|
consul_cmd: '{{ remote_tmp_dir }}/consul'
|
||||||
block:
|
block:
|
||||||
- name: register pyOpenSSL version
|
- name: register pyOpenSSL version
|
||||||
command: '{{ ansible_python_interpreter }} -c ''import OpenSSL; print(OpenSSL.__version__)'''
|
command: '{{ ansible_python_interpreter }} -c ''import OpenSSL; print(OpenSSL.__version__)'''
|
||||||
|
@ -27,19 +27,19 @@
|
||||||
block:
|
block:
|
||||||
- name: Generate privatekey
|
- name: Generate privatekey
|
||||||
community.crypto.openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ output_dir }}/privatekey.pem'
|
path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
- name: Generate CSR
|
- name: Generate CSR
|
||||||
community.crypto.openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ output_dir }}/csr.csr'
|
path: '{{ remote_tmp_dir }}/csr.csr'
|
||||||
privatekey_path: '{{ output_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
commonName: localhost
|
commonName: localhost
|
||||||
- name: Generate selfsigned certificate
|
- name: Generate selfsigned certificate
|
||||||
register: selfsigned_certificate
|
register: selfsigned_certificate
|
||||||
community.crypto.openssl_certificate:
|
community.crypto.openssl_certificate:
|
||||||
path: '{{ output_dir }}/cert.pem'
|
path: '{{ remote_tmp_dir }}/cert.pem'
|
||||||
csr_path: '{{ output_dir }}/csr.csr'
|
csr_path: '{{ remote_tmp_dir }}/csr.csr'
|
||||||
privatekey_path: '{{ output_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
provider: selfsigned
|
provider: selfsigned
|
||||||
selfsigned_digest: sha256
|
selfsigned_digest: sha256
|
||||||
- name: Install unzip
|
- name: Install unzip
|
||||||
|
@ -59,21 +59,21 @@
|
||||||
- name: Download consul binary
|
- name: Download consul binary
|
||||||
unarchive:
|
unarchive:
|
||||||
src: '{{ consul_uri }}'
|
src: '{{ consul_uri }}'
|
||||||
dest: '{{ output_dir }}'
|
dest: '{{ remote_tmp_dir }}'
|
||||||
remote_src: true
|
remote_src: true
|
||||||
register: result
|
register: result
|
||||||
until: result is success
|
until: result is success
|
||||||
- vars:
|
- vars:
|
||||||
remote_dir: '{{ echo_output_dir.stdout }}'
|
remote_dir: '{{ echo_remote_tmp_dir.stdout }}'
|
||||||
block:
|
block:
|
||||||
- command: echo {{ output_dir }}
|
- command: echo {{ remote_tmp_dir }}
|
||||||
register: echo_output_dir
|
register: echo_remote_tmp_dir
|
||||||
- name: Create configuration file
|
- name: Create configuration file
|
||||||
template:
|
template:
|
||||||
src: consul_config.hcl.j2
|
src: consul_config.hcl.j2
|
||||||
dest: '{{ output_dir }}/consul_config.hcl'
|
dest: '{{ remote_tmp_dir }}/consul_config.hcl'
|
||||||
- name: Start Consul (dev mode enabled)
|
- name: Start Consul (dev mode enabled)
|
||||||
shell: nohup {{ consul_cmd }} agent -dev -config-file {{ output_dir }}/consul_config.hcl </dev/null >/dev/null 2>&1 &
|
shell: nohup {{ consul_cmd }} agent -dev -config-file {{ remote_tmp_dir }}/consul_config.hcl </dev/null >/dev/null 2>&1 &
|
||||||
- name: Create some data
|
- name: Create some data
|
||||||
command: '{{ consul_cmd }} kv put data/value{{ item }} foo{{ item }}'
|
command: '{{ consul_cmd }} kv put data/value{{ item }} foo{{ item }}'
|
||||||
loop:
|
loop:
|
||||||
|
@ -83,5 +83,5 @@
|
||||||
- import_tasks: consul_session.yml
|
- import_tasks: consul_session.yml
|
||||||
always:
|
always:
|
||||||
- name: Kill consul process
|
- name: Kill consul process
|
||||||
shell: kill $(cat {{ output_dir }}/consul.pid)
|
shell: kill $(cat {{ remote_tmp_dir }}/consul.pid)
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
2
tests/integration/targets/deploy_helper/meta/main.yml
Normal file
2
tests/integration/targets/deploy_helper/meta/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
dependencies:
|
||||||
|
- setup_remote_tmp_dir
|
|
@ -5,7 +5,7 @@
|
||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- name: record the output directory
|
- name: record the output directory
|
||||||
set_fact: deploy_helper_test_root={{output_dir}}/deploy_helper_test_root
|
set_fact: deploy_helper_test_root={{remote_tmp_dir}}/deploy_helper_test_root
|
||||||
|
|
||||||
- name: State=query with default parameters
|
- name: State=query with default parameters
|
||||||
deploy_helper: path={{ deploy_helper_test_root }} state=query
|
deploy_helper: path={{ deploy_helper_test_root }} state=query
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
dependencies:
|
||||||
|
- setup_remote_tmp_dir
|
|
@ -8,9 +8,6 @@
|
||||||
# Copyright: (c) 2019, Ansible Project
|
# Copyright: (c) 2019, Ansible Project
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
- set_fact:
|
|
||||||
output_dir: "{{ lookup('env', 'OUTPUT_DIR') }}"
|
|
||||||
|
|
||||||
- name: Test random_mac filter bad argument type
|
- name: Test random_mac filter bad argument type
|
||||||
debug:
|
debug:
|
||||||
var: "0 | community.general.random_mac"
|
var: "0 | community.general.random_mac"
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
mode: '0755'
|
mode: '0755'
|
||||||
|
|
||||||
- name: Start HTTP server
|
- name: Start HTTP server
|
||||||
command: '{{ remote_tmp_dir }}/serve.py 127.0.0.1 8000 /tmp/flatpak/'
|
command: '{{ ansible_python.executable }} {{ remote_tmp_dir }}/serve.py 127.0.0.1 8000 /tmp/flatpak/'
|
||||||
async: 120
|
async: 120
|
||||||
poll: 0
|
poll: 0
|
||||||
register: webserver_status
|
register: webserver_status
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
- setup_pkg_mgr
|
- setup_pkg_mgr
|
||||||
|
- setup_remote_tmp_dir
|
||||||
|
|
|
@ -122,7 +122,7 @@
|
||||||
gem:
|
gem:
|
||||||
name: gist
|
name: gist
|
||||||
state: present
|
state: present
|
||||||
install_dir: "{{ output_dir }}/gems"
|
install_dir: "{{ remote_tmp_dir }}/gems"
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
register: install_gem_fail_result
|
register: install_gem_fail_result
|
||||||
|
|
||||||
|
@ -141,12 +141,12 @@
|
||||||
name: gist
|
name: gist
|
||||||
state: present
|
state: present
|
||||||
user_install: no
|
user_install: no
|
||||||
install_dir: "{{ output_dir }}/gems"
|
install_dir: "{{ remote_tmp_dir }}/gems"
|
||||||
register: install_gem_result
|
register: install_gem_result
|
||||||
|
|
||||||
- name: Find gems in custom directory
|
- name: Find gems in custom directory
|
||||||
find:
|
find:
|
||||||
paths: "{{ output_dir }}/gems/gems"
|
paths: "{{ remote_tmp_dir }}/gems/gems"
|
||||||
file_type: directory
|
file_type: directory
|
||||||
contains: gist
|
contains: gist
|
||||||
register: gem_search
|
register: gem_search
|
||||||
|
@ -163,12 +163,12 @@
|
||||||
name: gist
|
name: gist
|
||||||
state: absent
|
state: absent
|
||||||
user_install: no
|
user_install: no
|
||||||
install_dir: "{{ output_dir }}/gems"
|
install_dir: "{{ remote_tmp_dir }}/gems"
|
||||||
register: install_gem_result
|
register: install_gem_result
|
||||||
|
|
||||||
- name: Find gems in custom directory
|
- name: Find gems in custom directory
|
||||||
find:
|
find:
|
||||||
paths: "{{ output_dir }}/gems/gems"
|
paths: "{{ remote_tmp_dir }}/gems/gems"
|
||||||
file_type: directory
|
file_type: directory
|
||||||
contains: gist
|
contains: gist
|
||||||
register: gem_search
|
register: gem_search
|
||||||
|
@ -184,14 +184,14 @@
|
||||||
gem:
|
gem:
|
||||||
name: gist
|
name: gist
|
||||||
state: present
|
state: present
|
||||||
bindir: "{{ output_dir }}/custom_bindir"
|
bindir: "{{ remote_tmp_dir }}/custom_bindir"
|
||||||
norc: yes
|
norc: yes
|
||||||
user_install: no # Avoid conflicts between --install-dir and --user-install when running as root on CentOS / Fedora / RHEL
|
user_install: no # Avoid conflicts between --install-dir and --user-install when running as root on CentOS / Fedora / RHEL
|
||||||
register: install_gem_result
|
register: install_gem_result
|
||||||
|
|
||||||
- name: Get stats of gem executable
|
- name: Get stats of gem executable
|
||||||
stat:
|
stat:
|
||||||
path: "{{ output_dir }}/custom_bindir/gist"
|
path: "{{ remote_tmp_dir }}/custom_bindir/gist"
|
||||||
register: gem_bindir_stat
|
register: gem_bindir_stat
|
||||||
|
|
||||||
- name: Ensure gem executable was installed in custom directory
|
- name: Ensure gem executable was installed in custom directory
|
||||||
|
@ -204,14 +204,14 @@
|
||||||
gem:
|
gem:
|
||||||
name: gist
|
name: gist
|
||||||
state: absent
|
state: absent
|
||||||
bindir: "{{ output_dir }}/custom_bindir"
|
bindir: "{{ remote_tmp_dir }}/custom_bindir"
|
||||||
norc: yes
|
norc: yes
|
||||||
user_install: no # Avoid conflicts between --install-dir and --user-install when running as root on CentOS / Fedora / RHEL
|
user_install: no # Avoid conflicts between --install-dir and --user-install when running as root on CentOS / Fedora / RHEL
|
||||||
register: install_gem_result
|
register: install_gem_result
|
||||||
|
|
||||||
- name: Get stats of gem executable
|
- name: Get stats of gem executable
|
||||||
stat:
|
stat:
|
||||||
path: "{{ output_dir }}/custom_bindir/gist"
|
path: "{{ remote_tmp_dir }}/custom_bindir/gist"
|
||||||
register: gem_bindir_stat
|
register: gem_bindir_stat
|
||||||
|
|
||||||
- name: Ensure gem executable was removed from custom directory
|
- name: Ensure gem executable was removed from custom directory
|
||||||
|
|
2
tests/integration/targets/git_config/meta/main.yml
Normal file
2
tests/integration/targets/git_config/meta/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
dependencies:
|
||||||
|
- setup_remote_tmp_dir
|
|
@ -6,7 +6,7 @@
|
||||||
name: "{{ option_name }}"
|
name: "{{ option_name }}"
|
||||||
value: "{{ option_value }}"
|
value: "{{ option_value }}"
|
||||||
scope: "file"
|
scope: "file"
|
||||||
file: "{{ output_dir }}/gitconfig_file"
|
file: "{{ remote_tmp_dir }}/gitconfig_file"
|
||||||
state: present
|
state: present
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
git_config:
|
git_config:
|
||||||
name: "{{ option_name }}"
|
name: "{{ option_name }}"
|
||||||
scope: "file"
|
scope: "file"
|
||||||
file: "{{ output_dir }}/gitconfig_file"
|
file: "{{ remote_tmp_dir }}/gitconfig_file"
|
||||||
state: present
|
state: present
|
||||||
register: get_result
|
register: get_result
|
||||||
|
|
||||||
|
@ -26,4 +26,3 @@
|
||||||
- set_result.diff.after == option_value + "\n"
|
- set_result.diff.after == option_value + "\n"
|
||||||
- get_result is not changed
|
- get_result is not changed
|
||||||
- get_result.config_value == option_value
|
- get_result.config_value == option_value
|
||||||
...
|
|
||||||
|
|
|
@ -8,6 +8,5 @@
|
||||||
|
|
||||||
- name: set up without value (file)
|
- name: set up without value (file)
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir }}/gitconfig_file"
|
path: "{{ remote_tmp_dir }}/gitconfig_file"
|
||||||
state: absent
|
state: absent
|
||||||
...
|
|
||||||
|
|
|
@ -9,5 +9,4 @@
|
||||||
- name: set up with value (file)
|
- name: set up with value (file)
|
||||||
copy:
|
copy:
|
||||||
src: gitconfig
|
src: gitconfig
|
||||||
dest: "{{ output_dir }}/gitconfig_file"
|
dest: "{{ remote_tmp_dir }}/gitconfig_file"
|
||||||
...
|
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
- setup_pkg_mgr
|
- setup_pkg_mgr
|
||||||
|
- setup_remote_tmp_dir
|
||||||
|
|
|
@ -6,14 +6,14 @@
|
||||||
|
|
||||||
- name: set where to extract the repo
|
- name: set where to extract the repo
|
||||||
set_fact:
|
set_fact:
|
||||||
checkout_dir: "{{ output_dir }}/hg_project_test"
|
checkout_dir: "{{ remote_tmp_dir }}/hg_project_test"
|
||||||
|
|
||||||
- name: set what repo to use
|
- name: set what repo to use
|
||||||
set_fact:
|
set_fact:
|
||||||
repo: "http://hg.pf.osdn.net/view/a/ak/akasurde/hg_project_test"
|
repo: "http://hg.pf.osdn.net/view/a/ak/akasurde/hg_project_test"
|
||||||
|
|
||||||
- name: clean out the output_dir
|
- name: clean out the remote_tmp_dir
|
||||||
shell: rm -rf {{ output_dir }}/*
|
shell: rm -rf {{ remote_tmp_dir }}/*
|
||||||
|
|
||||||
- name: verify that mercurial is installed so this test can continue
|
- name: verify that mercurial is installed so this test can continue
|
||||||
shell: which hg
|
shell: which hg
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
- setup_pkg_mgr
|
- setup_pkg_mgr
|
||||||
|
- setup_remote_tmp_dir
|
||||||
|
|
|
@ -14,15 +14,23 @@
|
||||||
- debug: var=install_pycdlib
|
- debug: var=install_pycdlib
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
output_dir_test: '{{ output_dir }}/test_iso_create'
|
output_test_dir: '{{ remote_tmp_dir }}/test_iso_create'
|
||||||
|
|
||||||
# - include_tasks: prepare_dest_dir.yml
|
# - include_tasks: prepare_dest_dir.yml
|
||||||
|
|
||||||
|
- name: Copy files and directories
|
||||||
|
copy:
|
||||||
|
src: '{{ item }}'
|
||||||
|
dest: '{{ remote_tmp_dir }}/{{ item }}'
|
||||||
|
loop:
|
||||||
|
- test1.cfg
|
||||||
|
- test_dir
|
||||||
|
|
||||||
- name: Test check mode
|
- name: Test check mode
|
||||||
iso_create:
|
iso_create:
|
||||||
src_files:
|
src_files:
|
||||||
- "{{ role_path }}/files/test1.cfg"
|
- "{{ remote_tmp_dir }}/test1.cfg"
|
||||||
dest_iso: "{{ output_dir_test }}/test.iso"
|
dest_iso: "{{ output_test_dir }}/test.iso"
|
||||||
interchange_level: 3
|
interchange_level: 3
|
||||||
register: iso_result
|
register: iso_result
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
|
@ -30,7 +38,7 @@
|
||||||
|
|
||||||
- name: Check if iso file created
|
- name: Check if iso file created
|
||||||
stat:
|
stat:
|
||||||
path: "{{ output_dir_test }}/test.iso"
|
path: "{{ output_test_dir }}/test.iso"
|
||||||
register: iso_file
|
register: iso_file
|
||||||
- debug: var=iso_file
|
- debug: var=iso_file
|
||||||
- assert:
|
- assert:
|
||||||
|
@ -41,15 +49,15 @@
|
||||||
- name: Create iso file with a specified file
|
- name: Create iso file with a specified file
|
||||||
iso_create:
|
iso_create:
|
||||||
src_files:
|
src_files:
|
||||||
- "{{ role_path }}/files/test1.cfg"
|
- "{{ remote_tmp_dir }}/test1.cfg"
|
||||||
dest_iso: "{{ output_dir_test }}/test.iso"
|
dest_iso: "{{ output_test_dir }}/test.iso"
|
||||||
interchange_level: 3
|
interchange_level: 3
|
||||||
register: iso_result
|
register: iso_result
|
||||||
- debug: var=iso_result
|
- debug: var=iso_result
|
||||||
|
|
||||||
- name: Check if iso file created
|
- name: Check if iso file created
|
||||||
stat:
|
stat:
|
||||||
path: "{{ output_dir_test }}/test.iso"
|
path: "{{ output_test_dir }}/test.iso"
|
||||||
register: iso_file
|
register: iso_file
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
|
@ -60,16 +68,16 @@
|
||||||
- name: Create iso file with a specified file and folder
|
- name: Create iso file with a specified file and folder
|
||||||
iso_create:
|
iso_create:
|
||||||
src_files:
|
src_files:
|
||||||
- "{{ role_path }}/files/test1.cfg"
|
- "{{ remote_tmp_dir }}/test1.cfg"
|
||||||
- "{{ role_path }}/files/test_dir"
|
- "{{ remote_tmp_dir }}/test_dir"
|
||||||
dest_iso: "{{ output_dir_test }}/test1.iso"
|
dest_iso: "{{ output_test_dir }}/test1.iso"
|
||||||
interchange_level: 3
|
interchange_level: 3
|
||||||
register: iso_result
|
register: iso_result
|
||||||
- debug: var=iso_result
|
- debug: var=iso_result
|
||||||
|
|
||||||
- name: Check if iso file created
|
- name: Check if iso file created
|
||||||
stat:
|
stat:
|
||||||
path: "{{ output_dir_test }}/test1.iso"
|
path: "{{ output_test_dir }}/test1.iso"
|
||||||
register: iso_file
|
register: iso_file
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
|
@ -80,15 +88,15 @@
|
||||||
- name: Create iso file with volume identification string
|
- name: Create iso file with volume identification string
|
||||||
iso_create:
|
iso_create:
|
||||||
src_files:
|
src_files:
|
||||||
- "{{ role_path }}/files/test1.cfg"
|
- "{{ remote_tmp_dir }}/test1.cfg"
|
||||||
dest_iso: "{{ output_dir_test }}/test2.iso"
|
dest_iso: "{{ output_test_dir }}/test2.iso"
|
||||||
vol_ident: "OEMDRV"
|
vol_ident: "OEMDRV"
|
||||||
register: iso_result
|
register: iso_result
|
||||||
- debug: var=iso_result
|
- debug: var=iso_result
|
||||||
|
|
||||||
- name: Check if iso file created
|
- name: Check if iso file created
|
||||||
stat:
|
stat:
|
||||||
path: "{{ output_dir_test }}/test2.iso"
|
path: "{{ output_test_dir }}/test2.iso"
|
||||||
register: iso_file
|
register: iso_file
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
|
@ -99,15 +107,15 @@
|
||||||
- name: Create iso file with Rock Ridge extention
|
- name: Create iso file with Rock Ridge extention
|
||||||
iso_create:
|
iso_create:
|
||||||
src_files:
|
src_files:
|
||||||
- "{{ role_path }}/files/test1.cfg"
|
- "{{ remote_tmp_dir }}/test1.cfg"
|
||||||
dest_iso: "{{ output_dir_test }}/test3.iso"
|
dest_iso: "{{ output_test_dir }}/test3.iso"
|
||||||
rock_ridge: "1.09"
|
rock_ridge: "1.09"
|
||||||
register: iso_result
|
register: iso_result
|
||||||
- debug: var=iso_result
|
- debug: var=iso_result
|
||||||
|
|
||||||
- name: Check if iso file created
|
- name: Check if iso file created
|
||||||
stat:
|
stat:
|
||||||
path: "{{ output_dir_test }}/test3.iso"
|
path: "{{ output_test_dir }}/test3.iso"
|
||||||
register: iso_file
|
register: iso_file
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
|
@ -118,15 +126,15 @@
|
||||||
- name: Create iso file with Joliet extention
|
- name: Create iso file with Joliet extention
|
||||||
iso_create:
|
iso_create:
|
||||||
src_files:
|
src_files:
|
||||||
- "{{ role_path }}/files/test1.cfg"
|
- "{{ remote_tmp_dir }}/test1.cfg"
|
||||||
dest_iso: "{{ output_dir_test }}/test4.iso"
|
dest_iso: "{{ output_test_dir }}/test4.iso"
|
||||||
joliet: 3
|
joliet: 3
|
||||||
register: iso_result
|
register: iso_result
|
||||||
- debug: var=iso_result
|
- debug: var=iso_result
|
||||||
|
|
||||||
- name: Check if iso file created
|
- name: Check if iso file created
|
||||||
stat:
|
stat:
|
||||||
path: "{{ output_dir_test }}/test4.iso"
|
path: "{{ output_test_dir }}/test4.iso"
|
||||||
register: iso_file
|
register: iso_file
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
|
@ -137,15 +145,15 @@
|
||||||
- name: Create iso file with UDF enabled
|
- name: Create iso file with UDF enabled
|
||||||
iso_create:
|
iso_create:
|
||||||
src_files:
|
src_files:
|
||||||
- "{{ role_path }}/files/test1.cfg"
|
- "{{ remote_tmp_dir }}/test1.cfg"
|
||||||
dest_iso: "{{ output_dir_test }}/test5.iso"
|
dest_iso: "{{ output_test_dir }}/test5.iso"
|
||||||
udf: True
|
udf: True
|
||||||
register: iso_result
|
register: iso_result
|
||||||
- debug: var=iso_result
|
- debug: var=iso_result
|
||||||
|
|
||||||
- name: Check if iso file created
|
- name: Check if iso file created
|
||||||
stat:
|
stat:
|
||||||
path: "{{ output_dir_test }}/test5.iso"
|
path: "{{ output_test_dir }}/test5.iso"
|
||||||
register: iso_file
|
register: iso_file
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
- name: Make sure our testing sub-directory does not exist
|
- name: Make sure our testing sub-directory does not exist
|
||||||
file:
|
file:
|
||||||
path: '{{ output_dir_test }}'
|
path: '{{ output_test_dir }}'
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Create our testing sub-directory
|
- name: Create our testing sub-directory
|
||||||
file:
|
file:
|
||||||
path: '{{ output_dir_test }}'
|
path: '{{ output_test_dir }}'
|
||||||
state: directory
|
state: directory
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
- setup_pkg_mgr
|
- setup_pkg_mgr
|
||||||
- setup_epel
|
- setup_epel
|
||||||
|
- setup_remote_tmp_dir
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
output_dir_test: '{{ output_dir }}/test_iso_extract'
|
output_test_dir: '{{ remote_tmp_dir }}/test_iso_extract'
|
||||||
|
|
||||||
- name: Install 7zip
|
- name: Install 7zip
|
||||||
import_tasks: 7zip.yml
|
import_tasks: 7zip.yml
|
||||||
|
|
|
@ -19,15 +19,15 @@
|
||||||
|
|
||||||
- name: Make sure our testing sub-directory does not exist
|
- name: Make sure our testing sub-directory does not exist
|
||||||
file:
|
file:
|
||||||
path: '{{ output_dir_test }}'
|
path: '{{ output_test_dir }}'
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Create our testing sub-directory
|
- name: Create our testing sub-directory
|
||||||
file:
|
file:
|
||||||
path: '{{ output_dir_test }}'
|
path: '{{ output_test_dir }}'
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: copy the iso to the test dir
|
- name: copy the iso to the test dir
|
||||||
copy:
|
copy:
|
||||||
src: test.iso
|
src: test.iso
|
||||||
dest: '{{ output_dir_test }}'
|
dest: '{{ output_test_dir }}'
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
|
|
||||||
- name: Extract the iso
|
- name: Extract the iso
|
||||||
iso_extract:
|
iso_extract:
|
||||||
image: '{{ output_dir_test }}/test.iso'
|
image: '{{ output_test_dir }}/test.iso'
|
||||||
dest: '{{ output_dir_test }}'
|
dest: '{{ output_test_dir }}'
|
||||||
files:
|
files:
|
||||||
- 1.txt
|
- 1.txt
|
||||||
- 2.txt
|
- 2.txt
|
||||||
|
@ -32,8 +32,8 @@
|
||||||
|
|
||||||
- name: Extract the iso again
|
- name: Extract the iso again
|
||||||
iso_extract:
|
iso_extract:
|
||||||
image: '{{ output_dir_test }}/test.iso'
|
image: '{{ output_test_dir }}/test.iso'
|
||||||
dest: '{{ output_dir_test }}'
|
dest: '{{ output_test_dir }}'
|
||||||
files:
|
files:
|
||||||
- 1.txt
|
- 1.txt
|
||||||
- 2.txt
|
- 2.txt
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
---
|
---
|
||||||
test_pkcs12_path: testpkcs.p12
|
test_pkcs12_path: testpkcs.p12
|
||||||
test_keystore_path: keystore.jks
|
test_keystore_path: keystore.jks
|
||||||
test_keystore2_path: "{{ output_dir }}/keystore2.jks"
|
test_keystore2_path: "{{ remote_tmp_dir }}/keystore2.jks"
|
||||||
test_keystore2_password: changeit
|
test_keystore2_password: changeit
|
||||||
test_cert_path: "{{ output_dir }}/cert.pem"
|
test_cert_path: "{{ remote_tmp_dir }}/cert.pem"
|
||||||
test_key_path: "{{ output_dir }}/key.pem"
|
test_key_path: "{{ remote_tmp_dir }}/key.pem"
|
||||||
test_csr_path: "{{ output_dir }}/req.csr"
|
test_csr_path: "{{ remote_tmp_dir }}/req.csr"
|
||||||
test_cert2_path: "{{ output_dir }}/cert2.pem"
|
test_cert2_path: "{{ remote_tmp_dir }}/cert2.pem"
|
||||||
test_key2_path: "{{ output_dir }}/key2.pem"
|
test_key2_path: "{{ remote_tmp_dir }}/key2.pem"
|
||||||
test_csr2_path: "{{ output_dir }}/req2.csr"
|
test_csr2_path: "{{ remote_tmp_dir }}/req2.csr"
|
||||||
test_pkcs_path: "{{ output_dir }}/cert.p12"
|
test_pkcs_path: "{{ remote_tmp_dir }}/cert.p12"
|
||||||
test_pkcs2_path: "{{ output_dir }}/cert2.p12"
|
test_pkcs2_path: "{{ remote_tmp_dir }}/cert2.p12"
|
||||||
test_ssl: setupSSLServer.py
|
test_ssl: setupSSLServer.py
|
||||||
test_ssl_port: 21500
|
test_ssl_port: 21500
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
- setup_java_keytool
|
- setup_java_keytool
|
||||||
- setup_openssl
|
- setup_openssl
|
||||||
|
- setup_remote_tmp_dir
|
||||||
|
|
|
@ -9,15 +9,15 @@
|
||||||
- name: prep pkcs12 file
|
- name: prep pkcs12 file
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: "{{ test_pkcs12_path }}"
|
src: "{{ test_pkcs12_path }}"
|
||||||
dest: "{{ output_dir }}/{{ test_pkcs12_path }}"
|
dest: "{{ remote_tmp_dir }}/{{ test_pkcs12_path }}"
|
||||||
|
|
||||||
- name: import pkcs12
|
- name: import pkcs12
|
||||||
community.general.java_cert:
|
community.general.java_cert:
|
||||||
pkcs12_path: "{{ output_dir }}/{{ test_pkcs12_path }}"
|
pkcs12_path: "{{ remote_tmp_dir }}/{{ test_pkcs12_path }}"
|
||||||
pkcs12_password: changeit
|
pkcs12_password: changeit
|
||||||
pkcs12_alias: default
|
pkcs12_alias: default
|
||||||
cert_alias: default
|
cert_alias: default
|
||||||
keystore_path: "{{ output_dir }}/{{ test_keystore_path }}"
|
keystore_path: "{{ remote_tmp_dir }}/{{ test_keystore_path }}"
|
||||||
keystore_pass: changeme_keystore
|
keystore_pass: changeme_keystore
|
||||||
keystore_create: yes
|
keystore_create: yes
|
||||||
state: present
|
state: present
|
||||||
|
@ -30,11 +30,11 @@
|
||||||
|
|
||||||
- name: import pkcs12 with wrong password
|
- name: import pkcs12 with wrong password
|
||||||
community.general.java_cert:
|
community.general.java_cert:
|
||||||
pkcs12_path: "{{ output_dir }}/{{ test_pkcs12_path }}"
|
pkcs12_path: "{{ remote_tmp_dir }}/{{ test_pkcs12_path }}"
|
||||||
pkcs12_password: wrong_pass
|
pkcs12_password: wrong_pass
|
||||||
pkcs12_alias: default
|
pkcs12_alias: default
|
||||||
cert_alias: default_new
|
cert_alias: default_new
|
||||||
keystore_path: "{{ output_dir }}/{{ test_keystore_path }}"
|
keystore_path: "{{ remote_tmp_dir }}/{{ test_keystore_path }}"
|
||||||
keystore_pass: changeme_keystore
|
keystore_pass: changeme_keystore
|
||||||
keystore_create: yes
|
keystore_create: yes
|
||||||
state: present
|
state: present
|
||||||
|
@ -49,9 +49,9 @@
|
||||||
- name: test fail on mutually exclusive params
|
- name: test fail on mutually exclusive params
|
||||||
community.general.java_cert:
|
community.general.java_cert:
|
||||||
cert_path: ca.crt
|
cert_path: ca.crt
|
||||||
pkcs12_path: "{{ output_dir }}/{{ test_pkcs12_path }}"
|
pkcs12_path: "{{ remote_tmp_dir }}/{{ test_pkcs12_path }}"
|
||||||
cert_alias: default
|
cert_alias: default
|
||||||
keystore_path: "{{ output_dir }}/{{ test_keystore_path }}"
|
keystore_path: "{{ remote_tmp_dir }}/{{ test_keystore_path }}"
|
||||||
keystore_pass: changeme_keystore
|
keystore_pass: changeme_keystore
|
||||||
keystore_create: yes
|
keystore_create: yes
|
||||||
state: present
|
state: present
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
|
|
||||||
- name: test fail on missing required params
|
- name: test fail on missing required params
|
||||||
community.general.java_cert:
|
community.general.java_cert:
|
||||||
keystore_path: "{{ output_dir }}/{{ test_keystore_path }}"
|
keystore_path: "{{ remote_tmp_dir }}/{{ test_keystore_path }}"
|
||||||
keystore_pass: changeme_keystore
|
keystore_pass: changeme_keystore
|
||||||
state: absent
|
state: absent
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
@ -78,7 +78,7 @@
|
||||||
|
|
||||||
- name: delete object based on cert_alias parameter
|
- name: delete object based on cert_alias parameter
|
||||||
community.general.java_cert:
|
community.general.java_cert:
|
||||||
keystore_path: "{{ output_dir }}/{{ test_keystore_path }}"
|
keystore_path: "{{ remote_tmp_dir }}/{{ test_keystore_path }}"
|
||||||
keystore_pass: changeme_keystore
|
keystore_pass: changeme_keystore
|
||||||
cert_alias: default
|
cert_alias: default
|
||||||
state: absent
|
state: absent
|
||||||
|
@ -98,8 +98,8 @@
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
state: absent
|
state: absent
|
||||||
loop:
|
loop:
|
||||||
- "{{ output_dir }}/{{ test_pkcs12_path }}"
|
- "{{ remote_tmp_dir }}/{{ test_pkcs12_path }}"
|
||||||
- "{{ output_dir }}/{{ test_keystore_path }}"
|
- "{{ remote_tmp_dir }}/{{ test_keystore_path }}"
|
||||||
- "{{ test_keystore2_path }}"
|
- "{{ test_keystore2_path }}"
|
||||||
- "{{ test_cert_path }}"
|
- "{{ test_cert_path }}"
|
||||||
- "{{ test_key_path }}"
|
- "{{ test_key_path }}"
|
||||||
|
|
|
@ -239,13 +239,17 @@
|
||||||
- name: Copy the ssl server script
|
- name: Copy the ssl server script
|
||||||
copy:
|
copy:
|
||||||
src: "setupSSLServer.py"
|
src: "setupSSLServer.py"
|
||||||
dest: "{{ output_dir }}"
|
dest: "{{ remote_tmp_dir }}"
|
||||||
|
|
||||||
- name: Create an SSL server that we will use for testing URL imports
|
- name: Create an SSL server that we will use for testing URL imports
|
||||||
command: python {{ output_dir }}/setupSSLServer.py {{ output_dir }} {{ test_ssl_port }}
|
command: "{{ ansible_python.executable }} {{ remote_tmp_dir }}/setupSSLServer.py {{ remote_tmp_dir }} {{ test_ssl_port }}"
|
||||||
async: 10
|
async: 10
|
||||||
poll: 0
|
poll: 0
|
||||||
|
|
||||||
|
- name: "Wait for one second to make sure that the serve script has actually been started"
|
||||||
|
pause:
|
||||||
|
seconds: 1
|
||||||
|
|
||||||
- name: |
|
- name: |
|
||||||
Download the original cert.pem from our temporary server. The current cert should contain
|
Download the original cert.pem from our temporary server. The current cert should contain
|
||||||
cert2.pem. Importing this cert should return a status of changed
|
cert2.pem. Importing this cert should return a status of changed
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
- setup_java_keytool
|
- setup_java_keytool
|
||||||
- setup_openssl
|
- setup_openssl
|
||||||
|
- setup_remote_tmp_dir
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
---
|
---
|
||||||
- name: Create test directory
|
- name: Create test directory
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ output_dir }}"
|
path: "{{ remote_tmp_dir }}"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: Create private keys
|
- name: Create private keys
|
||||||
community.crypto.openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: "{{ output_dir ~ '/' ~ (item.keyname | default(item.name)) ~ '.key' }}"
|
path: "{{ remote_tmp_dir ~ '/' ~ (item.keyname | default(item.name)) ~ '.key' }}"
|
||||||
size: 2048 # this should work everywhere
|
size: 2048 # this should work everywhere
|
||||||
# The following is more efficient, but might not work everywhere:
|
# The following is more efficient, but might not work everywhere:
|
||||||
# type: ECC
|
# type: ECC
|
||||||
|
@ -17,17 +17,17 @@
|
||||||
|
|
||||||
- name: Create CSRs
|
- name: Create CSRs
|
||||||
community.crypto.openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: "{{ output_dir ~ '/' ~ item.name ~ '.csr' }}"
|
path: "{{ remote_tmp_dir ~ '/' ~ item.name ~ '.csr' }}"
|
||||||
privatekey_path: "{{ output_dir ~ '/' ~ (item.keyname | default(item.name)) ~ '.key' }}"
|
privatekey_path: "{{ remote_tmp_dir ~ '/' ~ (item.keyname | default(item.name)) ~ '.key' }}"
|
||||||
privatekey_passphrase: "{{ item.passphrase | default(omit) }}"
|
privatekey_passphrase: "{{ item.passphrase | default(omit) }}"
|
||||||
commonName: "{{ item.commonName }}"
|
commonName: "{{ item.commonName }}"
|
||||||
loop: "{{ java_keystore_certs + java_keystore_new_certs }}"
|
loop: "{{ java_keystore_certs + java_keystore_new_certs }}"
|
||||||
|
|
||||||
- name: Create certificates
|
- name: Create certificates
|
||||||
community.crypto.x509_certificate:
|
community.crypto.x509_certificate:
|
||||||
path: "{{ output_dir ~ '/' ~ item.name ~ '.pem' }}"
|
path: "{{ remote_tmp_dir ~ '/' ~ item.name ~ '.pem' }}"
|
||||||
csr_path: "{{ output_dir ~ '/' ~ item.name ~ '.csr' }}"
|
csr_path: "{{ remote_tmp_dir ~ '/' ~ item.name ~ '.csr' }}"
|
||||||
privatekey_path: "{{ output_dir ~ '/' ~ (item.keyname | default(item.name)) ~ '.key' }}"
|
privatekey_path: "{{ remote_tmp_dir ~ '/' ~ (item.keyname | default(item.name)) ~ '.key' }}"
|
||||||
privatekey_passphrase: "{{ item.passphrase | default(omit) }}"
|
privatekey_passphrase: "{{ item.passphrase | default(omit) }}"
|
||||||
provider: selfsigned
|
provider: selfsigned
|
||||||
loop: "{{ java_keystore_certs + java_keystore_new_certs }}"
|
loop: "{{ java_keystore_certs + java_keystore_new_certs }}"
|
||||||
|
|
|
@ -1,199 +1,273 @@
|
||||||
---
|
---
|
||||||
- name: Create test directory
|
- name: Create test directory
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ output_dir }}"
|
path: "{{ remote_tmp_dir }}"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: Ensure the Java keystore does not exist (cleanup between tests)
|
- name: Ensure the Java keystore does not exist (cleanup between tests)
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ output_dir ~ '/' ~ item.name ~ '.jks' }}"
|
path: "{{ remote_tmp_dir ~ '/' ~ item.name ~ '.jks' }}"
|
||||||
state: absent
|
state: absent
|
||||||
loop: "{{ java_keystore_certs }}"
|
loop: "{{ java_keystore_certs }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ output_dir ~ '/' ~ item.name ~ '.jks' }}"
|
label: "{{ remote_tmp_dir ~ '/' ~ item.name ~ '.jks' }}"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Read certificates
|
||||||
|
slurp:
|
||||||
|
src: "{{ remote_tmp_dir ~ '/' ~ item.name ~ '.pem' }}"
|
||||||
|
loop: "{{ java_keystore_certs }}"
|
||||||
|
when: not remote_cert
|
||||||
|
register: certificates
|
||||||
|
|
||||||
|
- name: Read certificate keys
|
||||||
|
slurp:
|
||||||
|
src: "{{ remote_tmp_dir ~ '/' ~ (item.keyname | d(item.name)) ~ '.key' }}"
|
||||||
|
loop: "{{ java_keystore_certs }}"
|
||||||
|
when: not remote_cert
|
||||||
|
register: certificate_keys
|
||||||
|
|
||||||
- name: Create a Java keystore for the given ({{ 'remote' if remote_cert else 'local' }}) certificates (check mode)
|
- name: Create a Java keystore for the given ({{ 'remote' if remote_cert else 'local' }}) certificates (check mode)
|
||||||
community.general.java_keystore: &java_keystore_params
|
community.general.java_keystore: &java_keystore_params
|
||||||
name: example
|
name: example
|
||||||
dest: "{{ output_dir ~ '/' ~ (item.keyname | d(item.name)) ~ '.jks' }}"
|
dest: "{{ remote_tmp_dir ~ '/' ~ (item.keyname | d(item.name)) ~ '.jks' }}"
|
||||||
certificate: "{{ omit if remote_cert else lookup('file', output_dir ~ '/' ~ item.name ~ '.pem') }}"
|
certificate: "{{ omit if remote_cert else (certificates.results[loop_index].content | b64decode) }}"
|
||||||
private_key: "{{ omit if remote_cert else lookup('file', output_dir ~ '/' ~ (item.keyname | d(item.name)) ~ '.key') }}"
|
private_key: "{{ omit if remote_cert else (certificate_keys.results[loop_index].content | b64decode) }}"
|
||||||
certificate_path: "{{ omit if not remote_cert else output_dir ~ '/' ~ item.name ~ '.pem' }}"
|
certificate_path: "{{ omit if not remote_cert else remote_tmp_dir ~ '/' ~ item.name ~ '.pem' }}"
|
||||||
private_key_path: "{{ omit if not remote_cert else output_dir ~ '/' ~ (item.keyname | d(item.name)) ~ '.key' }}"
|
private_key_path: "{{ omit if not remote_cert else remote_tmp_dir ~ '/' ~ (item.keyname | d(item.name)) ~ '.key' }}"
|
||||||
private_key_passphrase: "{{ item.passphrase | d(omit) }}"
|
private_key_passphrase: "{{ item.passphrase | d(omit) }}"
|
||||||
password: changeit
|
password: changeit
|
||||||
ssl_backend: "{{ ssl_backend }}"
|
ssl_backend: "{{ ssl_backend }}"
|
||||||
keystore_type: "{{ item.keystore_type | d(omit) }}"
|
keystore_type: "{{ item.keystore_type | d(omit) }}"
|
||||||
loop: "{{ java_keystore_certs }}"
|
loop: "{{ java_keystore_certs }}"
|
||||||
|
loop_control:
|
||||||
|
index_var: loop_index
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
register: result_check
|
register: result_check
|
||||||
|
|
||||||
- name: Create a Java keystore for the given certificates
|
- name: Create a Java keystore for the given certificates
|
||||||
community.general.java_keystore: *java_keystore_params
|
community.general.java_keystore: *java_keystore_params
|
||||||
loop: "{{ java_keystore_certs }}"
|
loop: "{{ java_keystore_certs }}"
|
||||||
|
loop_control:
|
||||||
|
index_var: loop_index
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
|
|
||||||
- name: Create a Java keystore for the given certificates (idempotency, check mode)
|
- name: Create a Java keystore for the given certificates (idempotency, check mode)
|
||||||
community.general.java_keystore: *java_keystore_params
|
community.general.java_keystore: *java_keystore_params
|
||||||
loop: "{{ java_keystore_certs }}"
|
loop: "{{ java_keystore_certs }}"
|
||||||
|
loop_control:
|
||||||
|
index_var: loop_index
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
register: result_idem_check
|
register: result_idem_check
|
||||||
|
|
||||||
- name: Create a Java keystore for the given certificates (idempotency)
|
- name: Create a Java keystore for the given certificates (idempotency)
|
||||||
community.general.java_keystore: *java_keystore_params
|
community.general.java_keystore: *java_keystore_params
|
||||||
loop: "{{ java_keystore_certs }}"
|
loop: "{{ java_keystore_certs }}"
|
||||||
|
loop_control:
|
||||||
|
index_var: loop_index
|
||||||
register: result_idem
|
register: result_idem
|
||||||
|
|
||||||
|
|
||||||
- name: Create a Java keystore for the given certificates (certificate changed, check mode)
|
- name: Read certificates (new)
|
||||||
community.general.java_keystore: *java_keystore_params
|
slurp:
|
||||||
|
src: "{{ remote_tmp_dir ~ '/' ~ item.name ~ '.pem' }}"
|
||||||
loop: "{{ java_keystore_new_certs }}"
|
loop: "{{ java_keystore_new_certs }}"
|
||||||
|
when: not remote_cert
|
||||||
|
register: certificates_new
|
||||||
|
|
||||||
|
- name: Read certificate keys (new)
|
||||||
|
slurp:
|
||||||
|
src: "{{ remote_tmp_dir ~ '/' ~ (item.keyname | d(item.name)) ~ '.key' }}"
|
||||||
|
loop: "{{ java_keystore_new_certs }}"
|
||||||
|
when: not remote_cert
|
||||||
|
register: certificate_keys_new
|
||||||
|
|
||||||
|
- name: Create a Java keystore for the given certificates (certificate changed, check mode)
|
||||||
|
community.general.java_keystore: &java_keystore_params_new_certs
|
||||||
|
name: example
|
||||||
|
dest: "{{ remote_tmp_dir ~ '/' ~ (item.keyname | d(item.name)) ~ '.jks' }}"
|
||||||
|
certificate: "{{ omit if remote_cert else (certificates_new.results[loop_index].content | b64decode) }}"
|
||||||
|
private_key: "{{ omit if remote_cert else (certificate_keys_new.results[loop_index].content | b64decode) }}"
|
||||||
|
certificate_path: "{{ omit if not remote_cert else remote_tmp_dir ~ '/' ~ item.name ~ '.pem' }}"
|
||||||
|
private_key_path: "{{ omit if not remote_cert else remote_tmp_dir ~ '/' ~ (item.keyname | d(item.name)) ~ '.key' }}"
|
||||||
|
private_key_passphrase: "{{ item.passphrase | d(omit) }}"
|
||||||
|
password: changeit
|
||||||
|
ssl_backend: "{{ ssl_backend }}"
|
||||||
|
keystore_type: "{{ item.keystore_type | d(omit) }}"
|
||||||
|
loop: "{{ java_keystore_new_certs }}"
|
||||||
|
loop_control:
|
||||||
|
index_var: loop_index
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
register: result_change_check
|
register: result_change_check
|
||||||
|
|
||||||
- name: Create a Java keystore for the given certificates (certificate changed)
|
- name: Create a Java keystore for the given certificates (certificate changed)
|
||||||
community.general.java_keystore: *java_keystore_params
|
community.general.java_keystore: *java_keystore_params_new_certs
|
||||||
loop: "{{ java_keystore_new_certs }}"
|
loop: "{{ java_keystore_new_certs }}"
|
||||||
|
loop_control:
|
||||||
|
index_var: loop_index
|
||||||
register: result_change
|
register: result_change
|
||||||
|
|
||||||
|
|
||||||
- name: Create a Java keystore for the given certificates (alias changed, check mode)
|
- name: Create a Java keystore for the given certificates (alias changed, check mode)
|
||||||
community.general.java_keystore:
|
community.general.java_keystore:
|
||||||
<<: *java_keystore_params
|
<<: *java_keystore_params_new_certs
|
||||||
name: foobar
|
name: foobar
|
||||||
loop: "{{ java_keystore_new_certs }}"
|
loop: "{{ java_keystore_new_certs }}"
|
||||||
|
loop_control:
|
||||||
|
index_var: loop_index
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
register: result_alias_change_check
|
register: result_alias_change_check
|
||||||
|
|
||||||
- name: Create a Java keystore for the given certificates (alias changed)
|
- name: Create a Java keystore for the given certificates (alias changed)
|
||||||
community.general.java_keystore:
|
community.general.java_keystore:
|
||||||
<<: *java_keystore_params
|
<<: *java_keystore_params_new_certs
|
||||||
name: foobar
|
name: foobar
|
||||||
loop: "{{ java_keystore_new_certs }}"
|
loop: "{{ java_keystore_new_certs }}"
|
||||||
|
loop_control:
|
||||||
|
index_var: loop_index
|
||||||
register: result_alias_change
|
register: result_alias_change
|
||||||
|
|
||||||
|
|
||||||
- name: Create a Java keystore for the given certificates (password changed, check mode)
|
- name: Create a Java keystore for the given certificates (password changed, check mode)
|
||||||
community.general.java_keystore:
|
community.general.java_keystore:
|
||||||
<<: *java_keystore_params
|
<<: *java_keystore_params_new_certs
|
||||||
name: foobar
|
name: foobar
|
||||||
password: hunter2
|
password: hunter2
|
||||||
loop: "{{ java_keystore_new_certs }}"
|
loop: "{{ java_keystore_new_certs }}"
|
||||||
|
loop_control:
|
||||||
|
index_var: loop_index
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
register: result_pw_change_check
|
register: result_pw_change_check
|
||||||
|
|
||||||
- name: Create a Java keystore for the given certificates (password changed)
|
- name: Create a Java keystore for the given certificates (password changed)
|
||||||
community.general.java_keystore:
|
community.general.java_keystore:
|
||||||
<<: *java_keystore_params
|
<<: *java_keystore_params_new_certs
|
||||||
name: foobar
|
name: foobar
|
||||||
password: hunter2
|
password: hunter2
|
||||||
loop: "{{ java_keystore_new_certs }}"
|
loop: "{{ java_keystore_new_certs }}"
|
||||||
|
loop_control:
|
||||||
|
index_var: loop_index
|
||||||
register: result_pw_change
|
register: result_pw_change
|
||||||
|
|
||||||
|
|
||||||
- name: Create a Java keystore for the given certificates (force keystore type pkcs12, check mode)
|
- name: Create a Java keystore for the given certificates (force keystore type pkcs12, check mode)
|
||||||
community.general.java_keystore:
|
community.general.java_keystore:
|
||||||
<<: *java_keystore_params
|
<<: *java_keystore_params_new_certs
|
||||||
name: foobar
|
name: foobar
|
||||||
password: hunter2
|
password: hunter2
|
||||||
keystore_type: pkcs12
|
keystore_type: pkcs12
|
||||||
loop: "{{ java_keystore_new_certs }}"
|
loop: "{{ java_keystore_new_certs }}"
|
||||||
|
loop_control:
|
||||||
|
index_var: loop_index
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
register: result_type_pkcs12_check
|
register: result_type_pkcs12_check
|
||||||
|
|
||||||
- name: Create a Java keystore for the given certificates (force keystore type jks, check mode)
|
- name: Create a Java keystore for the given certificates (force keystore type jks, check mode)
|
||||||
community.general.java_keystore:
|
community.general.java_keystore:
|
||||||
<<: *java_keystore_params
|
<<: *java_keystore_params_new_certs
|
||||||
name: foobar
|
name: foobar
|
||||||
password: hunter2
|
password: hunter2
|
||||||
keystore_type: jks
|
keystore_type: jks
|
||||||
loop: "{{ java_keystore_new_certs }}"
|
loop: "{{ java_keystore_new_certs }}"
|
||||||
|
loop_control:
|
||||||
|
index_var: loop_index
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
register: result_type_jks_check
|
register: result_type_jks_check
|
||||||
|
|
||||||
- name: Create a Java keystore for the given certificates (force keystore type jks)
|
- name: Create a Java keystore for the given certificates (force keystore type jks)
|
||||||
community.general.java_keystore:
|
community.general.java_keystore:
|
||||||
<<: *java_keystore_params
|
<<: *java_keystore_params_new_certs
|
||||||
name: foobar
|
name: foobar
|
||||||
password: hunter2
|
password: hunter2
|
||||||
keystore_type: jks
|
keystore_type: jks
|
||||||
loop: "{{ java_keystore_new_certs }}"
|
loop: "{{ java_keystore_new_certs }}"
|
||||||
|
loop_control:
|
||||||
|
index_var: loop_index
|
||||||
register: result_type_jks
|
register: result_type_jks
|
||||||
|
|
||||||
|
|
||||||
- name: Stat keystore (before failure)
|
- name: Stat keystore (before failure)
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
path: "{{ output_dir ~ '/' ~ (item.keyname | d(item.name)) ~ '.jks' }}"
|
path: "{{ remote_tmp_dir ~ '/' ~ (item.keyname | d(item.name)) ~ '.jks' }}"
|
||||||
loop: "{{ java_keystore_new_certs }}"
|
loop: "{{ java_keystore_new_certs }}"
|
||||||
register: result_stat_before
|
register: result_stat_before
|
||||||
|
|
||||||
- name: Fail to create a Java keystore for the given certificates (password too short)
|
- name: Fail to create a Java keystore for the given certificates (password too short)
|
||||||
community.general.java_keystore:
|
community.general.java_keystore:
|
||||||
<<: *java_keystore_params
|
<<: *java_keystore_params_new_certs
|
||||||
name: foobar
|
name: foobar
|
||||||
password: short
|
password: short
|
||||||
keystore_type: jks
|
keystore_type: jks
|
||||||
loop: "{{ java_keystore_new_certs }}"
|
loop: "{{ java_keystore_new_certs }}"
|
||||||
|
loop_control:
|
||||||
|
index_var: loop_index
|
||||||
register: result_fail_jks
|
register: result_fail_jks
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: Stat keystore (after failure)
|
- name: Stat keystore (after failure)
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
path: "{{ output_dir ~ '/' ~ (item.keyname | d(item.name)) ~ '.jks' }}"
|
path: "{{ remote_tmp_dir ~ '/' ~ (item.keyname | d(item.name)) ~ '.jks' }}"
|
||||||
loop: "{{ java_keystore_new_certs }}"
|
loop: "{{ java_keystore_new_certs }}"
|
||||||
register: result_stat_after
|
register: result_stat_after
|
||||||
|
|
||||||
|
|
||||||
- name: Create a Java keystore for the given certificates (keystore type changed, check mode)
|
- name: Create a Java keystore for the given certificates (keystore type changed, check mode)
|
||||||
community.general.java_keystore:
|
community.general.java_keystore:
|
||||||
<<: *java_keystore_params
|
<<: *java_keystore_params_new_certs
|
||||||
name: foobar
|
name: foobar
|
||||||
password: hunter2
|
password: hunter2
|
||||||
keystore_type: pkcs12
|
keystore_type: pkcs12
|
||||||
loop: "{{ java_keystore_new_certs }}"
|
loop: "{{ java_keystore_new_certs }}"
|
||||||
|
loop_control:
|
||||||
|
index_var: loop_index
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
register: result_type_change_check
|
register: result_type_change_check
|
||||||
|
|
||||||
- name: Create a Java keystore for the given certificates (keystore type changed)
|
- name: Create a Java keystore for the given certificates (keystore type changed)
|
||||||
community.general.java_keystore:
|
community.general.java_keystore:
|
||||||
<<: *java_keystore_params
|
<<: *java_keystore_params_new_certs
|
||||||
name: foobar
|
name: foobar
|
||||||
password: hunter2
|
password: hunter2
|
||||||
keystore_type: pkcs12
|
keystore_type: pkcs12
|
||||||
loop: "{{ java_keystore_new_certs }}"
|
loop: "{{ java_keystore_new_certs }}"
|
||||||
|
loop_control:
|
||||||
|
index_var: loop_index
|
||||||
register: result_type_change
|
register: result_type_change
|
||||||
|
|
||||||
|
|
||||||
- name: Create a Java keystore for the given certificates (omit keystore type, check mode)
|
- name: Create a Java keystore for the given certificates (omit keystore type, check mode)
|
||||||
community.general.java_keystore:
|
community.general.java_keystore:
|
||||||
<<: *java_keystore_params
|
<<: *java_keystore_params_new_certs
|
||||||
name: foobar
|
name: foobar
|
||||||
password: hunter2
|
password: hunter2
|
||||||
loop: "{{ java_keystore_new_certs }}"
|
loop: "{{ java_keystore_new_certs }}"
|
||||||
|
loop_control:
|
||||||
|
index_var: loop_index
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
register: result_type_omit_check
|
register: result_type_omit_check
|
||||||
|
|
||||||
- name: Create a Java keystore for the given certificates (omit keystore type)
|
- name: Create a Java keystore for the given certificates (omit keystore type)
|
||||||
community.general.java_keystore:
|
community.general.java_keystore:
|
||||||
<<: *java_keystore_params
|
<<: *java_keystore_params_new_certs
|
||||||
name: foobar
|
name: foobar
|
||||||
password: hunter2
|
password: hunter2
|
||||||
loop: "{{ java_keystore_new_certs }}"
|
loop: "{{ java_keystore_new_certs }}"
|
||||||
|
loop_control:
|
||||||
|
index_var: loop_index
|
||||||
register: result_type_omit
|
register: result_type_omit
|
||||||
|
|
||||||
|
|
||||||
- name: Check that the remote certificates have not been removed
|
- name: Check that the remote certificates have not been removed
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ output_dir ~ '/' ~ item.name ~ '.pem' }}"
|
path: "{{ remote_tmp_dir ~ '/' ~ item.name ~ '.pem' }}"
|
||||||
state: file
|
state: file
|
||||||
loop: "{{ java_keystore_certs + java_keystore_new_certs }}"
|
loop: "{{ java_keystore_certs + java_keystore_new_certs }}"
|
||||||
when: remote_cert
|
when: remote_cert
|
||||||
|
|
||||||
- name: Check that the remote private keys have not been removed
|
- name: Check that the remote private keys have not been removed
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ output_dir ~ '/' ~ item.name ~ '.key' }}"
|
path: "{{ remote_tmp_dir ~ '/' ~ item.name ~ '.key' }}"
|
||||||
state: file
|
state: file
|
||||||
loop: "{{ java_keystore_certs }}"
|
loop: "{{ java_keystore_certs }}"
|
||||||
when: remote_cert
|
when: remote_cert
|
||||||
|
|
2
tests/integration/targets/mail/meta/main.yml
Normal file
2
tests/integration/targets/mail/meta/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
dependencies:
|
||||||
|
- setup_remote_tmp_dir
|
|
@ -16,7 +16,7 @@
|
||||||
- name: Install test smtpserver
|
- name: Install test smtpserver
|
||||||
copy:
|
copy:
|
||||||
src: '{{ item }}'
|
src: '{{ item }}'
|
||||||
dest: '{{ output_dir }}/{{ item }}'
|
dest: '{{ remote_tmp_dir }}/{{ item }}'
|
||||||
loop:
|
loop:
|
||||||
- smtpserver.py
|
- smtpserver.py
|
||||||
- smtpserver.crt
|
- smtpserver.crt
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
# FIXME: Verify the mail after it was send would be nice
|
# FIXME: Verify the mail after it was send would be nice
|
||||||
# This would require either dumping the content, or registering async task output
|
# This would require either dumping the content, or registering async task output
|
||||||
- name: Start test smtpserver
|
- name: Start test smtpserver
|
||||||
shell: '{{ ansible_python.executable }} {{ output_dir }}/smtpserver.py 10025:10465'
|
shell: '{{ ansible_python.executable }} {{ remote_tmp_dir }}/smtpserver.py 10025:10465'
|
||||||
async: 30
|
async: 30
|
||||||
poll: 0
|
poll: 0
|
||||||
register: smtpserver
|
register: smtpserver
|
||||||
|
|
|
@ -2,3 +2,4 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
- setup_pkg_mgr
|
- setup_pkg_mgr
|
||||||
- setup_openssl
|
- setup_openssl
|
||||||
|
- setup_remote_tmp_dir
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
vars:
|
vars:
|
||||||
nomad_version: 0.12.4
|
nomad_version: 0.12.4
|
||||||
nomad_uri: https://releases.hashicorp.com/nomad/{{ nomad_version }}/nomad_{{ nomad_version }}_{{ ansible_system | lower }}_{{ nomad_arch }}.zip
|
nomad_uri: https://releases.hashicorp.com/nomad/{{ nomad_version }}/nomad_{{ nomad_version }}_{{ ansible_system | lower }}_{{ nomad_arch }}.zip
|
||||||
nomad_cmd: '{{ output_dir }}/nomad'
|
nomad_cmd: '{{ remote_tmp_dir }}/nomad'
|
||||||
block:
|
block:
|
||||||
|
|
||||||
- name: register pyOpenSSL version
|
- name: register pyOpenSSL version
|
||||||
|
@ -36,21 +36,21 @@
|
||||||
block:
|
block:
|
||||||
- name: Generate privatekey
|
- name: Generate privatekey
|
||||||
community.crypto.openssl_privatekey:
|
community.crypto.openssl_privatekey:
|
||||||
path: '{{ output_dir }}/privatekey.pem'
|
path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
|
|
||||||
- name: Generate CSR
|
- name: Generate CSR
|
||||||
community.crypto.openssl_csr:
|
community.crypto.openssl_csr:
|
||||||
path: '{{ output_dir }}/csr.csr'
|
path: '{{ remote_tmp_dir }}/csr.csr'
|
||||||
privatekey_path: '{{ output_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
subject:
|
subject:
|
||||||
commonName: localhost
|
commonName: localhost
|
||||||
|
|
||||||
- name: Generate selfsigned certificate
|
- name: Generate selfsigned certificate
|
||||||
register: selfsigned_certificate
|
register: selfsigned_certificate
|
||||||
community.crypto.openssl_certificate:
|
community.crypto.openssl_certificate:
|
||||||
path: '{{ output_dir }}/cert.pem'
|
path: '{{ remote_tmp_dir }}/cert.pem'
|
||||||
csr_path: '{{ output_dir }}/csr.csr'
|
csr_path: '{{ remote_tmp_dir }}/csr.csr'
|
||||||
privatekey_path: '{{ output_dir }}/privatekey.pem'
|
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
|
||||||
provider: selfsigned
|
provider: selfsigned
|
||||||
selfsigned_digest: sha256
|
selfsigned_digest: sha256
|
||||||
|
|
||||||
|
@ -75,17 +75,17 @@
|
||||||
- name: Download nomad binary
|
- name: Download nomad binary
|
||||||
unarchive:
|
unarchive:
|
||||||
src: '{{ nomad_uri }}'
|
src: '{{ nomad_uri }}'
|
||||||
dest: '{{ output_dir }}'
|
dest: '{{ remote_tmp_dir }}'
|
||||||
remote_src: true
|
remote_src: true
|
||||||
register: result
|
register: result
|
||||||
until: result is success
|
until: result is success
|
||||||
|
|
||||||
- vars:
|
- vars:
|
||||||
remote_dir: '{{ echo_output_dir.stdout }}'
|
remote_dir: '{{ echo_remote_tmp_dir.stdout }}'
|
||||||
block:
|
block:
|
||||||
|
|
||||||
- command: echo {{ output_dir }}
|
- command: echo {{ remote_tmp_dir }}
|
||||||
register: echo_output_dir
|
register: echo_remote_tmp_dir
|
||||||
|
|
||||||
- name: Run tests integration
|
- name: Run tests integration
|
||||||
block:
|
block:
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
- setup_pkg_mgr
|
- setup_pkg_mgr
|
||||||
- setup_gnutar
|
- setup_gnutar
|
||||||
|
- setup_remote_tmp_dir
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
# Setup steps
|
# Setup steps
|
||||||
|
|
||||||
# expand remote path
|
# expand remote path
|
||||||
- command: 'echo {{ output_dir }}'
|
- command: 'echo {{ remote_tmp_dir }}'
|
||||||
register: echo
|
register: echo
|
||||||
- set_fact:
|
- set_fact:
|
||||||
remote_dir: '{{ echo.stdout }}'
|
remote_dir: '{{ echo.stdout }}'
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
- name: 'Download NPM'
|
- name: 'Download NPM'
|
||||||
unarchive:
|
unarchive:
|
||||||
src: 'https://ansible-ci-files.s3.amazonaws.com/test/integration/targets/npm/{{ nodejs_path }}.tar.gz'
|
src: 'https://ansible-ci-files.s3.amazonaws.com/test/integration/targets/npm/{{ nodejs_path }}.tar.gz'
|
||||||
dest: '{{ output_dir }}'
|
dest: '{{ remote_tmp_dir }}'
|
||||||
remote_src: yes
|
remote_src: yes
|
||||||
creates: '{{ output_dir }}/{{ nodejs_path }}.tar.gz'
|
creates: '{{ remote_tmp_dir }}/{{ nodejs_path }}.tar.gz'
|
||||||
|
|
2
tests/integration/targets/pids/meta/main.yml
Normal file
2
tests/integration/targets/pids/meta/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
dependencies:
|
||||||
|
- setup_remote_tmp_dir
|
|
@ -31,13 +31,21 @@
|
||||||
register: find_sleep
|
register: find_sleep
|
||||||
|
|
||||||
- name: "Copying 'sleep' binary"
|
- name: "Copying 'sleep' binary"
|
||||||
|
command: cp {{ find_sleep.stdout }} {{ remote_tmp_dir }}/{{ random_name }}
|
||||||
|
# The following does not work on macOS 11.1 (it uses shutil.copystat, and that will die with a PermissionError):
|
||||||
|
# copy:
|
||||||
|
# src: "{{ find_sleep.stdout }}"
|
||||||
|
# dest: "{{ remote_tmp_dir }}/{{ random_name }}"
|
||||||
|
# mode: "0777"
|
||||||
|
# remote_src: true
|
||||||
|
|
||||||
|
- name: Copy helper script
|
||||||
copy:
|
copy:
|
||||||
src: "{{ find_sleep.stdout }}"
|
src: obtainpid.sh
|
||||||
dest: "{{ output_dir }}/{{ random_name }}"
|
dest: "{{ remote_tmp_dir }}/obtainpid.sh"
|
||||||
mode: "0777"
|
|
||||||
|
|
||||||
- name: "Running the copy of 'sleep' binary"
|
- name: "Running the copy of 'sleep' binary"
|
||||||
command: "sh {{ role_path }}/files/obtainpid.sh '{{ output_dir }}/{{ random_name }}' '{{ output_dir }}/obtainpid.txt'"
|
command: "sh {{ remote_tmp_dir }}/obtainpid.sh '{{ remote_tmp_dir }}/{{ random_name }}' '{{ remote_tmp_dir }}/obtainpid.txt'"
|
||||||
|
|
||||||
async: 100
|
async: 100
|
||||||
poll: 0
|
poll: 0
|
||||||
|
@ -74,7 +82,7 @@
|
||||||
|
|
||||||
- name: "Reading pid from the file"
|
- name: "Reading pid from the file"
|
||||||
slurp:
|
slurp:
|
||||||
src: "{{ output_dir }}/obtainpid.txt"
|
src: "{{ remote_tmp_dir }}/obtainpid.txt"
|
||||||
register: newpid
|
register: newpid
|
||||||
|
|
||||||
- name: "Verify that the Process IDs (PIDs) returned is not empty and also equal to the PIDs obtained in console"
|
- name: "Verify that the Process IDs (PIDs) returned is not empty and also equal to the PIDs obtained in console"
|
||||||
|
|
|
@ -33,6 +33,27 @@
|
||||||
extra_args: "-c {{ remote_constraints }}"
|
extra_args: "-c {{ remote_constraints }}"
|
||||||
when: ansible_os_family == 'Darwin'
|
when: ansible_os_family == 'Darwin'
|
||||||
|
|
||||||
|
- when: ansible_facts.distribution ~ ansible_facts.distribution_major_version not in ['CentOS6', 'RedHat6']
|
||||||
|
block:
|
||||||
|
- name: Install cryptography (Python 3)
|
||||||
|
become: true
|
||||||
|
package:
|
||||||
|
name: '{{ cryptography_package_name_python3 }}'
|
||||||
|
when: not ansible_os_family == 'Darwin' and ansible_python_version is version('3.0', '>=')
|
||||||
|
|
||||||
|
- name: Install cryptography (Python 2)
|
||||||
|
become: true
|
||||||
|
package:
|
||||||
|
name: '{{ cryptography_package_name }}'
|
||||||
|
when: not ansible_os_family == 'Darwin' and ansible_python_version is version('3.0', '<')
|
||||||
|
|
||||||
|
- name: Install cryptography (Darwin)
|
||||||
|
become: true
|
||||||
|
pip:
|
||||||
|
name: cryptography>=3.3
|
||||||
|
extra_args: "-c {{ remote_constraints }}"
|
||||||
|
when: ansible_os_family == 'Darwin'
|
||||||
|
|
||||||
- name: register pyOpenSSL version
|
- name: register pyOpenSSL version
|
||||||
command: "{{ ansible_python.executable }} -c 'import OpenSSL; print(OpenSSL.__version__)'"
|
command: "{{ ansible_python.executable }} -c 'import OpenSSL; print(OpenSSL.__version__)'"
|
||||||
register: pyopenssl_version
|
register: pyopenssl_version
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
cryptography_package_name: python-cryptography
|
||||||
|
cryptography_package_name_python3: python3-cryptography
|
||||||
pyopenssl_package_name: python-openssl
|
pyopenssl_package_name: python-openssl
|
||||||
pyopenssl_package_name_python3: python3-openssl
|
pyopenssl_package_name_python3: python3-openssl
|
||||||
openssl_package_name: openssl
|
openssl_package_name: openssl
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
cryptography_package_name: py27-cryptography
|
||||||
|
cryptography_package_name_python3: "py{{ ansible_python.version.major }}{{ ansible_python.version.minor }}-cryptography"
|
||||||
pyopenssl_package_name: py27-openssl
|
pyopenssl_package_name: py27-openssl
|
||||||
pyopenssl_package_name_python3: "py{{ ansible_python.version.major }}{{ ansible_python.version.minor }}-openssl"
|
pyopenssl_package_name_python3: "py{{ ansible_python.version.major }}{{ ansible_python.version.minor }}-openssl"
|
||||||
openssl_package_name: openssl
|
openssl_package_name: openssl
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
cryptography_package_name: python-cryptography
|
||||||
|
cryptography_package_name_python3: python3-cryptography
|
||||||
pyopenssl_package_name: pyOpenSSL
|
pyopenssl_package_name: pyOpenSSL
|
||||||
pyopenssl_package_name_python3: python3-pyOpenSSL
|
pyopenssl_package_name_python3: python3-pyOpenSSL
|
||||||
openssl_package_name: openssl
|
openssl_package_name: openssl
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
cryptography_package_name: python-cryptography
|
||||||
|
cryptography_package_name_python3: python3-cryptography
|
||||||
pyopenssl_package_name: python-pyOpenSSL
|
pyopenssl_package_name: python-pyOpenSSL
|
||||||
pyopenssl_package_name_python3: python3-pyOpenSSL
|
pyopenssl_package_name_python3: python3-pyOpenSSL
|
||||||
openssl_package_name: openssl
|
openssl_package_name: openssl
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
- setup_remote_constraints
|
- setup_remote_constraints
|
||||||
|
- setup_remote_tmp_dir
|
||||||
|
|
|
@ -9,15 +9,15 @@
|
||||||
extra_args: "-c {{ remote_constraints }}"
|
extra_args: "-c {{ remote_constraints }}"
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
output_dir_test: '{{ output_dir }}/test_ssh_config'
|
output_test_dir: '{{ remote_tmp_dir }}/test_ssh_config'
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
ssh_config_test: '{{ output_dir_test }}/ssh_config_test'
|
ssh_config_test: '{{ output_test_dir }}/ssh_config_test'
|
||||||
ssh_private_key: '{{ output_dir_test }}/fake_id_rsa'
|
ssh_private_key: '{{ output_test_dir }}/fake_id_rsa'
|
||||||
|
|
||||||
- name: create a temporary directory
|
- name: create a temporary directory
|
||||||
file:
|
file:
|
||||||
path: "{{ output_dir_test }}"
|
path: "{{ output_test_dir }}"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: Copy sample config file
|
- name: Copy sample config file
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
- setup_pkg_mgr
|
- setup_pkg_mgr
|
||||||
|
- setup_remote_tmp_dir
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
suffix: supervisorctl-tests
|
suffix: supervisorctl-tests
|
||||||
register: supervisord_sock_path
|
register: supervisord_sock_path
|
||||||
|
|
||||||
- command: 'echo {{ output_dir }}'
|
- command: 'echo {{ remote_tmp_dir }}'
|
||||||
register: echo
|
register: echo
|
||||||
- set_fact:
|
- set_fact:
|
||||||
remote_dir: '{{ echo.stdout }}'
|
remote_dir: '{{ echo.stdout }}'
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
non_local
|
|
||||||
needs/root
|
|
||||||
unsupported
|
|
|
@ -1 +0,0 @@
|
||||||
buildah-container ansible_host=buildah-container ansible_connection=buildah
|
|
|
@ -1 +0,0 @@
|
||||||
abnormal content
|
|
|
@ -1,71 +0,0 @@
|
||||||
####################################################################
|
|
||||||
# WARNING: These are designed specifically for Ansible tests #
|
|
||||||
# and should not be used as examples of how to write Ansible roles #
|
|
||||||
####################################################################
|
|
||||||
|
|
||||||
# test code for the synchronize module
|
|
||||||
# (c) 2014, James Tanner <tanner.jc@gmail.com>
|
|
||||||
|
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
- name: cleanup old files
|
|
||||||
file:
|
|
||||||
path: '{{ output_dir }}'
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
- name: ensure the target directory exists
|
|
||||||
file:
|
|
||||||
path: '{{ output_dir }}'
|
|
||||||
state: directory
|
|
||||||
|
|
||||||
- name: synchronize file to new filename
|
|
||||||
synchronize:
|
|
||||||
src: normal_file.txt
|
|
||||||
dest: '{{ output_dir }}/remote_file.txt'
|
|
||||||
register: sync_result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "'changed' in sync_result"
|
|
||||||
- sync_result is changed
|
|
||||||
- "'cmd' in sync_result"
|
|
||||||
- "'rsync' in sync_result.cmd"
|
|
||||||
- "'msg' in sync_result"
|
|
||||||
- "sync_result.msg.startswith('<f+')"
|
|
||||||
- "sync_result.msg.endswith('+ normal_file.txt\n')"
|
|
||||||
|
|
||||||
- name: test that the file was really copied over
|
|
||||||
stat:
|
|
||||||
path: "{{ output_dir }}/remote_file.txt"
|
|
||||||
register: stat_result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "stat_result.stat.exists == True"
|
|
||||||
- "stat_result.stat.checksum == '4f11fb5cd9fe0171ea6fab02ae33f65138f3e44e'"
|
|
||||||
|
|
||||||
- name: test that the file is not copied a second time
|
|
||||||
synchronize: src=normal_file.txt dest={{output_dir}}/remote_file.txt
|
|
||||||
register: sync_result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- sync_result is not changed
|
|
||||||
|
|
||||||
- name: cleanup old files
|
|
||||||
file:
|
|
||||||
path: '{{ output_dir }}'
|
|
||||||
state: absent
|
|
|
@ -1,15 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -ux
|
|
||||||
|
|
||||||
CONTAINER_NAME=buildah-container
|
|
||||||
|
|
||||||
buildah rm $CONTAINER_NAME >/dev/null 2>/dev/null
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
buildah from --name $CONTAINER_NAME docker.io/library/centos:7
|
|
||||||
trap '{ buildah rm $CONTAINER_NAME; }' EXIT
|
|
||||||
buildah run $CONTAINER_NAME -- yum install -y rsync
|
|
||||||
|
|
||||||
ansible-playbook test_synchronize_buildah.yml -c buildah -i inventory -vv
|
|
|
@ -1,8 +0,0 @@
|
||||||
---
|
|
||||||
- hosts: buildah-container
|
|
||||||
connection: buildah
|
|
||||||
gather_facts: no
|
|
||||||
vars:
|
|
||||||
output_dir: /tmp/ansible_test_synchronize_buildah
|
|
||||||
roles:
|
|
||||||
- test_buildah_synchronize
|
|
|
@ -1 +1 @@
|
||||||
test_file: "{{ output_dir }}/foo.txt"
|
test_file: "{{ remote_tmp_dir }}/foo.txt"
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
- setup_pkg_mgr
|
- setup_pkg_mgr
|
||||||
|
- setup_remote_tmp_dir
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
- setup_pkg_mgr
|
- setup_pkg_mgr
|
||||||
- setup_gnutar
|
- setup_gnutar
|
||||||
|
- setup_remote_tmp_dir
|
||||||
|
|
|
@ -6,31 +6,31 @@
|
||||||
- name: 'Download Nodejs'
|
- name: 'Download Nodejs'
|
||||||
unarchive:
|
unarchive:
|
||||||
src: 'https://ansible-ci-files.s3.amazonaws.com/test/integration/targets/yarn/{{ nodejs_path }}.tar.gz'
|
src: 'https://ansible-ci-files.s3.amazonaws.com/test/integration/targets/yarn/{{ nodejs_path }}.tar.gz'
|
||||||
dest: '{{ output_dir }}'
|
dest: '{{ remote_tmp_dir }}'
|
||||||
remote_src: yes
|
remote_src: yes
|
||||||
creates: '{{ output_dir }}/{{ nodejs_path }}.tar.gz'
|
creates: '{{ remote_tmp_dir }}/{{ nodejs_path }}.tar.gz'
|
||||||
|
|
||||||
- name: 'Download Yarn'
|
- name: 'Download Yarn'
|
||||||
unarchive:
|
unarchive:
|
||||||
src: 'https://ansible-ci-files.s3.amazonaws.com/test/integration/targets/yarn/yarn-v{{yarn_version}}.tar.gz'
|
src: 'https://ansible-ci-files.s3.amazonaws.com/test/integration/targets/yarn/yarn-v{{yarn_version}}.tar.gz'
|
||||||
dest: '{{ output_dir }}'
|
dest: '{{ remote_tmp_dir }}'
|
||||||
remote_src: yes
|
remote_src: yes
|
||||||
creates: '{{ output_dir }}/yarn-v{{yarn_version}}_pkg.tar.gz'
|
creates: '{{ remote_tmp_dir }}/yarn-v{{yarn_version}}_pkg.tar.gz'
|
||||||
|
|
||||||
- name: 'Copy node to directory created earlier'
|
- name: 'Copy node to directory created earlier'
|
||||||
command: "mv {{ output_dir }}/{{ nodejs_path }} /usr/local/lib/nodejs/{{nodejs_path}}"
|
command: "mv {{ remote_tmp_dir }}/{{ nodejs_path }} /usr/local/lib/nodejs/{{nodejs_path}}"
|
||||||
|
|
||||||
# Clean up before running tests
|
# Clean up before running tests
|
||||||
- name: Remove any previous Nodejs modules
|
- name: Remove any previous Nodejs modules
|
||||||
file:
|
file:
|
||||||
path: '{{output_dir}}/node_modules'
|
path: '{{remote_tmp_dir}}/node_modules'
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
# Set vars for our test harness
|
# Set vars for our test harness
|
||||||
- vars:
|
- vars:
|
||||||
#node_bin_path: "/usr/local/lib/nodejs/node-v{{nodejs_version}}/bin"
|
#node_bin_path: "/usr/local/lib/nodejs/node-v{{nodejs_version}}/bin"
|
||||||
node_bin_path: "/usr/local/lib/nodejs/{{ nodejs_path }}/bin"
|
node_bin_path: "/usr/local/lib/nodejs/{{ nodejs_path }}/bin"
|
||||||
yarn_bin_path: "{{ output_dir }}/yarn-v{{ yarn_version }}/bin"
|
yarn_bin_path: "{{ remote_tmp_dir }}/yarn-v{{ yarn_version }}/bin"
|
||||||
package: 'iconv-lite'
|
package: 'iconv-lite'
|
||||||
environment:
|
environment:
|
||||||
PATH: "{{ node_bin_path }}:{{ansible_env.PATH}}"
|
PATH: "{{ node_bin_path }}:{{ansible_env.PATH}}"
|
||||||
|
@ -45,11 +45,11 @@
|
||||||
- name: 'Create dummy package.json'
|
- name: 'Create dummy package.json'
|
||||||
copy:
|
copy:
|
||||||
src: templates/package.j2
|
src: templates/package.j2
|
||||||
dest: '{{ output_dir }}/package.json'
|
dest: '{{ remote_tmp_dir }}/package.json'
|
||||||
|
|
||||||
- name: 'Install all packages.'
|
- name: 'Install all packages.'
|
||||||
yarn:
|
yarn:
|
||||||
path: '{{ output_dir }}'
|
path: '{{ remote_tmp_dir }}'
|
||||||
executable: '{{ yarn_bin_path }}/yarn'
|
executable: '{{ yarn_bin_path }}/yarn'
|
||||||
state: present
|
state: present
|
||||||
environment:
|
environment:
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
|
|
||||||
- name: 'Install the same package from package.json again.'
|
- name: 'Install the same package from package.json again.'
|
||||||
yarn:
|
yarn:
|
||||||
path: '{{ output_dir }}'
|
path: '{{ remote_tmp_dir }}'
|
||||||
executable: '{{ yarn_bin_path }}/yarn'
|
executable: '{{ yarn_bin_path }}/yarn'
|
||||||
name: '{{ package }}'
|
name: '{{ package }}'
|
||||||
state: present
|
state: present
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
|
|
||||||
- name: 'Install all packages in check mode.'
|
- name: 'Install all packages in check mode.'
|
||||||
yarn:
|
yarn:
|
||||||
path: '{{ output_dir }}'
|
path: '{{ remote_tmp_dir }}'
|
||||||
executable: '{{ yarn_bin_path }}/yarn'
|
executable: '{{ yarn_bin_path }}/yarn'
|
||||||
state: present
|
state: present
|
||||||
environment:
|
environment:
|
||||||
|
@ -89,7 +89,7 @@
|
||||||
|
|
||||||
- name: 'Install package with explicit version (older version of package)'
|
- name: 'Install package with explicit version (older version of package)'
|
||||||
yarn:
|
yarn:
|
||||||
path: '{{ output_dir }}'
|
path: '{{ remote_tmp_dir }}'
|
||||||
executable: '{{ yarn_bin_path }}/yarn'
|
executable: '{{ yarn_bin_path }}/yarn'
|
||||||
name: left-pad
|
name: left-pad
|
||||||
version: 1.1.0
|
version: 1.1.0
|
||||||
|
@ -104,7 +104,7 @@
|
||||||
|
|
||||||
- name: 'Upgrade old package'
|
- name: 'Upgrade old package'
|
||||||
yarn:
|
yarn:
|
||||||
path: '{{ output_dir }}'
|
path: '{{ remote_tmp_dir }}'
|
||||||
executable: '{{ yarn_bin_path }}/yarn'
|
executable: '{{ yarn_bin_path }}/yarn'
|
||||||
name: left-pad
|
name: left-pad
|
||||||
state: latest
|
state: latest
|
||||||
|
@ -118,7 +118,7 @@
|
||||||
|
|
||||||
- name: 'Remove a package'
|
- name: 'Remove a package'
|
||||||
yarn:
|
yarn:
|
||||||
path: '{{ output_dir }}'
|
path: '{{ remote_tmp_dir }}'
|
||||||
executable: '{{ yarn_bin_path }}/yarn'
|
executable: '{{ yarn_bin_path }}/yarn'
|
||||||
name: '{{ package }}'
|
name: '{{ package }}'
|
||||||
state: absent
|
state: absent
|
||||||
|
|
2
tests/integration/targets/zypper/meta/main.yml
Normal file
2
tests/integration/targets/zypper/meta/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
dependencies:
|
||||||
|
- setup_remote_tmp_dir
|
|
@ -150,17 +150,17 @@
|
||||||
# INSTALL broken local package
|
# INSTALL broken local package
|
||||||
- name: create directory
|
- name: create directory
|
||||||
file:
|
file:
|
||||||
path: "{{output_dir | expanduser}}/zypper1"
|
path: "{{remote_tmp_dir | expanduser}}/zypper1"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: fake rpm package
|
- name: fake rpm package
|
||||||
file:
|
file:
|
||||||
path: "{{output_dir | expanduser}}/zypper1/broken.rpm"
|
path: "{{remote_tmp_dir | expanduser}}/zypper1/broken.rpm"
|
||||||
state: touch
|
state: touch
|
||||||
|
|
||||||
- name: install broken rpm
|
- name: install broken rpm
|
||||||
zypper:
|
zypper:
|
||||||
name: "{{output_dir | expanduser}}/zypper1/broken.rpm"
|
name: "{{remote_tmp_dir | expanduser}}/zypper1/broken.rpm"
|
||||||
state: present
|
state: present
|
||||||
register: zypper_result
|
register: zypper_result
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
|
@ -191,29 +191,29 @@
|
||||||
|
|
||||||
- name: create directory
|
- name: create directory
|
||||||
file:
|
file:
|
||||||
path: "{{output_dir | expanduser}}/zypper2"
|
path: "{{remote_tmp_dir | expanduser}}/zypper2"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: copy spec file
|
- name: copy spec file
|
||||||
copy:
|
copy:
|
||||||
src: empty.spec
|
src: empty.spec
|
||||||
dest: "{{ output_dir | expanduser }}/zypper2/empty.spec"
|
dest: "{{ remote_tmp_dir | expanduser }}/zypper2/empty.spec"
|
||||||
|
|
||||||
- name: build rpm
|
- name: build rpm
|
||||||
command: |
|
command: |
|
||||||
rpmbuild -bb \
|
rpmbuild -bb \
|
||||||
--define "_topdir {{output_dir | expanduser }}/zypper2/rpm-build"
|
--define "_topdir {{remote_tmp_dir | expanduser }}/zypper2/rpm-build"
|
||||||
--define "_builddir %{_topdir}" \
|
--define "_builddir %{_topdir}" \
|
||||||
--define "_rpmdir %{_topdir}" \
|
--define "_rpmdir %{_topdir}" \
|
||||||
--define "_srcrpmdir %{_topdir}" \
|
--define "_srcrpmdir %{_topdir}" \
|
||||||
--define "_specdir {{output_dir | expanduser}}/zypper2" \
|
--define "_specdir {{remote_tmp_dir | expanduser}}/zypper2" \
|
||||||
--define "_sourcedir %{_topdir}" \
|
--define "_sourcedir %{_topdir}" \
|
||||||
{{ output_dir }}/zypper2/empty.spec
|
{{ remote_tmp_dir }}/zypper2/empty.spec
|
||||||
register: rpm_build_result
|
register: rpm_build_result
|
||||||
|
|
||||||
- name: install empty rpm
|
- name: install empty rpm
|
||||||
zypper:
|
zypper:
|
||||||
name: "{{ output_dir | expanduser }}/zypper2/rpm-build/noarch/empty-1-0.noarch.rpm"
|
name: "{{ remote_tmp_dir | expanduser }}/zypper2/rpm-build/noarch/empty-1-0.noarch.rpm"
|
||||||
disable_gpg_check: yes
|
disable_gpg_check: yes
|
||||||
register: zypper_result
|
register: zypper_result
|
||||||
|
|
||||||
|
@ -236,13 +236,13 @@
|
||||||
|
|
||||||
- name: extract from rpm
|
- name: extract from rpm
|
||||||
zypper:
|
zypper:
|
||||||
name: "{{ output_dir | expanduser }}/zypper2/rpm-build/noarch/empty-1-0.noarch.rpm"
|
name: "{{ remote_tmp_dir | expanduser }}/zypper2/rpm-build/noarch/empty-1-0.noarch.rpm"
|
||||||
state: installed
|
state: installed
|
||||||
disable_gpg_check: yes
|
disable_gpg_check: yes
|
||||||
extra_args_precommand: --root {{ output_dir | expanduser }}/testdir/
|
extra_args_precommand: --root {{ remote_tmp_dir | expanduser }}/testdir/
|
||||||
|
|
||||||
- name: check that dir var is exist
|
- name: check that dir var is exist
|
||||||
stat: path={{ output_dir | expanduser }}/testdir/var
|
stat: path={{ remote_tmp_dir | expanduser }}/testdir/var
|
||||||
register: stat_result
|
register: stat_result
|
||||||
|
|
||||||
- name: check that we extract rpm package in testdir folder and folder var is exist
|
- name: check that we extract rpm package in testdir folder and folder var is exist
|
||||||
|
@ -458,25 +458,25 @@
|
||||||
- name: Deploy spec files to build 2 packages with duplicate files.
|
- name: Deploy spec files to build 2 packages with duplicate files.
|
||||||
template:
|
template:
|
||||||
src: duplicate.spec.j2
|
src: duplicate.spec.j2
|
||||||
dest: "{{ output_dir | expanduser }}/zypper2/duplicate{{ item }}.spec"
|
dest: "{{ remote_tmp_dir | expanduser }}/zypper2/duplicate{{ item }}.spec"
|
||||||
loop: "{{ looplist }}"
|
loop: "{{ looplist }}"
|
||||||
|
|
||||||
- name: build rpms with duplicate files
|
- name: build rpms with duplicate files
|
||||||
command: |
|
command: |
|
||||||
rpmbuild -bb \
|
rpmbuild -bb \
|
||||||
--define "_topdir {{output_dir | expanduser }}/zypper2/rpm-build"
|
--define "_topdir {{remote_tmp_dir | expanduser }}/zypper2/rpm-build"
|
||||||
--define "_builddir %{_topdir}" \
|
--define "_builddir %{_topdir}" \
|
||||||
--define "_rpmdir %{_topdir}" \
|
--define "_rpmdir %{_topdir}" \
|
||||||
--define "_srcrpmdir %{_topdir}" \
|
--define "_srcrpmdir %{_topdir}" \
|
||||||
--define "_specdir {{output_dir | expanduser}}/zypper2" \
|
--define "_specdir {{remote_tmp_dir | expanduser}}/zypper2" \
|
||||||
--define "_sourcedir %{_topdir}" \
|
--define "_sourcedir %{_topdir}" \
|
||||||
{{ output_dir | expanduser }}/zypper2/duplicate{{ item }}.spec
|
{{ remote_tmp_dir | expanduser }}/zypper2/duplicate{{ item }}.spec
|
||||||
loop: "{{ looplist }}"
|
loop: "{{ looplist }}"
|
||||||
|
|
||||||
- name: install duplicate rpms
|
- name: install duplicate rpms
|
||||||
zypper:
|
zypper:
|
||||||
name: >-
|
name: >-
|
||||||
{{ output_dir | expanduser }}/zypper2/rpm-build/noarch/duplicate{{ item }}-1-0.noarch.rpm
|
{{ remote_tmp_dir | expanduser }}/zypper2/rpm-build/noarch/duplicate{{ item }}-1-0.noarch.rpm
|
||||||
disable_gpg_check: true
|
disable_gpg_check: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: zypper_duplicate_result
|
register: zypper_duplicate_result
|
||||||
|
@ -499,7 +499,7 @@
|
||||||
- name: install duplicate rpms
|
- name: install duplicate rpms
|
||||||
zypper:
|
zypper:
|
||||||
name: >-
|
name: >-
|
||||||
{{ output_dir | expanduser }}/zypper2/rpm-build/noarch/duplicate{{ item }}-1-0.noarch.rpm
|
{{ remote_tmp_dir | expanduser }}/zypper2/rpm-build/noarch/duplicate{{ item }}-1-0.noarch.rpm
|
||||||
disable_gpg_check: true
|
disable_gpg_check: true
|
||||||
replacefiles: true
|
replacefiles: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
Loading…
Reference in a new issue