From c073e39c696e39b9f53391a26d0bd46f3585f969 Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Wed, 4 Mar 2020 13:53:06 -0500 Subject: [PATCH] Simplify build loop, make demo data in tests --- awx_collection/template_galaxy.yml | 20 +++++++--------- .../targets/demo_data/tasks/main.yml | 24 +++++++++++++++++++ 2 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 awx_collection/tests/integration/targets/demo_data/tasks/main.yml diff --git a/awx_collection/template_galaxy.yml b/awx_collection/template_galaxy.yml index efe200a440..fbfb89c451 100644 --- a/awx_collection/template_galaxy.yml +++ b/awx_collection/template_galaxy.yml @@ -10,22 +10,17 @@ tasks: - name: Do file content replacements for non-default namespace or package name block: - - name: Find all module files - find: - paths: "{{ playbook_dir }}/plugins/modules" - patterns: "*.py" - register: module_files - - name: Change files to support desired namespace and package names + - name: Change module doc_fragments to support desired namespace and package names replace: - path: "{{ item.path }}" + path: "{{ item }}" regexp: '^extends_documentation_fragment: awx.awx.auth$' replace: 'extends_documentation_fragment: {{ collection_namespace }}.{{ collection_package }}.auth' - loop: "{{ module_files.files }}" + with_fileglob: "{{ playbook_dir }}/plugins/modules/tower_*.py" loop_control: - label: "{{ item.path | basename }}" + label: "{{ item | basename }}" - - name: Change files to support desired namespace and package names + - name: Change inventory file to support desired namespace and package names replace: path: "{{ playbook_dir }}/plugins/inventory/tower.py" regexp: "^ NAME = 'awx.awx.tower' # REPLACE$" @@ -34,4 +29,7 @@ - (collection_package != 'awx') or (collection_namespace != 'awx') - name: Template the galaxy.yml file - template: src={{ playbook_dir }}/galaxy.yml.j2 dest={{ playbook_dir }}/galaxy.yml + template: + src: "{{ playbook_dir }}/galaxy.yml.j2" + dest: "{{ playbook_dir }}/galaxy.yml" + force: true diff --git a/awx_collection/tests/integration/targets/demo_data/tasks/main.yml b/awx_collection/tests/integration/targets/demo_data/tasks/main.yml new file mode 100644 index 0000000000..cce9cc1f51 --- /dev/null +++ b/awx_collection/tests/integration/targets/demo_data/tasks/main.yml @@ -0,0 +1,24 @@ +--- +- name: Assure that default organization exists + tower_organization: + name: Default + +- name: Assure that demo project exists + tower_project: + name: "Demo Project" + scm_type: 'git' + scm_url: 'https://github.com/ansible/ansible-tower-samples' + scm_update_on_launch: true + organization: Default + +- name: Assure that demo inventory exists + tower_inventory: + name: "Demo Inventory" + organization: Default + +- name: Assure that demo job template exists + tower_job_template: + name: "Demo Job Template" + project: "Demo Project" + inventory: "Demo Inventory" + playbook: "hello_world.yml"