1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Improve CI (#3348) (#3351)

* 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:
patchback[bot] 2021-09-09 08:10:12 +02:00 committed by GitHub
parent ad3efa9719
commit c76e598d61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
68 changed files with 440 additions and 394 deletions

View file

@ -0,0 +1,2 @@
dependencies:
- setup_remote_tmp_dir

View file

@ -50,7 +50,7 @@
###################################################
- name:
set_fact:
reqs_file: '{{ output_dir }}/reqs.yaml'
reqs_file: '{{ remote_tmp_dir }}/reqs.yaml'
- name: Copy requirements file
copy:

View file

@ -1,2 +1,3 @@
dependencies:
- setup_pkg_mgr
- setup_remote_tmp_dir

View file

@ -75,7 +75,7 @@
register: backports_lzma_pip
- name: prep our files
copy: src={{ item }} dest={{output_dir}}/{{ item }}
copy: src={{ item }} dest={{remote_tmp_dir}}/{{ item }}
with_items:
- foo.txt
- bar.txt

View file

@ -3,29 +3,29 @@
- name: Create link - broken link ({{ format }})
file:
src: /nowhere
dest: "{{ output_dir }}/nowhere.txt"
dest: "{{ remote_tmp_dir }}/nowhere.txt"
state: link
force: yes
- name: Archive - broken link ({{ format }})
archive:
path: "{{ output_dir }}/*.txt"
dest: "{{ output_dir }}/archive_broken_link.{{ format }}"
path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ remote_tmp_dir }}/archive_broken_link.{{ format }}"
format: "{{ format }}"
- name: Verify archive exists - broken link ({{ format }})
file:
path: "{{ output_dir }}/archive_broken_link.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_broken_link.{{ format }}"
state: file
- name: Remove archive - broken link ({{ format }})
file:
path: "{{ output_dir }}/archive_broken_link.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_broken_link.{{ format }}"
state: absent
- name: Remove link - broken link ({{ format }})
file:
path: "{{ output_dir }}/nowhere.txt"
path: "{{ remote_tmp_dir }}/nowhere.txt"
state: absent
# 'zip' does not support symlink's
when: format != 'zip'

View file

@ -25,14 +25,14 @@
# Core functionality tests
- name: Archive - no options ({{ format }})
archive:
path: "{{ output_dir }}/*.txt"
dest: "{{ output_dir }}/archive_no_opts.{{ format }}"
path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ remote_tmp_dir }}/archive_no_opts.{{ format }}"
format: "{{ format }}"
register: archive_no_options
- name: Verify that archive exists - no options ({{ format }})
file:
path: "{{output_dir}}/archive_no_opts.{{ format }}"
path: "{{remote_tmp_dir}}/archive_no_opts.{{ format }}"
state: file
- 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 }})
file:
path: "{{ output_dir }}/archive_no_options.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_no_options.{{ format }}"
state: absent
- name: Archive - file options ({{ format }})
archive:
path: "{{ output_dir }}/*.txt"
dest: "{{ output_dir }}/archive_file_options.{{ format }}"
path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ remote_tmp_dir }}/archive_file_options.{{ format }}"
format: "{{ format }}"
mode: "u+rwX,g-rwx,o-rwx"
register: archive_file_options
- name: Retrieve archive file information - file options ({{ format }})
stat:
path: "{{ output_dir }}/archive_file_options.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_file_options.{{ format }}"
register: archive_file_options_stat
- name: Test that the file modes were changed
@ -69,19 +69,19 @@
- name: Remove the archive - file options ({{ format }})
file:
path: "{{ output_dir }}/archive_file_options.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_file_options.{{ format }}"
state: absent
- name: Archive - non-ascii ({{ format }})
archive:
path: "{{ output_dir }}/*.txt"
dest: "{{ output_dir }}/archive_nonascii_くらとみ.{{ format }}"
path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ remote_tmp_dir }}/archive_nonascii_くらとみ.{{ format }}"
format: "{{ format }}"
register: archive_nonascii
- name: Retrieve archive file information - non-ascii ({{ format }})
stat:
path: "{{ output_dir }}/archive_nonascii_くらとみ.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_nonascii_くらとみ.{{ format }}"
register: archive_nonascii_stat
- name: Test that archive exists - non-ascii ({{ format }})
@ -92,13 +92,13 @@
- name: Remove the archive - non-ascii ({{ format }})
file:
path: "{{ output_dir }}/archive_nonascii_くらとみ.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_nonascii_くらとみ.{{ format }}"
state: absent
- name: Archive - single target ({{ format }})
archive:
path: "{{ output_dir }}/foo.txt"
dest: "{{ output_dir }}/archive_single_target.{{ format }}"
path: "{{ remote_tmp_dir }}/foo.txt"
dest: "{{ remote_tmp_dir }}/archive_single_target.{{ format }}"
format: "{{ format }}"
register: archive_single_target
@ -117,7 +117,7 @@
- block:
- name: Retrieve contents of archive - single target ({{ format }})
ansible.builtin.unarchive:
src: "{{ output_dir }}/archive_single_target.{{ format }}"
src: "{{ remote_tmp_dir }}/archive_single_target.{{ format }}"
dest: .
list_files: true
check_mode: true
@ -135,22 +135,22 @@
- name: Remove archive - single target ({{ format }})
file:
path: "{{ output_dir }}/archive_single_target.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_single_target.{{ format }}"
state: absent
- name: Archive - path list ({{ format }})
archive:
path:
- "{{ output_dir }}/empty.txt"
- "{{ output_dir }}/foo.txt"
- "{{ output_dir }}/bar.txt"
dest: "{{ output_dir }}/archive_path_list.{{ format }}"
- "{{ remote_tmp_dir }}/empty.txt"
- "{{ remote_tmp_dir }}/foo.txt"
- "{{ remote_tmp_dir }}/bar.txt"
dest: "{{ remote_tmp_dir }}/archive_path_list.{{ format }}"
format: "{{ format }}"
register: archive_path_list
- name: Verify that archive exists - path list ({{ format }})
file:
path: "{{output_dir}}/archive_path_list.{{ format }}"
path: "{{remote_tmp_dir}}/archive_path_list.{{ format }}"
state: file
- name: Assert that archive contains all files - path list ({{ format }})
@ -161,16 +161,16 @@
- name: Remove archive - path list ({{ format }})
file:
path: "{{ output_dir }}/archive_path_list.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_path_list.{{ format }}"
state: absent
- name: Archive - missing paths ({{ format }})
archive:
path:
- "{{ output_dir }}/*.txt"
- "{{ output_dir }}/dne.txt"
exclude_path: "{{ output_dir }}/foo.txt"
dest: "{{ output_dir }}/archive_missing_paths.{{ format }}"
- "{{ remote_tmp_dir }}/*.txt"
- "{{ remote_tmp_dir }}/dne.txt"
exclude_path: "{{ remote_tmp_dir }}/foo.txt"
dest: "{{ remote_tmp_dir }}/archive_missing_paths.{{ format }}"
format: "{{ format }}"
register: archive_missing_paths
@ -179,10 +179,10 @@
that:
- archive_missing_paths is changed
- "archive_missing_paths.dest_state == 'incomplete'"
- "'{{ output_dir }}/dne.txt' in archive_missing_paths.missing"
- "'{{ output_dir }}/foo.txt' not in archive_missing_paths.missing"
- "'{{ remote_tmp_dir }}/dne.txt' in archive_missing_paths.missing"
- "'{{ remote_tmp_dir }}/foo.txt' not in archive_missing_paths.missing"
- name: Remove archive - missing paths ({{ format }})
file:
path: "{{ output_dir }}/archive_missing_paths.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_missing_paths.{{ format }}"
state: absent

View file

@ -1,8 +1,8 @@
---
- name: Archive - exclusion patterns ({{ format }})
archive:
path: "{{ output_dir }}/*.txt"
dest: "{{ output_dir }}/archive_exclusion_patterns.{{ format }}"
path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ remote_tmp_dir }}/archive_exclusion_patterns.{{ format }}"
format: "{{ format }}"
exclusion_patterns: b?r.*
register: archive_exclusion_patterns
@ -15,26 +15,26 @@
- name: Remove archive - exclusion patterns ({{ format }})
file:
path: "{{ output_dir }}/archive_exclusion_patterns.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_exclusion_patterns.{{ format }}"
state: absent
- name: Archive - exclude path ({{ format }})
archive:
path:
- "{{ output_dir }}/sub/subfile.txt"
- "{{ output_dir }}"
- "{{ remote_tmp_dir }}/sub/subfile.txt"
- "{{ remote_tmp_dir }}"
exclude_path:
- "{{ output_dir }}"
dest: "{{ output_dir }}/archive_exclude_paths.{{ format }}"
- "{{ remote_tmp_dir }}"
dest: "{{ remote_tmp_dir }}/archive_exclude_paths.{{ format }}"
format: "{{ format }}"
register: archive_excluded_paths
- name: Assert that excluded paths do not influence archive root - exclude path ({{ format }})
assert:
that:
- archive_excluded_paths.arcroot != output_dir
- archive_excluded_paths.arcroot != remote_tmp_dir
- name: Remove archive - exclude path ({{ format }})
file:
path: "{{ output_dir }}/archive_exclude_paths.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_exclude_paths.{{ format }}"
state: absent

View file

@ -1,8 +1,8 @@
---
- name: Archive - file content idempotency ({{ format }})
archive:
path: "{{ output_dir }}/*.txt"
dest: "{{ output_dir }}/archive_file_content_idempotency.{{ format }}"
path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ remote_tmp_dir }}/archive_file_content_idempotency.{{ format }}"
format: "{{ format }}"
register: file_content_idempotency_before
@ -10,12 +10,12 @@
lineinfile:
line: bar.txt
regexp: "^foo.txt$"
path: "{{ output_dir }}/foo.txt"
path: "{{ remote_tmp_dir }}/foo.txt"
- name: Archive second time - file content idempotency ({{ format }})
archive:
path: "{{ output_dir }}/*.txt"
dest: "{{ output_dir }}/archive_file_content_idempotency.{{ format }}"
path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ remote_tmp_dir }}/archive_file_content_idempotency.{{ format }}"
format: "{{ format }}"
register: file_content_idempotency_after
@ -28,29 +28,29 @@
- name: Remove archive - file content idempotency ({{ format }})
file:
path: "{{ output_dir }}/archive_file_content_idempotency.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_file_content_idempotency.{{ format }}"
state: absent
- name: Modify file back - file content idempotency ({{ format }})
lineinfile:
line: foo.txt
regexp: "^bar.txt$"
path: "{{ output_dir }}/foo.txt"
path: "{{ remote_tmp_dir }}/foo.txt"
- name: Archive - file name idempotency ({{ format }})
archive:
path: "{{ output_dir }}/*.txt"
dest: "{{ output_dir }}/archive_file_name_idempotency.{{ format }}"
path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ remote_tmp_dir }}/archive_file_name_idempotency.{{ format }}"
format: "{{ format }}"
register: file_name_idempotency_before
- 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 }})
archive:
path: "{{ output_dir }}/*.txt"
dest: "{{ output_dir }}/archive_file_name_idempotency.{{ format }}"
path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ remote_tmp_dir }}/archive_file_name_idempotency.{{ format }}"
format: "{{ format }}"
register: file_name_idempotency_after
@ -63,16 +63,16 @@
- name: Remove archive - file name idempotency ({{ format }})
file:
path: "{{ output_dir }}/archive_file_name_idempotency.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_file_name_idempotency.{{ format }}"
state: absent
- 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 }})
archive:
path: "{{ output_dir }}/foo.txt"
dest: "{{ output_dir }}/archive_single_file_content_idempotency.{{ format }}"
path: "{{ remote_tmp_dir }}/foo.txt"
dest: "{{ remote_tmp_dir }}/archive_single_file_content_idempotency.{{ format }}"
format: "{{ format }}"
register: single_file_content_idempotency_before
@ -80,12 +80,12 @@
lineinfile:
line: bar.txt
regexp: "^foo.txt$"
path: "{{ output_dir }}/foo.txt"
path: "{{ remote_tmp_dir }}/foo.txt"
- name: Archive second time - single file content idempotency ({{ format }})
archive:
path: "{{ output_dir }}/foo.txt"
dest: "{{ output_dir }}/archive_single_file_content_idempotency.{{ format }}"
path: "{{ remote_tmp_dir }}/foo.txt"
dest: "{{ remote_tmp_dir }}/archive_single_file_content_idempotency.{{ format }}"
format: "{{ format }}"
register: single_file_content_idempotency_after
@ -98,29 +98,29 @@
- name: Remove archive - single file content idempotency ({{ format }})
file:
path: "{{ output_dir }}/archive_single_file_content_idempotency.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_single_file_content_idempotency.{{ format }}"
state: absent
- name: Modify file back - single file content idempotency ({{ format }})
lineinfile:
line: foo.txt
regexp: "^bar.txt$"
path: "{{ output_dir }}/foo.txt"
path: "{{ remote_tmp_dir }}/foo.txt"
- name: Archive - single file name idempotency ({{ format }})
archive:
path: "{{ output_dir }}/foo.txt"
dest: "{{ output_dir }}/archive_single_file_name_idempotency.{{ format }}"
path: "{{ remote_tmp_dir }}/foo.txt"
dest: "{{ remote_tmp_dir }}/archive_single_file_name_idempotency.{{ format }}"
format: "{{ format }}"
register: single_file_name_idempotency_before
- 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 }})
archive:
path: "{{ output_dir }}/fii.txt"
dest: "{{ output_dir }}/archive_single_file_name_idempotency.{{ format }}"
path: "{{ remote_tmp_dir }}/fii.txt"
dest: "{{ remote_tmp_dir }}/archive_single_file_name_idempotency.{{ format }}"
format: "{{ format }}"
register: single_file_name_idempotency_after
@ -134,8 +134,8 @@
- name: Remove archive - single file name idempotency ({{ format }})
file:
path: "{{ output_dir }}/archive_single_file_name_idempotency.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_single_file_name_idempotency.{{ format }}"
state: absent
- 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"

View file

@ -1,15 +1,15 @@
---
- name: Archive - remove source files ({{ format }})
archive:
path: "{{ output_dir }}/*.txt"
dest: "{{ output_dir }}/archive_remove_source_files.{{ format }}"
path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ remote_tmp_dir }}/archive_remove_source_files.{{ format }}"
format: "{{ format }}"
remove: yes
register: archive_remove_source_files
- name: Verify archive exists - remove source files ({{ format }})
file:
path: "{{ output_dir }}/archive_remove_source_files.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_remove_source_files.{{ format }}"
state: file
- name: Verify all files were archived - remove source files ({{ format }})
@ -20,13 +20,13 @@
- name: Remove Archive - remove source files ({{ format }})
file:
path: "{{ output_dir }}/archive_remove_source_files.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_remove_source_files.{{ format }}"
state: absent
- name: Assert that source files were removed - remove source files ({{ format }})
assert:
that:
- "'{{ output_dir }}/{{ item }}' is not exists"
- "'{{ remote_tmp_dir }}/{{ item }}' is not exists"
with_items:
- foo.txt
- bar.txt
@ -35,7 +35,7 @@
- name: Copy source files - remove source directory ({{ format }})
copy:
src: "{{ item }}"
dest: "{{ output_dir }}/{{ item }}"
dest: "{{ remote_tmp_dir }}/{{ item }}"
with_items:
- foo.txt
- bar.txt
@ -43,13 +43,13 @@
- name: Create temporary directory - remove source directory ({{ format }})
file:
path: "{{ output_dir }}/tmpdir"
path: "{{ remote_tmp_dir }}/tmpdir"
state: directory
- name: Copy source files to temporary directory - remove source directory ({{ format }})
copy:
src: "{{ item }}"
dest: "{{ output_dir }}/tmpdir/{{ item }}"
dest: "{{ remote_tmp_dir }}/tmpdir/{{ item }}"
with_items:
- foo.txt
- bar.txt
@ -57,15 +57,15 @@
- name: Archive - remove source directory ({{ format }})
archive:
path: "{{ output_dir }}/tmpdir"
dest: "{{ output_dir }}/archive_remove_source_directory.{{ format }}"
path: "{{ remote_tmp_dir }}/tmpdir"
dest: "{{ remote_tmp_dir }}/archive_remove_source_directory.{{ format }}"
format: "{{ format }}"
remove: yes
register: archive_remove_source_directory
- name: Verify archive exists - remove source directory ({{ format }})
file:
path: "{{ output_dir }}/archive_remove_source_directory.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_remove_source_directory.{{ format }}"
state: file
- name: Verify archive contains all files - remove source directory ({{ format }})
@ -76,23 +76,23 @@
- name: Remove archive - remove source directory ({{ format }})
file:
path: "{{ output_dir }}/archive_remove_source_directory.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_remove_source_directory.{{ format }}"
state: absent
- name: Verify source directory was removed - remove source directory ({{ format }})
assert:
that:
- "'{{ output_dir }}/tmpdir' is not exists"
- "'{{ remote_tmp_dir }}/tmpdir' is not exists"
- name: Create temporary directory - remove source excluding path ({{ format }})
file:
path: "{{ output_dir }}/tmpdir"
path: "{{ remote_tmp_dir }}/tmpdir"
state: directory
- name: Copy source files to temporary directory - remove source excluding path ({{ format }})
copy:
src: "{{ item }}"
dest: "{{ output_dir }}/tmpdir/{{ item }}"
dest: "{{ remote_tmp_dir }}/tmpdir/{{ item }}"
with_items:
- foo.txt
- bar.txt
@ -100,16 +100,16 @@
- name: Archive - remove source excluding path ({{ format }})
archive:
path: "{{ output_dir }}/tmpdir/*"
dest: "{{ output_dir }}/archive_remove_source_excluding_path.{{ format }}"
path: "{{ remote_tmp_dir }}/tmpdir/*"
dest: "{{ remote_tmp_dir }}/archive_remove_source_excluding_path.{{ format }}"
format: "{{ format }}"
remove: yes
exclude_path: "{{ output_dir }}/tmpdir/empty.txt"
exclude_path: "{{ remote_tmp_dir }}/tmpdir/empty.txt"
register: archive_remove_source_excluding_path
- name: Verify archive exists - remove source excluding path ({{ format }})
file:
path: "{{ output_dir }}/archive_remove_source_excluding_path.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_remove_source_excluding_path.{{ format }}"
state: file
- 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 }})
file:
path: "{{ output_dir }}/archive_remove_source_excluding_path.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_remove_source_excluding_path.{{ format }}"
state: absent
- name: Verify that excluded file still exists - remove source excluding path ({{ format }})
file:
path: "{{ output_dir }}/tmpdir/empty.txt"
path: "{{ remote_tmp_dir }}/tmpdir/empty.txt"
state: file
- name: Copy source files to temporary directory - remove source excluding sub path ({{ format }})
copy:
src: "{{ item }}"
dest: "{{ output_dir }}/tmpdir/{{ item }}"
dest: "{{ remote_tmp_dir }}/tmpdir/{{ item }}"
with_items:
- foo.txt
- bar.txt
@ -142,33 +142,33 @@
- name: Archive - remove source excluding sub path ({{ format }})
archive:
path:
- "{{ output_dir }}/tmpdir/*.txt"
- "{{ output_dir }}/tmpdir/sub/*"
dest: "{{ output_dir }}/archive_remove_source_excluding_sub_path.{{ format }}"
- "{{ remote_tmp_dir }}/tmpdir/*.txt"
- "{{ remote_tmp_dir }}/tmpdir/sub/*"
dest: "{{ remote_tmp_dir }}/archive_remove_source_excluding_sub_path.{{ format }}"
format: "{{ format }}"
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
- name: Verify archive exists - remove source excluding sub path ({{ format }})
file:
path: "{{ output_dir }}/archive_remove_source_excluding_sub_path.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_remove_source_excluding_sub_path.{{ format }}"
state: file
- name: Remove archive - remove source excluding sub path ({{ format }})
file:
path: "{{ output_dir }}/archive_remove_source_excluding_sub_path.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_remove_source_excluding_sub_path.{{ format }}"
state: absent
- name: Verify that sub path still exists - remove source excluding sub path ({{ format }})
file:
path: "{{ output_dir }}/tmpdir/sub/subfile.txt"
path: "{{ remote_tmp_dir }}/tmpdir/sub/subfile.txt"
state: file
- name: Copy source files to temporary directory - remove source with nested paths ({{ format }})
copy:
src: "{{ item }}"
dest: "{{ output_dir }}/tmpdir/{{ item }}"
dest: "{{ remote_tmp_dir }}/tmpdir/{{ item }}"
with_items:
- foo.txt
- bar.txt
@ -178,20 +178,20 @@
- name: Archive - remove source with nested paths ({{ format }})
archive:
path: "{{ output_dir }}/tmpdir/"
dest: "{{ output_dir }}/archive_remove_source_nested_paths.{{ format }}"
path: "{{ remote_tmp_dir }}/tmpdir/"
dest: "{{ remote_tmp_dir }}/archive_remove_source_nested_paths.{{ format }}"
format: "{{ format }}"
remove: yes
register: archive_remove_nested_paths
- name: Verify archive exists - remove source with nested paths ({{ format }})
file:
path: "{{ output_dir }}/archive_remove_source_nested_paths.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_remove_source_nested_paths.{{ format }}"
state: file
- name: Verify source files were removed - remove source with nested paths ({{ format }})
file:
path: "{{ output_dir }}/tmpdir"
path: "{{ remote_tmp_dir }}/tmpdir"
state: absent
register: archive_remove_nested_paths_status
@ -203,5 +203,5 @@
- name: Remove archive - remove source with nested paths ({{ format }})
file:
path: "{{ output_dir }}/archive_remove_source_nested_paths.{{ format }}"
path: "{{ remote_tmp_dir }}/archive_remove_source_nested_paths.{{ format }}"
state: absent

View file

@ -2,3 +2,4 @@
dependencies:
- setup_pkg_mgr
- setup_openssl
- setup_remote_tmp_dir

View file

@ -7,7 +7,7 @@
vars:
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_cmd: '{{ output_dir }}/consul'
consul_cmd: '{{ remote_tmp_dir }}/consul'
block:
- name: register pyOpenSSL version
command: '{{ ansible_python_interpreter }} -c ''import OpenSSL; print(OpenSSL.__version__)'''
@ -27,19 +27,19 @@
block:
- name: Generate privatekey
community.crypto.openssl_privatekey:
path: '{{ output_dir }}/privatekey.pem'
path: '{{ remote_tmp_dir }}/privatekey.pem'
- name: Generate CSR
community.crypto.openssl_csr:
path: '{{ output_dir }}/csr.csr'
privatekey_path: '{{ output_dir }}/privatekey.pem'
path: '{{ remote_tmp_dir }}/csr.csr'
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
subject:
commonName: localhost
- name: Generate selfsigned certificate
register: selfsigned_certificate
community.crypto.openssl_certificate:
path: '{{ output_dir }}/cert.pem'
csr_path: '{{ output_dir }}/csr.csr'
privatekey_path: '{{ output_dir }}/privatekey.pem'
path: '{{ remote_tmp_dir }}/cert.pem'
csr_path: '{{ remote_tmp_dir }}/csr.csr'
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
provider: selfsigned
selfsigned_digest: sha256
- name: Install unzip
@ -59,21 +59,21 @@
- name: Download consul binary
unarchive:
src: '{{ consul_uri }}'
dest: '{{ output_dir }}'
dest: '{{ remote_tmp_dir }}'
remote_src: true
register: result
until: result is success
- vars:
remote_dir: '{{ echo_output_dir.stdout }}'
remote_dir: '{{ echo_remote_tmp_dir.stdout }}'
block:
- command: echo {{ output_dir }}
register: echo_output_dir
- command: echo {{ remote_tmp_dir }}
register: echo_remote_tmp_dir
- name: Create configuration file
template:
src: consul_config.hcl.j2
dest: '{{ output_dir }}/consul_config.hcl'
dest: '{{ remote_tmp_dir }}/consul_config.hcl'
- 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
command: '{{ consul_cmd }} kv put data/value{{ item }} foo{{ item }}'
loop:
@ -83,5 +83,5 @@
- import_tasks: consul_session.yml
always:
- name: Kill consul process
shell: kill $(cat {{ output_dir }}/consul.pid)
shell: kill $(cat {{ remote_tmp_dir }}/consul.pid)
ignore_errors: true

View file

@ -0,0 +1,2 @@
dependencies:
- setup_remote_tmp_dir

View file

@ -5,7 +5,7 @@
####################################################################
- 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
deploy_helper: path={{ deploy_helper_test_root }} state=query

View file

@ -0,0 +1,2 @@
dependencies:
- setup_remote_tmp_dir

View file

@ -8,9 +8,6 @@
# Copyright: (c) 2019, Ansible Project
# 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
debug:
var: "0 | community.general.random_mac"

View file

@ -57,7 +57,7 @@
mode: '0755'
- 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
poll: 0
register: webserver_status

View file

@ -1,2 +1,3 @@
dependencies:
- setup_pkg_mgr
- setup_remote_tmp_dir

View file

@ -122,7 +122,7 @@
gem:
name: gist
state: present
install_dir: "{{ output_dir }}/gems"
install_dir: "{{ remote_tmp_dir }}/gems"
ignore_errors: yes
register: install_gem_fail_result
@ -141,12 +141,12 @@
name: gist
state: present
user_install: no
install_dir: "{{ output_dir }}/gems"
install_dir: "{{ remote_tmp_dir }}/gems"
register: install_gem_result
- name: Find gems in custom directory
find:
paths: "{{ output_dir }}/gems/gems"
paths: "{{ remote_tmp_dir }}/gems/gems"
file_type: directory
contains: gist
register: gem_search
@ -163,12 +163,12 @@
name: gist
state: absent
user_install: no
install_dir: "{{ output_dir }}/gems"
install_dir: "{{ remote_tmp_dir }}/gems"
register: install_gem_result
- name: Find gems in custom directory
find:
paths: "{{ output_dir }}/gems/gems"
paths: "{{ remote_tmp_dir }}/gems/gems"
file_type: directory
contains: gist
register: gem_search
@ -184,14 +184,14 @@
gem:
name: gist
state: present
bindir: "{{ output_dir }}/custom_bindir"
bindir: "{{ remote_tmp_dir }}/custom_bindir"
norc: yes
user_install: no # Avoid conflicts between --install-dir and --user-install when running as root on CentOS / Fedora / RHEL
register: install_gem_result
- name: Get stats of gem executable
stat:
path: "{{ output_dir }}/custom_bindir/gist"
path: "{{ remote_tmp_dir }}/custom_bindir/gist"
register: gem_bindir_stat
- name: Ensure gem executable was installed in custom directory
@ -204,14 +204,14 @@
gem:
name: gist
state: absent
bindir: "{{ output_dir }}/custom_bindir"
bindir: "{{ remote_tmp_dir }}/custom_bindir"
norc: yes
user_install: no # Avoid conflicts between --install-dir and --user-install when running as root on CentOS / Fedora / RHEL
register: install_gem_result
- name: Get stats of gem executable
stat:
path: "{{ output_dir }}/custom_bindir/gist"
path: "{{ remote_tmp_dir }}/custom_bindir/gist"
register: gem_bindir_stat
- name: Ensure gem executable was removed from custom directory

View file

@ -0,0 +1,2 @@
dependencies:
- setup_remote_tmp_dir

View file

@ -6,7 +6,7 @@
name: "{{ option_name }}"
value: "{{ option_value }}"
scope: "file"
file: "{{ output_dir }}/gitconfig_file"
file: "{{ remote_tmp_dir }}/gitconfig_file"
state: present
register: result
@ -14,7 +14,7 @@
git_config:
name: "{{ option_name }}"
scope: "file"
file: "{{ output_dir }}/gitconfig_file"
file: "{{ remote_tmp_dir }}/gitconfig_file"
state: present
register: get_result
@ -26,4 +26,3 @@
- set_result.diff.after == option_value + "\n"
- get_result is not changed
- get_result.config_value == option_value
...

View file

@ -8,6 +8,5 @@
- name: set up without value (file)
file:
path: "{{ output_dir }}/gitconfig_file"
path: "{{ remote_tmp_dir }}/gitconfig_file"
state: absent
...

View file

@ -9,5 +9,4 @@
- name: set up with value (file)
copy:
src: gitconfig
dest: "{{ output_dir }}/gitconfig_file"
...
dest: "{{ remote_tmp_dir }}/gitconfig_file"

View file

@ -1,2 +1,3 @@
dependencies:
- setup_pkg_mgr
- setup_remote_tmp_dir

View file

@ -6,14 +6,14 @@
- name: set where to extract the repo
set_fact:
checkout_dir: "{{ output_dir }}/hg_project_test"
checkout_dir: "{{ remote_tmp_dir }}/hg_project_test"
- name: set what repo to use
set_fact:
repo: "http://hg.pf.osdn.net/view/a/ak/akasurde/hg_project_test"
- name: clean out the output_dir
shell: rm -rf {{ output_dir }}/*
- name: clean out the remote_tmp_dir
shell: rm -rf {{ remote_tmp_dir }}/*
- name: verify that mercurial is installed so this test can continue
shell: which hg

View file

@ -1,2 +1,3 @@
dependencies:
- setup_pkg_mgr
- setup_remote_tmp_dir

View file

@ -14,15 +14,23 @@
- debug: var=install_pycdlib
- 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
- name: Copy files and directories
copy:
src: '{{ item }}'
dest: '{{ remote_tmp_dir }}/{{ item }}'
loop:
- test1.cfg
- test_dir
- name: Test check mode
iso_create:
src_files:
- "{{ role_path }}/files/test1.cfg"
dest_iso: "{{ output_dir_test }}/test.iso"
- "{{ remote_tmp_dir }}/test1.cfg"
dest_iso: "{{ output_test_dir }}/test.iso"
interchange_level: 3
register: iso_result
check_mode: yes
@ -30,7 +38,7 @@
- name: Check if iso file created
stat:
path: "{{ output_dir_test }}/test.iso"
path: "{{ output_test_dir }}/test.iso"
register: iso_file
- debug: var=iso_file
- assert:
@ -41,15 +49,15 @@
- name: Create iso file with a specified file
iso_create:
src_files:
- "{{ role_path }}/files/test1.cfg"
dest_iso: "{{ output_dir_test }}/test.iso"
- "{{ remote_tmp_dir }}/test1.cfg"
dest_iso: "{{ output_test_dir }}/test.iso"
interchange_level: 3
register: iso_result
- debug: var=iso_result
- name: Check if iso file created
stat:
path: "{{ output_dir_test }}/test.iso"
path: "{{ output_test_dir }}/test.iso"
register: iso_file
- assert:
@ -60,16 +68,16 @@
- name: Create iso file with a specified file and folder
iso_create:
src_files:
- "{{ role_path }}/files/test1.cfg"
- "{{ role_path }}/files/test_dir"
dest_iso: "{{ output_dir_test }}/test1.iso"
- "{{ remote_tmp_dir }}/test1.cfg"
- "{{ remote_tmp_dir }}/test_dir"
dest_iso: "{{ output_test_dir }}/test1.iso"
interchange_level: 3
register: iso_result
- debug: var=iso_result
- name: Check if iso file created
stat:
path: "{{ output_dir_test }}/test1.iso"
path: "{{ output_test_dir }}/test1.iso"
register: iso_file
- assert:
@ -80,15 +88,15 @@
- name: Create iso file with volume identification string
iso_create:
src_files:
- "{{ role_path }}/files/test1.cfg"
dest_iso: "{{ output_dir_test }}/test2.iso"
- "{{ remote_tmp_dir }}/test1.cfg"
dest_iso: "{{ output_test_dir }}/test2.iso"
vol_ident: "OEMDRV"
register: iso_result
- debug: var=iso_result
- name: Check if iso file created
stat:
path: "{{ output_dir_test }}/test2.iso"
path: "{{ output_test_dir }}/test2.iso"
register: iso_file
- assert:
@ -99,15 +107,15 @@
- name: Create iso file with Rock Ridge extention
iso_create:
src_files:
- "{{ role_path }}/files/test1.cfg"
dest_iso: "{{ output_dir_test }}/test3.iso"
- "{{ remote_tmp_dir }}/test1.cfg"
dest_iso: "{{ output_test_dir }}/test3.iso"
rock_ridge: "1.09"
register: iso_result
- debug: var=iso_result
- name: Check if iso file created
stat:
path: "{{ output_dir_test }}/test3.iso"
path: "{{ output_test_dir }}/test3.iso"
register: iso_file
- assert:
@ -118,15 +126,15 @@
- name: Create iso file with Joliet extention
iso_create:
src_files:
- "{{ role_path }}/files/test1.cfg"
dest_iso: "{{ output_dir_test }}/test4.iso"
- "{{ remote_tmp_dir }}/test1.cfg"
dest_iso: "{{ output_test_dir }}/test4.iso"
joliet: 3
register: iso_result
- debug: var=iso_result
- name: Check if iso file created
stat:
path: "{{ output_dir_test }}/test4.iso"
path: "{{ output_test_dir }}/test4.iso"
register: iso_file
- assert:
@ -137,15 +145,15 @@
- name: Create iso file with UDF enabled
iso_create:
src_files:
- "{{ role_path }}/files/test1.cfg"
dest_iso: "{{ output_dir_test }}/test5.iso"
- "{{ remote_tmp_dir }}/test1.cfg"
dest_iso: "{{ output_test_dir }}/test5.iso"
udf: True
register: iso_result
- debug: var=iso_result
- name: Check if iso file created
stat:
path: "{{ output_dir_test }}/test5.iso"
path: "{{ output_test_dir }}/test5.iso"
register: iso_file
- assert:

View file

@ -3,10 +3,10 @@
# 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
file:
path: '{{ output_dir_test }}'
path: '{{ output_test_dir }}'
state: absent
- name: Create our testing sub-directory
file:
path: '{{ output_dir_test }}'
path: '{{ output_test_dir }}'
state: directory

View file

@ -1,3 +1,4 @@
dependencies:
- setup_pkg_mgr
- setup_epel
- setup_remote_tmp_dir

View file

@ -23,7 +23,7 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
- set_fact:
output_dir_test: '{{ output_dir }}/test_iso_extract'
output_test_dir: '{{ remote_tmp_dir }}/test_iso_extract'
- name: Install 7zip
import_tasks: 7zip.yml

View file

@ -19,15 +19,15 @@
- name: Make sure our testing sub-directory does not exist
file:
path: '{{ output_dir_test }}'
path: '{{ output_test_dir }}'
state: absent
- name: Create our testing sub-directory
file:
path: '{{ output_dir_test }}'
path: '{{ output_test_dir }}'
state: directory
- name: copy the iso to the test dir
copy:
src: test.iso
dest: '{{ output_dir_test }}'
dest: '{{ output_test_dir }}'

View file

@ -19,8 +19,8 @@
- name: Extract the iso
iso_extract:
image: '{{ output_dir_test }}/test.iso'
dest: '{{ output_dir_test }}'
image: '{{ output_test_dir }}/test.iso'
dest: '{{ output_test_dir }}'
files:
- 1.txt
- 2.txt
@ -32,8 +32,8 @@
- name: Extract the iso again
iso_extract:
image: '{{ output_dir_test }}/test.iso'
dest: '{{ output_dir_test }}'
image: '{{ output_test_dir }}/test.iso'
dest: '{{ output_test_dir }}'
files:
- 1.txt
- 2.txt

View file

@ -1,15 +1,15 @@
---
test_pkcs12_path: testpkcs.p12
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_cert_path: "{{ output_dir }}/cert.pem"
test_key_path: "{{ output_dir }}/key.pem"
test_csr_path: "{{ output_dir }}/req.csr"
test_cert2_path: "{{ output_dir }}/cert2.pem"
test_key2_path: "{{ output_dir }}/key2.pem"
test_csr2_path: "{{ output_dir }}/req2.csr"
test_pkcs_path: "{{ output_dir }}/cert.p12"
test_pkcs2_path: "{{ output_dir }}/cert2.p12"
test_cert_path: "{{ remote_tmp_dir }}/cert.pem"
test_key_path: "{{ remote_tmp_dir }}/key.pem"
test_csr_path: "{{ remote_tmp_dir }}/req.csr"
test_cert2_path: "{{ remote_tmp_dir }}/cert2.pem"
test_key2_path: "{{ remote_tmp_dir }}/key2.pem"
test_csr2_path: "{{ remote_tmp_dir }}/req2.csr"
test_pkcs_path: "{{ remote_tmp_dir }}/cert.p12"
test_pkcs2_path: "{{ remote_tmp_dir }}/cert2.p12"
test_ssl: setupSSLServer.py
test_ssl_port: 21500

View file

@ -1,3 +1,4 @@
dependencies:
- setup_java_keytool
- setup_openssl
- setup_remote_tmp_dir

View file

@ -9,15 +9,15 @@
- name: prep pkcs12 file
ansible.builtin.copy:
src: "{{ test_pkcs12_path }}"
dest: "{{ output_dir }}/{{ test_pkcs12_path }}"
dest: "{{ remote_tmp_dir }}/{{ test_pkcs12_path }}"
- name: import pkcs12
community.general.java_cert:
pkcs12_path: "{{ output_dir }}/{{ test_pkcs12_path }}"
pkcs12_path: "{{ remote_tmp_dir }}/{{ test_pkcs12_path }}"
pkcs12_password: changeit
pkcs12_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_create: yes
state: present
@ -30,11 +30,11 @@
- name: import pkcs12 with wrong password
community.general.java_cert:
pkcs12_path: "{{ output_dir }}/{{ test_pkcs12_path }}"
pkcs12_path: "{{ remote_tmp_dir }}/{{ test_pkcs12_path }}"
pkcs12_password: wrong_pass
pkcs12_alias: default
cert_alias: default_new
keystore_path: "{{ output_dir }}/{{ test_keystore_path }}"
keystore_path: "{{ remote_tmp_dir }}/{{ test_keystore_path }}"
keystore_pass: changeme_keystore
keystore_create: yes
state: present
@ -49,9 +49,9 @@
- name: test fail on mutually exclusive params
community.general.java_cert:
cert_path: ca.crt
pkcs12_path: "{{ output_dir }}/{{ test_pkcs12_path }}"
pkcs12_path: "{{ remote_tmp_dir }}/{{ test_pkcs12_path }}"
cert_alias: default
keystore_path: "{{ output_dir }}/{{ test_keystore_path }}"
keystore_path: "{{ remote_tmp_dir }}/{{ test_keystore_path }}"
keystore_pass: changeme_keystore
keystore_create: yes
state: present
@ -65,7 +65,7 @@
- name: test fail on missing required params
community.general.java_cert:
keystore_path: "{{ output_dir }}/{{ test_keystore_path }}"
keystore_path: "{{ remote_tmp_dir }}/{{ test_keystore_path }}"
keystore_pass: changeme_keystore
state: absent
ignore_errors: true
@ -78,7 +78,7 @@
- name: delete object based on cert_alias parameter
community.general.java_cert:
keystore_path: "{{ output_dir }}/{{ test_keystore_path }}"
keystore_path: "{{ remote_tmp_dir }}/{{ test_keystore_path }}"
keystore_pass: changeme_keystore
cert_alias: default
state: absent
@ -98,8 +98,8 @@
path: "{{ item }}"
state: absent
loop:
- "{{ output_dir }}/{{ test_pkcs12_path }}"
- "{{ output_dir }}/{{ test_keystore_path }}"
- "{{ remote_tmp_dir }}/{{ test_pkcs12_path }}"
- "{{ remote_tmp_dir }}/{{ test_keystore_path }}"
- "{{ test_keystore2_path }}"
- "{{ test_cert_path }}"
- "{{ test_key_path }}"

View file

@ -239,13 +239,17 @@
- name: Copy the ssl server script
copy:
src: "setupSSLServer.py"
dest: "{{ output_dir }}"
dest: "{{ remote_tmp_dir }}"
- 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
poll: 0
- name: "Wait for one second to make sure that the serve script has actually been started"
pause:
seconds: 1
- name: |
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

View file

@ -1,3 +1,4 @@
dependencies:
- setup_java_keytool
- setup_openssl
- setup_remote_tmp_dir

View file

@ -1,12 +1,12 @@
---
- name: Create test directory
ansible.builtin.file:
path: "{{ output_dir }}"
path: "{{ remote_tmp_dir }}"
state: directory
- name: Create private keys
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
# The following is more efficient, but might not work everywhere:
# type: ECC
@ -17,17 +17,17 @@
- name: Create CSRs
community.crypto.openssl_csr:
path: "{{ output_dir ~ '/' ~ item.name ~ '.csr' }}"
privatekey_path: "{{ output_dir ~ '/' ~ (item.keyname | default(item.name)) ~ '.key' }}"
path: "{{ remote_tmp_dir ~ '/' ~ item.name ~ '.csr' }}"
privatekey_path: "{{ remote_tmp_dir ~ '/' ~ (item.keyname | default(item.name)) ~ '.key' }}"
privatekey_passphrase: "{{ item.passphrase | default(omit) }}"
commonName: "{{ item.commonName }}"
loop: "{{ java_keystore_certs + java_keystore_new_certs }}"
- name: Create certificates
community.crypto.x509_certificate:
path: "{{ output_dir ~ '/' ~ item.name ~ '.pem' }}"
csr_path: "{{ output_dir ~ '/' ~ item.name ~ '.csr' }}"
privatekey_path: "{{ output_dir ~ '/' ~ (item.keyname | default(item.name)) ~ '.key' }}"
path: "{{ remote_tmp_dir ~ '/' ~ item.name ~ '.pem' }}"
csr_path: "{{ remote_tmp_dir ~ '/' ~ item.name ~ '.csr' }}"
privatekey_path: "{{ remote_tmp_dir ~ '/' ~ (item.keyname | default(item.name)) ~ '.key' }}"
privatekey_passphrase: "{{ item.passphrase | default(omit) }}"
provider: selfsigned
loop: "{{ java_keystore_certs + java_keystore_new_certs }}"

View file

@ -1,199 +1,273 @@
---
- name: Create test directory
ansible.builtin.file:
path: "{{ output_dir }}"
path: "{{ remote_tmp_dir }}"
state: directory
- name: Ensure the Java keystore does not exist (cleanup between tests)
ansible.builtin.file:
path: "{{ output_dir ~ '/' ~ item.name ~ '.jks' }}"
path: "{{ remote_tmp_dir ~ '/' ~ item.name ~ '.jks' }}"
state: absent
loop: "{{ java_keystore_certs }}"
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)
community.general.java_keystore: &java_keystore_params
name: example
dest: "{{ output_dir ~ '/' ~ (item.keyname | d(item.name)) ~ '.jks' }}"
certificate: "{{ omit if remote_cert else lookup('file', output_dir ~ '/' ~ item.name ~ '.pem') }}"
private_key: "{{ omit if remote_cert else lookup('file', output_dir ~ '/' ~ (item.keyname | d(item.name)) ~ '.key') }}"
certificate_path: "{{ omit if not remote_cert else output_dir ~ '/' ~ item.name ~ '.pem' }}"
private_key_path: "{{ omit if not remote_cert else output_dir ~ '/' ~ (item.keyname | d(item.name)) ~ '.key' }}"
dest: "{{ remote_tmp_dir ~ '/' ~ (item.keyname | d(item.name)) ~ '.jks' }}"
certificate: "{{ omit if remote_cert else (certificates.results[loop_index].content | b64decode) }}"
private_key: "{{ omit if remote_cert else (certificate_keys.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_certs }}"
loop_control:
index_var: loop_index
check_mode: yes
register: result_check
- name: Create a Java keystore for the given certificates
community.general.java_keystore: *java_keystore_params
loop: "{{ java_keystore_certs }}"
loop_control:
index_var: loop_index
register: result
- name: Create a Java keystore for the given certificates (idempotency, check mode)
community.general.java_keystore: *java_keystore_params
loop: "{{ java_keystore_certs }}"
loop_control:
index_var: loop_index
check_mode: yes
register: result_idem_check
- name: Create a Java keystore for the given certificates (idempotency)
community.general.java_keystore: *java_keystore_params
loop: "{{ java_keystore_certs }}"
loop_control:
index_var: loop_index
register: result_idem
- name: Create a Java keystore for the given certificates (certificate changed, check mode)
community.general.java_keystore: *java_keystore_params
- name: Read certificates (new)
slurp:
src: "{{ remote_tmp_dir ~ '/' ~ item.name ~ '.pem' }}"
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
register: result_change_check
- 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_control:
index_var: loop_index
register: result_change
- name: Create a Java keystore for the given certificates (alias changed, check mode)
community.general.java_keystore:
<<: *java_keystore_params
<<: *java_keystore_params_new_certs
name: foobar
loop: "{{ java_keystore_new_certs }}"
loop_control:
index_var: loop_index
check_mode: yes
register: result_alias_change_check
- name: Create a Java keystore for the given certificates (alias changed)
community.general.java_keystore:
<<: *java_keystore_params
<<: *java_keystore_params_new_certs
name: foobar
loop: "{{ java_keystore_new_certs }}"
loop_control:
index_var: loop_index
register: result_alias_change
- name: Create a Java keystore for the given certificates (password changed, check mode)
community.general.java_keystore:
<<: *java_keystore_params
<<: *java_keystore_params_new_certs
name: foobar
password: hunter2
loop: "{{ java_keystore_new_certs }}"
loop_control:
index_var: loop_index
check_mode: yes
register: result_pw_change_check
- name: Create a Java keystore for the given certificates (password changed)
community.general.java_keystore:
<<: *java_keystore_params
<<: *java_keystore_params_new_certs
name: foobar
password: hunter2
loop: "{{ java_keystore_new_certs }}"
loop_control:
index_var: loop_index
register: result_pw_change
- name: Create a Java keystore for the given certificates (force keystore type pkcs12, check mode)
community.general.java_keystore:
<<: *java_keystore_params
<<: *java_keystore_params_new_certs
name: foobar
password: hunter2
keystore_type: pkcs12
loop: "{{ java_keystore_new_certs }}"
loop_control:
index_var: loop_index
check_mode: yes
register: result_type_pkcs12_check
- name: Create a Java keystore for the given certificates (force keystore type jks, check mode)
community.general.java_keystore:
<<: *java_keystore_params
<<: *java_keystore_params_new_certs
name: foobar
password: hunter2
keystore_type: jks
loop: "{{ java_keystore_new_certs }}"
loop_control:
index_var: loop_index
check_mode: yes
register: result_type_jks_check
- name: Create a Java keystore for the given certificates (force keystore type jks)
community.general.java_keystore:
<<: *java_keystore_params
<<: *java_keystore_params_new_certs
name: foobar
password: hunter2
keystore_type: jks
loop: "{{ java_keystore_new_certs }}"
loop_control:
index_var: loop_index
register: result_type_jks
- name: Stat keystore (before failure)
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 }}"
register: result_stat_before
- name: Fail to create a Java keystore for the given certificates (password too short)
community.general.java_keystore:
<<: *java_keystore_params
<<: *java_keystore_params_new_certs
name: foobar
password: short
keystore_type: jks
loop: "{{ java_keystore_new_certs }}"
loop_control:
index_var: loop_index
register: result_fail_jks
ignore_errors: true
- name: Stat keystore (after failure)
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 }}"
register: result_stat_after
- name: Create a Java keystore for the given certificates (keystore type changed, check mode)
community.general.java_keystore:
<<: *java_keystore_params
<<: *java_keystore_params_new_certs
name: foobar
password: hunter2
keystore_type: pkcs12
loop: "{{ java_keystore_new_certs }}"
loop_control:
index_var: loop_index
check_mode: yes
register: result_type_change_check
- name: Create a Java keystore for the given certificates (keystore type changed)
community.general.java_keystore:
<<: *java_keystore_params
<<: *java_keystore_params_new_certs
name: foobar
password: hunter2
keystore_type: pkcs12
loop: "{{ java_keystore_new_certs }}"
loop_control:
index_var: loop_index
register: result_type_change
- name: Create a Java keystore for the given certificates (omit keystore type, check mode)
community.general.java_keystore:
<<: *java_keystore_params
<<: *java_keystore_params_new_certs
name: foobar
password: hunter2
loop: "{{ java_keystore_new_certs }}"
loop_control:
index_var: loop_index
check_mode: yes
register: result_type_omit_check
- name: Create a Java keystore for the given certificates (omit keystore type)
community.general.java_keystore:
<<: *java_keystore_params
<<: *java_keystore_params_new_certs
name: foobar
password: hunter2
loop: "{{ java_keystore_new_certs }}"
loop_control:
index_var: loop_index
register: result_type_omit
- name: Check that the remote certificates have not been removed
ansible.builtin.file:
path: "{{ output_dir ~ '/' ~ item.name ~ '.pem' }}"
path: "{{ remote_tmp_dir ~ '/' ~ item.name ~ '.pem' }}"
state: file
loop: "{{ java_keystore_certs + java_keystore_new_certs }}"
when: remote_cert
- name: Check that the remote private keys have not been removed
ansible.builtin.file:
path: "{{ output_dir ~ '/' ~ item.name ~ '.key' }}"
path: "{{ remote_tmp_dir ~ '/' ~ item.name ~ '.key' }}"
state: file
loop: "{{ java_keystore_certs }}"
when: remote_cert

View file

@ -0,0 +1,2 @@
dependencies:
- setup_remote_tmp_dir

View file

@ -16,7 +16,7 @@
- name: Install test smtpserver
copy:
src: '{{ item }}'
dest: '{{ output_dir }}/{{ item }}'
dest: '{{ remote_tmp_dir }}/{{ item }}'
loop:
- smtpserver.py
- smtpserver.crt
@ -25,7 +25,7 @@
# FIXME: Verify the mail after it was send would be nice
# This would require either dumping the content, or registering async task output
- 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
poll: 0
register: smtpserver

View file

@ -2,3 +2,4 @@
dependencies:
- setup_pkg_mgr
- setup_openssl
- setup_remote_tmp_dir

View file

@ -6,7 +6,7 @@
vars:
nomad_version: 0.12.4
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:
- name: register pyOpenSSL version
@ -36,21 +36,21 @@
block:
- name: Generate privatekey
community.crypto.openssl_privatekey:
path: '{{ output_dir }}/privatekey.pem'
path: '{{ remote_tmp_dir }}/privatekey.pem'
- name: Generate CSR
community.crypto.openssl_csr:
path: '{{ output_dir }}/csr.csr'
privatekey_path: '{{ output_dir }}/privatekey.pem'
path: '{{ remote_tmp_dir }}/csr.csr'
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
subject:
commonName: localhost
- name: Generate selfsigned certificate
register: selfsigned_certificate
community.crypto.openssl_certificate:
path: '{{ output_dir }}/cert.pem'
csr_path: '{{ output_dir }}/csr.csr'
privatekey_path: '{{ output_dir }}/privatekey.pem'
path: '{{ remote_tmp_dir }}/cert.pem'
csr_path: '{{ remote_tmp_dir }}/csr.csr'
privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
provider: selfsigned
selfsigned_digest: sha256
@ -75,17 +75,17 @@
- name: Download nomad binary
unarchive:
src: '{{ nomad_uri }}'
dest: '{{ output_dir }}'
dest: '{{ remote_tmp_dir }}'
remote_src: true
register: result
until: result is success
- vars:
remote_dir: '{{ echo_output_dir.stdout }}'
remote_dir: '{{ echo_remote_tmp_dir.stdout }}'
block:
- command: echo {{ output_dir }}
register: echo_output_dir
- command: echo {{ remote_tmp_dir }}
register: echo_remote_tmp_dir
- name: Run tests integration
block:

View file

@ -1,3 +1,4 @@
dependencies:
- setup_pkg_mgr
- setup_gnutar
- setup_remote_tmp_dir

View file

@ -25,7 +25,7 @@
# Setup steps
# expand remote path
- command: 'echo {{ output_dir }}'
- command: 'echo {{ remote_tmp_dir }}'
register: echo
- set_fact:
remote_dir: '{{ echo.stdout }}'

View file

@ -1,6 +1,6 @@
- name: 'Download NPM'
unarchive:
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
creates: '{{ output_dir }}/{{ nodejs_path }}.tar.gz'
creates: '{{ remote_tmp_dir }}/{{ nodejs_path }}.tar.gz'

View file

@ -0,0 +1,2 @@
dependencies:
- setup_remote_tmp_dir

View file

@ -31,13 +31,21 @@
register: find_sleep
- 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:
src: "{{ find_sleep.stdout }}"
dest: "{{ output_dir }}/{{ random_name }}"
mode: "0777"
src: obtainpid.sh
dest: "{{ remote_tmp_dir }}/obtainpid.sh"
- 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
poll: 0
@ -74,7 +82,7 @@
- name: "Reading pid from the file"
slurp:
src: "{{ output_dir }}/obtainpid.txt"
src: "{{ remote_tmp_dir }}/obtainpid.txt"
register: newpid
- name: "Verify that the Process IDs (PIDs) returned is not empty and also equal to the PIDs obtained in console"

View file

@ -33,6 +33,27 @@
extra_args: "-c {{ remote_constraints }}"
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
command: "{{ ansible_python.executable }} -c 'import OpenSSL; print(OpenSSL.__version__)'"
register: pyopenssl_version

View file

@ -1,3 +1,5 @@
cryptography_package_name: python-cryptography
cryptography_package_name_python3: python3-cryptography
pyopenssl_package_name: python-openssl
pyopenssl_package_name_python3: python3-openssl
openssl_package_name: openssl

View file

@ -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_python3: "py{{ ansible_python.version.major }}{{ ansible_python.version.minor }}-openssl"
openssl_package_name: openssl

View file

@ -1,3 +1,5 @@
cryptography_package_name: python-cryptography
cryptography_package_name_python3: python3-cryptography
pyopenssl_package_name: pyOpenSSL
pyopenssl_package_name_python3: python3-pyOpenSSL
openssl_package_name: openssl

View file

@ -1,3 +1,5 @@
cryptography_package_name: python-cryptography
cryptography_package_name_python3: python3-cryptography
pyopenssl_package_name: python-pyOpenSSL
pyopenssl_package_name_python3: python3-pyOpenSSL
openssl_package_name: openssl

View file

@ -1,2 +1,3 @@
dependencies:
- setup_remote_constraints
- setup_remote_tmp_dir

View file

@ -9,15 +9,15 @@
extra_args: "-c {{ remote_constraints }}"
- set_fact:
output_dir_test: '{{ output_dir }}/test_ssh_config'
output_test_dir: '{{ remote_tmp_dir }}/test_ssh_config'
- set_fact:
ssh_config_test: '{{ output_dir_test }}/ssh_config_test'
ssh_private_key: '{{ output_dir_test }}/fake_id_rsa'
ssh_config_test: '{{ output_test_dir }}/ssh_config_test'
ssh_private_key: '{{ output_test_dir }}/fake_id_rsa'
- name: create a temporary directory
file:
path: "{{ output_dir_test }}"
path: "{{ output_test_dir }}"
state: directory
- name: Copy sample config file

View file

@ -1,2 +1,3 @@
dependencies:
- setup_pkg_mgr
- setup_remote_tmp_dir

View file

@ -9,7 +9,7 @@
suffix: supervisorctl-tests
register: supervisord_sock_path
- command: 'echo {{ output_dir }}'
- command: 'echo {{ remote_tmp_dir }}'
register: echo
- set_fact:
remote_dir: '{{ echo.stdout }}'

View file

@ -1,3 +0,0 @@
non_local
needs/root
unsupported

View file

@ -1 +0,0 @@
buildah-container ansible_host=buildah-container ansible_connection=buildah

View file

@ -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

View file

@ -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

View file

@ -1,8 +0,0 @@
---
- hosts: buildah-container
connection: buildah
gather_facts: no
vars:
output_dir: /tmp/ansible_test_synchronize_buildah
roles:
- test_buildah_synchronize

View file

@ -1 +1 @@
test_file: "{{ output_dir }}/foo.txt"
test_file: "{{ remote_tmp_dir }}/foo.txt"

View file

@ -1,2 +1,3 @@
dependencies:
- setup_pkg_mgr
- setup_remote_tmp_dir

View file

@ -1,3 +1,4 @@
dependencies:
- setup_pkg_mgr
- setup_gnutar
- setup_remote_tmp_dir

View file

@ -6,31 +6,31 @@
- name: 'Download Nodejs'
unarchive:
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
creates: '{{ output_dir }}/{{ nodejs_path }}.tar.gz'
creates: '{{ remote_tmp_dir }}/{{ nodejs_path }}.tar.gz'
- name: 'Download Yarn'
unarchive:
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
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'
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
- name: Remove any previous Nodejs modules
file:
path: '{{output_dir}}/node_modules'
path: '{{remote_tmp_dir}}/node_modules'
state: absent
# Set vars for our test harness
- vars:
#node_bin_path: "/usr/local/lib/nodejs/node-v{{nodejs_version}}/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'
environment:
PATH: "{{ node_bin_path }}:{{ansible_env.PATH}}"
@ -45,11 +45,11 @@
- name: 'Create dummy package.json'
copy:
src: templates/package.j2
dest: '{{ output_dir }}/package.json'
dest: '{{ remote_tmp_dir }}/package.json'
- name: 'Install all packages.'
yarn:
path: '{{ output_dir }}'
path: '{{ remote_tmp_dir }}'
executable: '{{ yarn_bin_path }}/yarn'
state: present
environment:
@ -57,7 +57,7 @@
- name: 'Install the same package from package.json again.'
yarn:
path: '{{ output_dir }}'
path: '{{ remote_tmp_dir }}'
executable: '{{ yarn_bin_path }}/yarn'
name: '{{ package }}'
state: present
@ -71,7 +71,7 @@
- name: 'Install all packages in check mode.'
yarn:
path: '{{ output_dir }}'
path: '{{ remote_tmp_dir }}'
executable: '{{ yarn_bin_path }}/yarn'
state: present
environment:
@ -89,7 +89,7 @@
- name: 'Install package with explicit version (older version of package)'
yarn:
path: '{{ output_dir }}'
path: '{{ remote_tmp_dir }}'
executable: '{{ yarn_bin_path }}/yarn'
name: left-pad
version: 1.1.0
@ -104,7 +104,7 @@
- name: 'Upgrade old package'
yarn:
path: '{{ output_dir }}'
path: '{{ remote_tmp_dir }}'
executable: '{{ yarn_bin_path }}/yarn'
name: left-pad
state: latest
@ -118,7 +118,7 @@
- name: 'Remove a package'
yarn:
path: '{{ output_dir }}'
path: '{{ remote_tmp_dir }}'
executable: '{{ yarn_bin_path }}/yarn'
name: '{{ package }}'
state: absent

View file

@ -0,0 +1,2 @@
dependencies:
- setup_remote_tmp_dir

View file

@ -150,17 +150,17 @@
# INSTALL broken local package
- name: create directory
file:
path: "{{output_dir | expanduser}}/zypper1"
path: "{{remote_tmp_dir | expanduser}}/zypper1"
state: directory
- name: fake rpm package
file:
path: "{{output_dir | expanduser}}/zypper1/broken.rpm"
path: "{{remote_tmp_dir | expanduser}}/zypper1/broken.rpm"
state: touch
- name: install broken rpm
zypper:
name: "{{output_dir | expanduser}}/zypper1/broken.rpm"
name: "{{remote_tmp_dir | expanduser}}/zypper1/broken.rpm"
state: present
register: zypper_result
ignore_errors: yes
@ -191,29 +191,29 @@
- name: create directory
file:
path: "{{output_dir | expanduser}}/zypper2"
path: "{{remote_tmp_dir | expanduser}}/zypper2"
state: directory
- name: copy spec file
copy:
src: empty.spec
dest: "{{ output_dir | expanduser }}/zypper2/empty.spec"
dest: "{{ remote_tmp_dir | expanduser }}/zypper2/empty.spec"
- name: build rpm
command: |
rpmbuild -bb \
--define "_topdir {{output_dir | expanduser }}/zypper2/rpm-build"
--define "_topdir {{remote_tmp_dir | expanduser }}/zypper2/rpm-build"
--define "_builddir %{_topdir}" \
--define "_rpmdir %{_topdir}" \
--define "_srcrpmdir %{_topdir}" \
--define "_specdir {{output_dir | expanduser}}/zypper2" \
--define "_specdir {{remote_tmp_dir | expanduser}}/zypper2" \
--define "_sourcedir %{_topdir}" \
{{ output_dir }}/zypper2/empty.spec
{{ remote_tmp_dir }}/zypper2/empty.spec
register: rpm_build_result
- name: install empty rpm
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
register: zypper_result
@ -236,13 +236,13 @@
- name: extract from rpm
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
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
stat: path={{ output_dir | expanduser }}/testdir/var
stat: path={{ remote_tmp_dir | expanduser }}/testdir/var
register: stat_result
- 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.
template:
src: duplicate.spec.j2
dest: "{{ output_dir | expanduser }}/zypper2/duplicate{{ item }}.spec"
dest: "{{ remote_tmp_dir | expanduser }}/zypper2/duplicate{{ item }}.spec"
loop: "{{ looplist }}"
- name: build rpms with duplicate files
command: |
rpmbuild -bb \
--define "_topdir {{output_dir | expanduser }}/zypper2/rpm-build"
--define "_topdir {{remote_tmp_dir | expanduser }}/zypper2/rpm-build"
--define "_builddir %{_topdir}" \
--define "_rpmdir %{_topdir}" \
--define "_srcrpmdir %{_topdir}" \
--define "_specdir {{output_dir | expanduser}}/zypper2" \
--define "_specdir {{remote_tmp_dir | expanduser}}/zypper2" \
--define "_sourcedir %{_topdir}" \
{{ output_dir | expanduser }}/zypper2/duplicate{{ item }}.spec
{{ remote_tmp_dir | expanduser }}/zypper2/duplicate{{ item }}.spec
loop: "{{ looplist }}"
- name: install duplicate rpms
zypper:
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
ignore_errors: true
register: zypper_duplicate_result
@ -499,7 +499,7 @@
- name: install duplicate rpms
zypper:
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
replacefiles: true
ignore_errors: true