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) (#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)
This commit is contained in:
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:
- setup_pkg_mgr
- setup_remote_tmp_dir
- prepare_tests

View file

@ -2,21 +2,21 @@
- name: Create broken link
file:
src: /nowhere
dest: "{{ output_dir }}/nowhere.txt"
dest: "{{ remote_tmp_dir }}/nowhere.txt"
state: link
force: yes
- name: Archive broken link (tar.gz)
archive:
path: "{{ output_dir }}/*.txt"
dest: "{{ output_dir }}/archive_broken_link.tar.gz"
path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ remote_tmp_dir }}/archive_broken_link.tar.gz"
- name: Archive broken link (tar.bz2)
archive:
path: "{{ output_dir }}/*.txt"
dest: "{{ output_dir }}/archive_broken_link.tar.bz2"
path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ remote_tmp_dir }}/archive_broken_link.tar.bz2"
- name: Archive broken link (zip)
archive:
path: "{{ output_dir }}/*.txt"
dest: "{{ output_dir }}/archive_broken_link.zip"
path: "{{ remote_tmp_dir }}/*.txt"
dest: "{{ remote_tmp_dir }}/archive_broken_link.zip"

View file

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

View file

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

@ -1,2 +1,3 @@
dependencies:
- prepare_tests
- 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

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

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

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,3 +1,4 @@
dependencies:
- setup_pkg_mgr
- setup_remote_tmp_dir
- prepare_tests

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,3 +1,4 @@
dependencies:
- setup_pkg_mgr
- setup_remote_tmp_dir
- prepare_tests

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

@ -2,3 +2,4 @@ dependencies:
- setup_pkg_mgr
- prepare_tests
- 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

@ -7,7 +7,7 @@
block:
- 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
@ -21,8 +21,8 @@
- 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:
@ -41,9 +41,9 @@
- 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:
@ -60,67 +60,113 @@
passphrase: hunter2
commonName: example.org
- name: Create a Java key store for the given certificates (check mode)
community.general.java_keystore: &create_key_store_data
name: example
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' }}"
- name: Read certificates
slurp:
src: "{{ remote_tmp_dir ~ '/' ~ item.name ~ '.pem' }}"
loop: &create_key_store_loop
- name: cert
- name: cert-pw
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
register: result_check
- name: Create a Java key store for the given certificates
community.general.java_keystore: *create_key_store_data
loop: *create_key_store_loop
loop_control:
index_var: loop_index
register: result
- name: Create a Java key store for the given certificates (idempotency, check mode)
community.general.java_keystore: *create_key_store_data
loop: *create_key_store_loop
loop_control:
index_var: loop_index
check_mode: yes
register: result_idem_check
- name: Create a Java key store for the given certificates (idempotency)
community.general.java_keystore: *create_key_store_data
loop: *create_key_store_loop
loop_control:
index_var: loop_index
register: result_idem
- name: Create a Java key store for the given certificates (certificate changed, check mode)
community.general.java_keystore: *create_key_store_data
- name: Read certificates (new)
slurp:
src: "{{ remote_tmp_dir ~ '/' ~ item.name ~ '.pem' }}"
loop: &create_key_store_loop_new_certs
- name: cert2
keyname: cert
- name: cert2-pw
keyname: cert-pw
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
register: result_change_check
- 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_control:
index_var: loop_index
register: result_change
- name: Create a Java key store for the given certificates (password changed, check mode)
community.general.java_keystore:
<<: *create_key_store_data
<<: *create_key_store_data_new_certs
password: hunter2
loop: *create_key_store_loop_new_certs
loop_control:
index_var: loop_index
check_mode: yes
register: result_pw_change_check
when: false # FIXME: module currently crashes
- name: Create a Java key store for the given certificates (password changed)
community.general.java_keystore:
<<: *create_key_store_data
<<: *create_key_store_data_new_certs
password: hunter2
loop: *create_key_store_loop_new_certs
loop_control:
index_var: loop_index
register: result_pw_change
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
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
@ -58,7 +66,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

@ -1,2 +1,3 @@
dependencies:
- prepare_tests
- 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