Improve CI (#3348) (#3352)

* 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)
pull/3356/head
Felix Fontein 2021-09-09 08:10:26 +02:00 committed by GitHub
parent 3735ee6df7
commit da0738badf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
62 changed files with 392 additions and 376 deletions

View File

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

View File

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

View File

@ -2,21 +2,21 @@
- name: Create broken link - name: Create broken link
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 (tar.gz) - name: Archive broken link (tar.gz)
archive: archive:
path: "{{ output_dir }}/*.txt" path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ output_dir }}/archive_broken_link.tar.gz" dest: "{{ remote_tmp_dir }}/archive_broken_link.tar.gz"
- name: Archive broken link (tar.bz2) - name: Archive broken link (tar.bz2)
archive: archive:
path: "{{ output_dir }}/*.txt" path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ output_dir }}/archive_broken_link.tar.bz2" dest: "{{ remote_tmp_dir }}/archive_broken_link.tar.bz2"
- name: Archive broken link (zip) - name: Archive broken link (zip)
archive: archive:
path: "{{ output_dir }}/*.txt" path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ output_dir }}/archive_broken_link.zip" dest: "{{ remote_tmp_dir }}/archive_broken_link.zip"

View File

@ -74,7 +74,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
@ -84,15 +84,15 @@
- name: archive using gz - name: archive using gz
archive: archive:
path: "{{ output_dir }}/*.txt" path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ output_dir }}/archive_01.gz" dest: "{{ remote_tmp_dir }}/archive_01.gz"
format: gz format: gz
register: archive_gz_result_01 register: archive_gz_result_01
- debug: msg="{{ archive_gz_result_01 }}" - debug: msg="{{ archive_gz_result_01 }}"
- name: verify that the files archived - name: verify that the files archived
file: path={{output_dir}}/archive_01.gz state=file file: path={{remote_tmp_dir}}/archive_01.gz state=file
- name: check if gz file exists and includes all text files - name: check if gz file exists and includes all text files
assert: assert:
@ -103,15 +103,15 @@
- name: archive using zip - name: archive using zip
archive: archive:
path: "{{ output_dir }}/*.txt" path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ output_dir }}/archive_01.zip" dest: "{{ remote_tmp_dir }}/archive_01.zip"
format: zip format: zip
register: archive_zip_result_01 register: archive_zip_result_01
- debug: msg="{{ archive_zip_result_01 }}" - debug: msg="{{ archive_zip_result_01 }}"
- name: verify that the files archived - name: verify that the files archived
file: path={{output_dir}}/archive_01.zip state=file file: path={{remote_tmp_dir}}/archive_01.zip state=file
- name: check if zip file exists - name: check if zip file exists
assert: assert:
@ -122,15 +122,15 @@
- name: archive using bz2 - name: archive using bz2
archive: archive:
path: "{{ output_dir }}/*.txt" path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ output_dir }}/archive_01.bz2" dest: "{{ remote_tmp_dir }}/archive_01.bz2"
format: bz2 format: bz2
register: archive_bz2_result_01 register: archive_bz2_result_01
- debug: msg="{{ archive_bz2_result_01 }}" - debug: msg="{{ archive_bz2_result_01 }}"
- name: verify that the files archived - name: verify that the files archived
file: path={{output_dir}}/archive_01.bz2 state=file file: path={{remote_tmp_dir}}/archive_01.bz2 state=file
- name: check if bzip file exists - name: check if bzip file exists
assert: assert:
@ -141,15 +141,15 @@
- name: archive using xz - name: archive using xz
archive: archive:
path: "{{ output_dir }}/*.txt" path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ output_dir }}/archive_01.xz" dest: "{{ remote_tmp_dir }}/archive_01.xz"
format: xz format: xz
register: archive_xz_result_01 register: archive_xz_result_01
- debug: msg="{{ archive_xz_result_01 }}" - debug: msg="{{ archive_xz_result_01 }}"
- name: verify that the files archived - name: verify that the files archived
file: path={{output_dir}}/archive_01.xz state=file file: path={{remote_tmp_dir}}/archive_01.xz state=file
- name: check if xz file exists - name: check if xz file exists
assert: assert:
@ -160,15 +160,15 @@
- name: archive and set mode to 0600 - name: archive and set mode to 0600
archive: archive:
path: "{{ output_dir }}/*.txt" path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ output_dir }}/archive_02.gz" dest: "{{ remote_tmp_dir }}/archive_02.gz"
format: gz format: gz
mode: "u+rwX,g-rwx,o-rwx" mode: "u+rwX,g-rwx,o-rwx"
register: archive_bz2_result_02 register: archive_bz2_result_02
- name: Test that the file modes were changed - name: Test that the file modes were changed
stat: stat:
path: "{{ output_dir }}/archive_02.gz" path: "{{ remote_tmp_dir }}/archive_02.gz"
register: archive_02_gz_stat register: archive_02_gz_stat
- debug: msg="{{ archive_02_gz_stat}}" - debug: msg="{{ archive_02_gz_stat}}"
@ -182,20 +182,20 @@
- "{{ archive_bz2_result_02['archived']| length}} == 3" - "{{ archive_bz2_result_02['archived']| length}} == 3"
- name: remove our gz - name: remove our gz
file: path="{{ output_dir }}/archive_02.gz" state=absent file: path="{{ remote_tmp_dir }}/archive_02.gz" state=absent
- name: archive and set mode to 0600 - name: archive and set mode to 0600
archive: archive:
path: "{{ output_dir }}/*.txt" path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ output_dir }}/archive_02.zip" dest: "{{ remote_tmp_dir }}/archive_02.zip"
format: zip format: zip
mode: "u+rwX,g-rwx,o-rwx" mode: "u+rwX,g-rwx,o-rwx"
register: archive_zip_result_02 register: archive_zip_result_02
- name: Test that the file modes were changed - name: Test that the file modes were changed
stat: stat:
path: "{{ output_dir }}/archive_02.zip" path: "{{ remote_tmp_dir }}/archive_02.zip"
register: archive_02_zip_stat register: archive_02_zip_stat
- name: Test that the file modes were changed - name: Test that the file modes were changed
@ -207,20 +207,20 @@
- "{{ archive_zip_result_02['archived']| length}} == 3" - "{{ archive_zip_result_02['archived']| length}} == 3"
- name: remove our zip - name: remove our zip
file: path="{{ output_dir }}/archive_02.zip" state=absent file: path="{{ remote_tmp_dir }}/archive_02.zip" state=absent
- name: archive and set mode to 0600 - name: archive and set mode to 0600
archive: archive:
path: "{{ output_dir }}/*.txt" path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ output_dir }}/archive_02.bz2" dest: "{{ remote_tmp_dir }}/archive_02.bz2"
format: bz2 format: bz2
mode: "u+rwX,g-rwx,o-rwx" mode: "u+rwX,g-rwx,o-rwx"
register: archive_bz2_result_02 register: archive_bz2_result_02
- name: Test that the file modes were changed - name: Test that the file modes were changed
stat: stat:
path: "{{ output_dir }}/archive_02.bz2" path: "{{ remote_tmp_dir }}/archive_02.bz2"
register: archive_02_bz2_stat register: archive_02_bz2_stat
- name: Test that the file modes were changed - name: Test that the file modes were changed
@ -232,19 +232,19 @@
- "{{ archive_bz2_result_02['archived']| length}} == 3" - "{{ archive_bz2_result_02['archived']| length}} == 3"
- name: remove our bz2 - name: remove our bz2
file: path="{{ output_dir }}/archive_02.bz2" state=absent file: path="{{ remote_tmp_dir }}/archive_02.bz2" state=absent
- name: archive and set mode to 0600 - name: archive and set mode to 0600
archive: archive:
path: "{{ output_dir }}/*.txt" path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ output_dir }}/archive_02.xz" dest: "{{ remote_tmp_dir }}/archive_02.xz"
format: xz format: xz
mode: "u+rwX,g-rwx,o-rwx" mode: "u+rwX,g-rwx,o-rwx"
register: archive_xz_result_02 register: archive_xz_result_02
- name: Test that the file modes were changed - name: Test that the file modes were changed
stat: stat:
path: "{{ output_dir }}/archive_02.xz" path: "{{ remote_tmp_dir }}/archive_02.xz"
register: archive_02_xz_stat register: archive_02_xz_stat
- name: Test that the file modes were changed - name: Test that the file modes were changed
@ -256,20 +256,20 @@
- "{{ archive_xz_result_02['archived']| length}} == 3" - "{{ archive_xz_result_02['archived']| length}} == 3"
- name: remove our xz - name: remove our xz
file: path="{{ output_dir }}/archive_02.xz" state=absent file: path="{{ remote_tmp_dir }}/archive_02.xz" state=absent
- name: archive multiple files as list - name: archive multiple files as list
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_list.gz" dest: "{{ remote_tmp_dir }}/archive_list.gz"
format: gz format: gz
register: archive_gz_list_result register: archive_gz_list_result
- name: verify that the files archived - name: verify that the files archived
file: path={{output_dir}}/archive_list.gz state=file file: path={{remote_tmp_dir}}/archive_list.gz state=file
- name: check if gz file exists and includes all text files - name: check if gz file exists and includes all text files
assert: assert:
@ -279,18 +279,18 @@
- "{{ archive_gz_list_result['archived'] | length }} == 3" - "{{ archive_gz_list_result['archived'] | length }} == 3"
- name: remove our gz - name: remove our gz
file: path="{{ output_dir }}/archive_list.gz" state=absent file: path="{{ remote_tmp_dir }}/archive_list.gz" state=absent
- name: test that gz archive that contains non-ascii filenames - name: test that gz archive that contains non-ascii filenames
archive: archive:
path: "{{ output_dir }}/*.txt" path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ output_dir }}/test-archive-nonascii-くらとみ.tar.gz" dest: "{{ remote_tmp_dir }}/test-archive-nonascii-くらとみ.tar.gz"
format: gz format: gz
register: nonascii_result_0 register: nonascii_result_0
- name: Check that file is really there - name: Check that file is really there
stat: stat:
path: "{{ output_dir }}/test-archive-nonascii-くらとみ.tar.gz" path: "{{ remote_tmp_dir }}/test-archive-nonascii-くらとみ.tar.gz"
register: nonascii_stat0 register: nonascii_stat0
- name: Assert that nonascii tests succeeded - name: Assert that nonascii tests succeeded
@ -300,18 +300,18 @@
- "nonascii_stat0.stat.exists == true" - "nonascii_stat0.stat.exists == true"
- name: remove nonascii test - name: remove nonascii test
file: path="{{ output_dir }}/test-archive-nonascii-くらとみ.tar.gz" state=absent file: path="{{ remote_tmp_dir }}/test-archive-nonascii-くらとみ.tar.gz" state=absent
- name: test that bz2 archive that contains non-ascii filenames - name: test that bz2 archive that contains non-ascii filenames
archive: archive:
path: "{{ output_dir }}/*.txt" path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ output_dir }}/test-archive-nonascii-くらとみ.bz2" dest: "{{ remote_tmp_dir }}/test-archive-nonascii-くらとみ.bz2"
format: bz2 format: bz2
register: nonascii_result_1 register: nonascii_result_1
- name: Check that file is really there - name: Check that file is really there
stat: stat:
path: "{{ output_dir }}/test-archive-nonascii-くらとみ.bz2" path: "{{ remote_tmp_dir }}/test-archive-nonascii-くらとみ.bz2"
register: nonascii_stat_1 register: nonascii_stat_1
- name: Assert that nonascii tests succeeded - name: Assert that nonascii tests succeeded
@ -321,18 +321,18 @@
- "nonascii_stat_1.stat.exists == true" - "nonascii_stat_1.stat.exists == true"
- name: remove nonascii test - name: remove nonascii test
file: path="{{ output_dir }}/test-archive-nonascii-くらとみ.bz2" state=absent file: path="{{ remote_tmp_dir }}/test-archive-nonascii-くらとみ.bz2" state=absent
- name: test that xz archive that contains non-ascii filenames - name: test that xz archive that contains non-ascii filenames
archive: archive:
path: "{{ output_dir }}/*.txt" path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ output_dir }}/test-archive-nonascii-くらとみ.xz" dest: "{{ remote_tmp_dir }}/test-archive-nonascii-くらとみ.xz"
format: xz format: xz
register: nonascii_result_1 register: nonascii_result_1
- name: Check that file is really there - name: Check that file is really there
stat: stat:
path: "{{ output_dir }}/test-archive-nonascii-くらとみ.xz" path: "{{ remote_tmp_dir }}/test-archive-nonascii-くらとみ.xz"
register: nonascii_stat_1 register: nonascii_stat_1
- name: Assert that nonascii tests succeeded - name: Assert that nonascii tests succeeded
@ -342,18 +342,18 @@
- "nonascii_stat_1.stat.exists == true" - "nonascii_stat_1.stat.exists == true"
- name: remove nonascii test - name: remove nonascii test
file: path="{{ output_dir }}/test-archive-nonascii-くらとみ.xz" state=absent file: path="{{ remote_tmp_dir }}/test-archive-nonascii-くらとみ.xz" state=absent
- name: test that zip archive that contains non-ascii filenames - name: test that zip archive that contains non-ascii filenames
archive: archive:
path: "{{ output_dir }}/*.txt" path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ output_dir }}/test-archive-nonascii-くらとみ.zip" dest: "{{ remote_tmp_dir }}/test-archive-nonascii-くらとみ.zip"
format: zip format: zip
register: nonascii_result_2 register: nonascii_result_2
- name: Check that file is really there - name: Check that file is really there
stat: stat:
path: "{{ output_dir }}/test-archive-nonascii-くらとみ.zip" path: "{{ remote_tmp_dir }}/test-archive-nonascii-くらとみ.zip"
register: nonascii_stat_2 register: nonascii_stat_2
- name: Assert that nonascii tests succeeded - name: Assert that nonascii tests succeeded
@ -363,32 +363,32 @@
- "nonascii_stat_2.stat.exists == true" - "nonascii_stat_2.stat.exists == true"
- name: remove nonascii test - name: remove nonascii test
file: path="{{ output_dir }}/test-archive-nonascii-くらとみ.zip" state=absent file: path="{{ remote_tmp_dir }}/test-archive-nonascii-くらとみ.zip" state=absent
- name: Test that excluded paths do not influence archive root - name: Test that excluded paths do not influence archive root
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 }}/test-archive-root.tgz" dest: "{{ remote_tmp_dir }}/test-archive-root.tgz"
register: archive_root_result register: archive_root_result
- name: Assert that excluded paths do not influence archive root - name: Assert that excluded paths do not influence archive root
assert: assert:
that: that:
- archive_root_result.arcroot != output_dir - archive_root_result.arcroot != remote_tmp_dir
- name: Remove archive root test - name: Remove archive root test
file: file:
path: "{{ output_dir }}/test-archive-root.tgz" path: "{{ remote_tmp_dir }}/test-archive-root.tgz"
state: absent state: absent
- name: Test Single Target with format={{ item }} - name: Test Single Target with format={{ item }}
archive: archive:
path: "{{ output_dir }}/foo.txt" path: "{{ remote_tmp_dir }}/foo.txt"
dest: "{{ output_dir }}/test-single-target.{{ item }}" dest: "{{ remote_tmp_dir }}/test-single-target.{{ item }}"
format: "{{ item }}" format: "{{ item }}"
register: "single_target_test" register: "single_target_test"
loop: loop:
@ -410,7 +410,7 @@
- name: Retrieve contents of single target archives - name: Retrieve contents of single target archives
ansible.builtin.unarchive: ansible.builtin.unarchive:
src: "{{ output_dir }}/test-single-target.zip" src: "{{ remote_tmp_dir }}/test-single-target.zip"
dest: . dest: .
list_files: true list_files: true
check_mode: true check_mode: true
@ -427,7 +427,7 @@
- name: Remove single target test with format={{ item }} - name: Remove single target test with format={{ item }}
file: file:
path: "{{ output_dir }}/test-single-target.{{ item }}" path: "{{ remote_tmp_dir }}/test-single-target.{{ item }}"
state: absent state: absent
loop: loop:
- zip - zip
@ -439,22 +439,22 @@
- name: Test that missing files result in incomplete state - name: Test that missing files result in incomplete state
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 }}/test-incomplete-archive.tgz" dest: "{{ remote_tmp_dir }}/test-incomplete-archive.tgz"
register: incomplete_archive_result register: incomplete_archive_result
- name: Assert that incomplete archive has incomplete state - name: Assert that incomplete archive has incomplete state
assert: assert:
that: that:
- incomplete_archive_result is changed - incomplete_archive_result is changed
- "'{{ output_dir }}/dne.txt' in incomplete_archive_result.missing" - "'{{ remote_tmp_dir }}/dne.txt' in incomplete_archive_result.missing"
- "'{{ output_dir }}/foo.txt' not in incomplete_archive_result.missing" - "'{{ remote_tmp_dir }}/foo.txt' not in incomplete_archive_result.missing"
- name: Remove incomplete archive - name: Remove incomplete archive
file: file:
path: "{{ output_dir }}/test-incomplete-archive.tgz" path: "{{ remote_tmp_dir }}/test-incomplete-archive.tgz"
state: absent state: absent
- name: Remove backports.lzma if previously installed (pip) - name: Remove backports.lzma if previously installed (pip)

View File

@ -1,8 +1,8 @@
--- ---
- name: archive using gz and remove src files - name: archive using gz and remove src files
archive: archive:
path: "{{ output_dir }}/*.txt" path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ output_dir }}/archive_remove_01.gz" dest: "{{ remote_tmp_dir }}/archive_remove_01.gz"
format: gz format: gz
remove: yes remove: yes
register: archive_remove_result_01 register: archive_remove_result_01
@ -10,7 +10,7 @@
- debug: msg="{{ archive_remove_result_01 }}" - debug: msg="{{ archive_remove_result_01 }}"
- name: verify that the files archived - name: verify that the files archived
file: path={{ output_dir }}/archive_remove_01.gz state=file file: path={{ remote_tmp_dir }}/archive_remove_01.gz state=file
- name: check if gz file exists and includes all text files and src files has been removed - name: check if gz file exists and includes all text files and src files has been removed
assert: assert:
@ -20,19 +20,19 @@
- "{{ archive_remove_result_01['archived'] | length }} == 3" - "{{ archive_remove_result_01['archived'] | length }} == 3"
- name: remove our gz - name: remove our gz
file: path="{{ output_dir }}/archive_remove_01.gz" state=absent file: path="{{ remote_tmp_dir }}/archive_remove_01.gz" state=absent
- name: check if src files has been removed - name: check if src files has been removed
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
- empty.txt - empty.txt
- name: prep our files again - name: prep our files again
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
@ -40,11 +40,11 @@
- name: create a temporary directory to be check if it will be removed - name: create a temporary directory to be check if it will be removed
file: file:
path: "{{ output_dir }}/tmpdir" path: "{{ remote_tmp_dir }}/tmpdir"
state: directory state: directory
- name: prep our files in tmpdir - name: prep our files in tmpdir
copy: src={{ item }} dest={{ output_dir }}/tmpdir/{{ item }} copy: src={{ item }} dest={{ remote_tmp_dir }}/tmpdir/{{ item }}
with_items: with_items:
- foo.txt - foo.txt
- bar.txt - bar.txt
@ -52,8 +52,8 @@
- name: archive using gz and remove src directory - name: archive using gz and remove src directory
archive: archive:
path: "{{ output_dir }}/tmpdir" path: "{{ remote_tmp_dir }}/tmpdir"
dest: "{{ output_dir }}/archive_remove_02.gz" dest: "{{ remote_tmp_dir }}/archive_remove_02.gz"
format: gz format: gz
remove: yes remove: yes
register: archive_remove_result_02 register: archive_remove_result_02
@ -61,7 +61,7 @@
- debug: msg="{{ archive_remove_result_02 }}" - debug: msg="{{ archive_remove_result_02 }}"
- name: verify that the files archived - name: verify that the files archived
file: path={{ output_dir }}/archive_remove_02.gz state=file file: path={{ remote_tmp_dir }}/archive_remove_02.gz state=file
- name: check if gz file exists and includes all text files - name: check if gz file exists and includes all text files
assert: assert:
@ -71,20 +71,20 @@
- "{{ archive_remove_result_02['archived'] | length }} == 3" - "{{ archive_remove_result_02['archived'] | length }} == 3"
- name: remove our gz - name: remove our gz
file: path="{{ output_dir }}/archive_remove_02.gz" state=absent file: path="{{ remote_tmp_dir }}/archive_remove_02.gz" state=absent
- name: check if src folder has been removed - name: check if src folder has been removed
assert: assert:
that: that:
- "'{{ output_dir }}/tmpdir' is not exists" - "'{{ remote_tmp_dir }}/tmpdir' is not exists"
- name: create temporary directory again - name: create temporary directory again
file: file:
path: "{{ output_dir }}/tmpdir" path: "{{ remote_tmp_dir }}/tmpdir"
state: directory state: directory
- name: prep our files in tmpdir again - name: prep our files in tmpdir again
copy: src={{ item }} dest={{ output_dir }}/tmpdir/{{ item }} copy: src={{ item }} dest={{ remote_tmp_dir }}/tmpdir/{{ item }}
with_items: with_items:
- foo.txt - foo.txt
- bar.txt - bar.txt
@ -92,17 +92,17 @@
- name: archive using gz and remove src directory excluding one file - name: archive using gz and remove src directory excluding one file
archive: archive:
path: "{{ output_dir }}/tmpdir/*" path: "{{ remote_tmp_dir }}/tmpdir/*"
dest: "{{ output_dir }}/archive_remove_03.gz" dest: "{{ remote_tmp_dir }}/archive_remove_03.gz"
format: gz format: gz
remove: yes remove: yes
exclude_path: "{{ output_dir }}/tmpdir/empty.txt" exclude_path: "{{ remote_tmp_dir }}/tmpdir/empty.txt"
register: archive_remove_result_03 register: archive_remove_result_03
- debug: msg="{{ archive_remove_result_03 }}" - debug: msg="{{ archive_remove_result_03 }}"
- name: verify that the files archived - name: verify that the files archived
file: path={{ output_dir }}/archive_remove_03.gz state=file file: path={{ remote_tmp_dir }}/archive_remove_03.gz state=file
- name: check if gz file exists and includes all text files - name: check if gz file exists and includes all text files
assert: assert:
@ -112,13 +112,13 @@
- "{{ archive_remove_result_03['archived'] | length }} == 2" - "{{ archive_remove_result_03['archived'] | length }} == 2"
- name: remove our gz - name: remove our gz
file: path="{{ output_dir }}/archive_remove_03.gz" state=absent file: path="{{ remote_tmp_dir }}/archive_remove_03.gz" state=absent
- name: verify that excluded file is still present - name: verify that excluded file is still present
file: path={{ output_dir }}/tmpdir/empty.txt state=file file: path={{ remote_tmp_dir }}/tmpdir/empty.txt state=file
- name: prep our files in tmpdir again - name: prep our files in tmpdir again
copy: src={{ item }} dest={{ output_dir }}/tmpdir/{{ item }} copy: src={{ item }} dest={{ remote_tmp_dir }}/tmpdir/{{ item }}
with_items: with_items:
- foo.txt - foo.txt
- bar.txt - bar.txt
@ -129,27 +129,27 @@
- name: archive using gz and remove src directory - name: archive using gz and remove src directory
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_04.gz" dest: "{{ remote_tmp_dir }}/archive_remove_04.gz"
format: gz format: gz
remove: yes remove: yes
exclude_path: "{{ output_dir }}/tmpdir/sub/subfile.txt" exclude_path: "{{ remote_tmp_dir }}/tmpdir/sub/subfile.txt"
register: archive_remove_result_04 register: archive_remove_result_04
- debug: msg="{{ archive_remove_result_04 }}" - debug: msg="{{ archive_remove_result_04 }}"
- name: verify that the files archived - name: verify that the files archived
file: path={{ output_dir }}/archive_remove_04.gz state=file file: path={{ remote_tmp_dir }}/archive_remove_04.gz state=file
- name: remove our gz - name: remove our gz
file: path="{{ output_dir }}/archive_remove_04.gz" state=absent file: path="{{ remote_tmp_dir }}/archive_remove_04.gz" state=absent
- name: verify that excluded sub file is still present - name: verify that excluded sub file is still present
file: path={{ output_dir }}/tmpdir/sub/subfile.txt state=file file: path={{ remote_tmp_dir }}/tmpdir/sub/subfile.txt state=file
- name: prep our files in tmpdir again - name: prep our files in tmpdir again
copy: src={{ item }} dest={{ output_dir }}/tmpdir/{{ item }} copy: src={{ item }} dest={{ remote_tmp_dir }}/tmpdir/{{ item }}
with_items: with_items:
- foo.txt - foo.txt
- bar.txt - bar.txt
@ -160,19 +160,19 @@
- name: archive using gz and remove src directory - name: archive using gz and remove src directory
archive: archive:
path: path:
- "{{ output_dir }}/tmpdir/" - "{{ remote_tmp_dir }}/tmpdir/"
dest: "{{ output_dir }}/archive_remove_05.gz" dest: "{{ remote_tmp_dir }}/archive_remove_05.gz"
format: gz format: gz
remove: yes remove: yes
exclude_path: "{{ output_dir }}/tmpdir/sub/subfile.txt" exclude_path: "{{ remote_tmp_dir }}/tmpdir/sub/subfile.txt"
register: archive_remove_result_05 register: archive_remove_result_05
- name: verify that the files archived - name: verify that the files archived
file: path={{ output_dir }}/archive_remove_05.gz state=file file: path={{ remote_tmp_dir }}/archive_remove_05.gz state=file
- name: Verify source files were removed - name: Verify source files were removed
file: file:
path: "{{ output_dir }}/tmpdir" path: "{{ remote_tmp_dir }}/tmpdir"
state: absent state: absent
register: archive_source_file_removal_05 register: archive_source_file_removal_05
@ -183,4 +183,4 @@
- archive_source_file_removal_05 is not changed - archive_source_file_removal_05 is not changed
- name: remove our gz - name: remove our gz
file: path="{{ output_dir }}/archive_remove_05.gz" state=absent file: path="{{ remote_tmp_dir }}/archive_remove_05.gz" state=absent

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,3 +2,4 @@ dependencies:
- setup_pkg_mgr - setup_pkg_mgr
- prepare_tests - prepare_tests
- setup_epel - setup_epel
- setup_remote_tmp_dir

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,7 +7,7 @@
block: block:
- 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
@ -21,8 +21,8 @@
- 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: loop:
@ -41,9 +41,9 @@
- 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: loop:
@ -60,67 +60,113 @@
passphrase: hunter2 passphrase: hunter2
commonName: example.org commonName: example.org
- name: Create a Java key store for the given certificates (check mode) - name: Read certificates
community.general.java_keystore: &create_key_store_data slurp:
name: example src: "{{ remote_tmp_dir ~ '/' ~ item.name ~ '.pem' }}"
certificate: "{{ lookup('file', output_dir ~ '/' ~ item.name ~ '.pem') }}"
private_key: "{{ lookup('file', output_dir ~ '/' ~ (item.keyname | default(item.name)) ~ '.key') }}"
private_key_passphrase: "{{ item.passphrase | default(omit) }}"
password: changeit
dest: "{{ output_dir ~ '/' ~ (item.keyname | default(item.name)) ~ '.jks' }}"
loop: &create_key_store_loop loop: &create_key_store_loop
- name: cert - name: cert
- name: cert-pw - name: cert-pw
passphrase: hunter2 passphrase: hunter2
register: certificates
- name: Read certificate keys
slurp:
src: "{{ remote_tmp_dir ~ '/' ~ (item.keyname | d(item.name)) ~ '.key' }}"
loop: *create_key_store_loop
register: certificate_keys
- name: Create a Java key store for the given certificates (check mode)
community.general.java_keystore: &create_key_store_data
name: example
certificate: "{{ certificates.results[loop_index].content | b64decode }}"
private_key: "{{ certificate_keys.results[loop_index].content | b64decode }}"
private_key_passphrase: "{{ item.passphrase | default(omit) }}"
password: changeit
dest: "{{ remote_tmp_dir ~ '/' ~ (item.keyname | default(item.name)) ~ '.jks' }}"
loop: *create_key_store_loop
loop_control:
index_var: loop_index
check_mode: yes check_mode: yes
register: result_check register: result_check
- name: Create a Java key store for the given certificates - name: Create a Java key store for the given certificates
community.general.java_keystore: *create_key_store_data community.general.java_keystore: *create_key_store_data
loop: *create_key_store_loop loop: *create_key_store_loop
loop_control:
index_var: loop_index
register: result register: result
- name: Create a Java key store for the given certificates (idempotency, check mode) - name: Create a Java key store for the given certificates (idempotency, check mode)
community.general.java_keystore: *create_key_store_data community.general.java_keystore: *create_key_store_data
loop: *create_key_store_loop loop: *create_key_store_loop
loop_control:
index_var: loop_index
check_mode: yes check_mode: yes
register: result_idem_check register: result_idem_check
- name: Create a Java key store for the given certificates (idempotency) - name: Create a Java key store for the given certificates (idempotency)
community.general.java_keystore: *create_key_store_data community.general.java_keystore: *create_key_store_data
loop: *create_key_store_loop loop: *create_key_store_loop
loop_control:
index_var: loop_index
register: result_idem register: result_idem
- name: Create a Java key store for the given certificates (certificate changed, check mode) - name: Read certificates (new)
community.general.java_keystore: *create_key_store_data slurp:
src: "{{ remote_tmp_dir ~ '/' ~ item.name ~ '.pem' }}"
loop: &create_key_store_loop_new_certs loop: &create_key_store_loop_new_certs
- name: cert2 - name: cert2
keyname: cert keyname: cert
- name: cert2-pw - name: cert2-pw
keyname: cert-pw keyname: cert-pw
passphrase: hunter2 passphrase: hunter2
register: certificates_new
- name: Read certificate keys (new)
slurp:
src: "{{ remote_tmp_dir ~ '/' ~ (item.keyname | d(item.name)) ~ '.key' }}"
loop: *create_key_store_loop_new_certs
register: certificate_keys_new
- name: Create a Java key store for the given certificates (certificate changed, check mode)
community.general.java_keystore: &create_key_store_data_new_certs
name: example
certificate: "{{ certificates_new.results[loop_index].content | b64decode }}"
private_key: "{{ certificate_keys_new.results[loop_index].content | b64decode }}"
private_key_passphrase: "{{ item.passphrase | default(omit) }}"
password: changeit
dest: "{{ remote_tmp_dir ~ '/' ~ (item.keyname | default(item.name)) ~ '.jks' }}"
loop: *create_key_store_loop_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 key store for the given certificates (certificate changed) - name: Create a Java key store for the given certificates (certificate changed)
community.general.java_keystore: *create_key_store_data community.general.java_keystore: *create_key_store_data_new_certs
loop: *create_key_store_loop_new_certs loop: *create_key_store_loop_new_certs
loop_control:
index_var: loop_index
register: result_change register: result_change
- name: Create a Java key store for the given certificates (password changed, check mode) - name: Create a Java key store for the given certificates (password changed, check mode)
community.general.java_keystore: community.general.java_keystore:
<<: *create_key_store_data <<: *create_key_store_data_new_certs
password: hunter2 password: hunter2
loop: *create_key_store_loop_new_certs loop: *create_key_store_loop_new_certs
loop_control:
index_var: loop_index
check_mode: yes check_mode: yes
register: result_pw_change_check register: result_pw_change_check
when: false # FIXME: module currently crashes when: false # FIXME: module currently crashes
- name: Create a Java key store for the given certificates (password changed) - name: Create a Java key store for the given certificates (password changed)
community.general.java_keystore: community.general.java_keystore:
<<: *create_key_store_data <<: *create_key_store_data_new_certs
password: hunter2 password: hunter2
loop: *create_key_store_loop_new_certs loop: *create_key_store_loop_new_certs
loop_control:
index_var: loop_index
register: result_pw_change register: result_pw_change
when: false # FIXME: module currently crashes when: false # FIXME: module currently crashes

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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
@ -58,7 +66,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"

View File

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

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: python-openssl
pyopenssl_package_name_python3: python3-openssl pyopenssl_package_name_python3: python3-openssl
openssl_package_name: 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: 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

View File

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

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: python-pyOpenSSL
pyopenssl_package_name_python3: python3-pyOpenSSL pyopenssl_package_name_python3: python3-pyOpenSSL
openssl_package_name: openssl openssl_package_name: openssl

View File

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

View File

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

View File

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

View File

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

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: dependencies:
- setup_pkg_mgr - setup_pkg_mgr
- setup_remote_tmp_dir

View File

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

View File

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

View File

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

View File

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