mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
5.6 KiB
YAML
125 lines
5.6 KiB
YAML
---
|
|
- name: create default skeleton
|
|
command: ansible-galaxy collection init ansible_test.my_collection {{ galaxy_verbosity }}
|
|
args:
|
|
chdir: '{{ galaxy_dir }}/scratch'
|
|
register: init_relative
|
|
|
|
- name: get result of create default skeleton
|
|
find:
|
|
path: '{{ galaxy_dir }}/scratch/ansible_test/my_collection'
|
|
recurse: yes
|
|
file_type: directory
|
|
register: init_relative_actual
|
|
|
|
- debug:
|
|
var: init_relative_actual.files | map(attribute='path') | list
|
|
|
|
- name: assert create default skeleton
|
|
assert:
|
|
that:
|
|
- '"Collection ansible_test.my_collection was created successfully" in init_relative.stdout'
|
|
- init_relative_actual.files | length == 4
|
|
- (init_relative_actual.files | map(attribute='path') | list)[0] | basename in ['docs', 'plugins', 'roles', 'meta']
|
|
- (init_relative_actual.files | map(attribute='path') | list)[1] | basename in ['docs', 'plugins', 'roles', 'meta']
|
|
- (init_relative_actual.files | map(attribute='path') | list)[2] | basename in ['docs', 'plugins', 'roles', 'meta']
|
|
- (init_relative_actual.files | map(attribute='path') | list)[3] | basename in ['docs', 'plugins', 'roles', 'meta']
|
|
|
|
- name: create collection with custom init path
|
|
command: ansible-galaxy collection init ansible_test2.my_collection --init-path "{{ galaxy_dir }}/scratch/custom-init-dir" {{ galaxy_verbosity }}
|
|
register: init_custom_path
|
|
|
|
- name: get result of create default skeleton
|
|
find:
|
|
path: '{{ galaxy_dir }}/scratch/custom-init-dir/ansible_test2/my_collection'
|
|
file_type: directory
|
|
register: init_custom_path_actual
|
|
|
|
- name: assert create collection with custom init path
|
|
assert:
|
|
that:
|
|
- '"Collection ansible_test2.my_collection was created successfully" in init_custom_path.stdout'
|
|
- init_custom_path_actual.files | length == 4
|
|
- (init_custom_path_actual.files | map(attribute='path') | list)[0] | basename in ['docs', 'plugins', 'roles', 'meta']
|
|
- (init_custom_path_actual.files | map(attribute='path') | list)[1] | basename in ['docs', 'plugins', 'roles', 'meta']
|
|
- (init_custom_path_actual.files | map(attribute='path') | list)[2] | basename in ['docs', 'plugins', 'roles', 'meta']
|
|
- (init_custom_path_actual.files | map(attribute='path') | list)[3] | basename in ['docs', 'plugins', 'roles', 'meta']
|
|
|
|
- name: add a directory to the init collection path to test that --force removes it
|
|
file:
|
|
state: directory
|
|
path: "{{ galaxy_dir }}/scratch/custom-init-dir/ansible_test2/my_collection/remove_me"
|
|
|
|
- name: create collection with custom init path
|
|
command: ansible-galaxy collection init ansible_test2.my_collection --init-path "{{ galaxy_dir }}/scratch/custom-init-dir" --force {{ galaxy_verbosity }}
|
|
register: init_custom_path
|
|
|
|
- name: get result of create default skeleton
|
|
find:
|
|
path: '{{ galaxy_dir }}/scratch/custom-init-dir/ansible_test2/my_collection'
|
|
file_type: directory
|
|
register: init_custom_path_actual
|
|
|
|
- name: assert create collection with custom init path
|
|
assert:
|
|
that:
|
|
- '"Collection ansible_test2.my_collection was created successfully" in init_custom_path.stdout'
|
|
- init_custom_path_actual.files | length == 4
|
|
- (init_custom_path_actual.files | map(attribute='path') | list)[0] | basename in ['docs', 'plugins', 'roles', 'meta']
|
|
- (init_custom_path_actual.files | map(attribute='path') | list)[1] | basename in ['docs', 'plugins', 'roles', 'meta']
|
|
- (init_custom_path_actual.files | map(attribute='path') | list)[2] | basename in ['docs', 'plugins', 'roles', 'meta']
|
|
- (init_custom_path_actual.files | map(attribute='path') | list)[3] | basename in ['docs', 'plugins', 'roles', 'meta']
|
|
|
|
- name: create collection in cwd with custom init path
|
|
command: ansible-galaxy collection init ansible_test2.my_collection --init-path ../../ --force {{ galaxy_verbosity }}
|
|
args:
|
|
chdir: "{{ galaxy_dir }}/scratch/custom-init-dir/ansible_test2/my_collection"
|
|
register: init_custom_path
|
|
|
|
- name: get result of create default skeleton
|
|
find:
|
|
path: '{{ galaxy_dir }}/scratch/custom-init-dir/ansible_test2/my_collection'
|
|
file_type: directory
|
|
register: init_custom_path_actual
|
|
|
|
- name: assert create collection with custom init path
|
|
assert:
|
|
that:
|
|
- '"Collection ansible_test2.my_collection was created successfully" in init_custom_path.stdout'
|
|
- init_custom_path_actual.files | length == 4
|
|
- (init_custom_path_actual.files | map(attribute='path') | list)[0] | basename in ['docs', 'plugins', 'roles', 'meta']
|
|
- (init_custom_path_actual.files | map(attribute='path') | list)[1] | basename in ['docs', 'plugins', 'roles', 'meta']
|
|
- (init_custom_path_actual.files | map(attribute='path') | list)[2] | basename in ['docs', 'plugins', 'roles', 'meta']
|
|
- (init_custom_path_actual.files | map(attribute='path') | list)[3] | basename in ['docs', 'plugins', 'roles', 'meta']
|
|
|
|
- name: create collection for ignored files and folders
|
|
command: ansible-galaxy collection init ansible_test.ignore
|
|
args:
|
|
chdir: '{{ galaxy_dir }}/scratch'
|
|
|
|
- name: create list of ignored files
|
|
set_fact:
|
|
collection_ignored_files:
|
|
- plugins/compiled.pyc
|
|
- something.retry
|
|
- .git
|
|
|
|
- name: plant ignored files into the ansible_test.ignore collection
|
|
copy:
|
|
dest: '{{ galaxy_dir }}/scratch/ansible_test/ignore/{{ item }}'
|
|
content: '{{ item }}'
|
|
loop: '{{ collection_ignored_files }}'
|
|
|
|
- name: create list of ignored directories
|
|
set_fact:
|
|
collection_ignored_directories:
|
|
- docs/.git
|
|
- plugins/doc_fragments/__pycache__
|
|
- .svn
|
|
|
|
- name: plant ignored folders into the ansible_test.ignore collection
|
|
file:
|
|
path: '{{ galaxy_dir }}/scratch/ansible_test/ignore/{{ item }}'
|
|
state: directory
|
|
loop: '{{ collection_ignored_directories }}'
|