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.
ansible/test/integration/targets/ansible-galaxy-role/tasks/main.yml

59 lines
1.5 KiB
YAML

- name: Archive directories
file:
state: directory
path: "{{ remote_tmp_dir }}/role.d/{{item}}"
loop:
- meta
- tasks
- name: Metadata file
copy:
content: "'galaxy_info': {}"
dest: "{{ remote_tmp_dir }}/role.d/meta/main.yml"
- name: Valid files
copy:
content: ""
dest: "{{ remote_tmp_dir }}/role.d/tasks/{{item}}"
loop:
- "main.yml"
- "valid~file.yml"
- name: Valid role archive
command: "tar cf {{ remote_tmp_dir }}/valid-role.tar {{ remote_tmp_dir }}/role.d"
- name: Invalid file
copy:
content: ""
dest: "{{ remote_tmp_dir }}/role.d/tasks/~invalid.yml"
- name: Valid requirements file
copy:
dest: valid-requirements.yml
content: "[{'src': '{{ remote_tmp_dir }}/valid-role.tar', 'name': 'valid-testrole'}]"
- name: Invalid role archive
command: "tar cf {{ remote_tmp_dir }}/invalid-role.tar {{ remote_tmp_dir }}/role.d"
- name: Invalid requirements file
copy:
dest: invalid-requirements.yml
content: "[{'src': '{{ remote_tmp_dir }}/invalid-role.tar', 'name': 'invalid-testrole'}]"
- name: Install valid role
command: ansible-galaxy install -r valid-requirements.yml
- name: Uninstall valid role
command: ansible-galaxy role remove valid-testrole
- name: Install invalid role
command: ansible-galaxy install -r invalid-requirements.yml
ignore_errors: yes
register: invalid
- assert:
that: "invalid.rc != 0"
- name: Uninstall invalid role
command: ansible-galaxy role remove invalid-testrole