Separate folder for templating collection stuff

This commit is contained in:
AlanCoding
2020-06-10 07:14:34 -04:00
parent 4848f1298a
commit 721ed516a4
6 changed files with 35 additions and 6 deletions

1
.gitignore vendored
View File

@@ -140,6 +140,7 @@ use_dev_supervisor.txt
/awx_collection_test_venv/ /awx_collection_test_venv/
/awx_collection/*.tar.gz /awx_collection/*.tar.gz
/sanity/ /sanity/
/awx_collection_build/
.idea/* .idea/*
*.unison.tmp *.unison.tmp

View File

@@ -401,11 +401,11 @@ symlink_collection:
build_collection: build_collection:
ansible-playbook -i localhost, awx_collection/tools/template_galaxy.yml -e collection_package=$(COLLECTION_PACKAGE) -e collection_namespace=$(COLLECTION_NAMESPACE) -e collection_version=$(VERSION) -e '{"awx_template_version":false}' ansible-playbook -i localhost, awx_collection/tools/template_galaxy.yml -e collection_package=$(COLLECTION_PACKAGE) -e collection_namespace=$(COLLECTION_NAMESPACE) -e collection_version=$(VERSION) -e '{"awx_template_version":false}'
ansible-galaxy collection build awx_collection --force --output-path=awx_collection ansible-galaxy collection build awx_collection_build --force --output-path=awx_collection_build
install_collection: build_collection install_collection: build_collection
rm -rf $(COLLECTION_INSTALL) rm -rf $(COLLECTION_INSTALL)
ansible-galaxy collection install awx_collection/$(COLLECTION_NAMESPACE)-$(COLLECTION_PACKAGE)-$(VERSION).tar.gz ansible-galaxy collection install awx_collection_build/$(COLLECTION_NAMESPACE)-$(COLLECTION_PACKAGE)-$(VERSION).tar.gz
test_collection_sanity: install_collection test_collection_sanity: install_collection
cd $(COLLECTION_INSTALL) && ansible-test sanity cd $(COLLECTION_INSTALL) && ansible-test sanity

View File

@@ -17,7 +17,7 @@ tags:
- awx - awx
- ansible - ansible
- automation - automation
version: 11.2.0 version: devel
build_ignore: build_ignore:
- tools - tools
- setup.cfg - setup.cfg

View File

@@ -46,7 +46,7 @@
dest: "{{ collection_path }}/galaxy.yml" dest: "{{ collection_path }}/galaxy.yml"
force: true force: true
- name: Tempalte the README.md file - name: Template the README.md file
template: template:
src: "{{ collection_path }}/tools/roles/template_galaxy/templates/README.md.j2" src: "{{ collection_path }}/tools/roles/template_galaxy/templates/README.md.j2"
dest: "{{ collection_path }}/README.md" dest: "{{ collection_path }}/README.md"

View File

@@ -17,7 +17,7 @@ tags:
- awx - awx
- ansible - ansible
- automation - automation
version: {{ collection_version }} version: {{ collection_version_override | default(collection_version) }}
build_ignore: build_ignore:
- tools - tools
- setup.cfg - setup.cfg

View File

@@ -7,6 +7,34 @@
collection_package: awx collection_package: awx
collection_namespace: awx collection_namespace: awx
collection_version: 0.0.1 # not for updating, pass in extra_vars collection_version: 0.0.1 # not for updating, pass in extra_vars
collection_path: "{{ playbook_dir }}/../" collection_source: "{{ playbook_dir }}/../"
collection_path: "{{ playbook_dir }}/../../awx_collection_build"
pre_tasks:
- file:
path: "{{ collection_path }}"
state: absent
- copy:
src: "{{ collection_source }}"
dest: "{{ collection_path }}"
remote_src: true
roles: roles:
- template_galaxy - template_galaxy
tasks:
- name: Make substitutions in source to sync with templates
set_fact:
collection_version_override: devel
- name: Template the galaxy.yml file
template:
src: "{{ collection_source }}/tools/roles/template_galaxy/templates/galaxy.yml.j2"
dest: "{{ collection_source }}/galaxy.yml"
force: true
- name: Template the README.md file
template:
src: "{{ collection_source }}/tools/roles/template_galaxy/templates/README.md.j2"
dest: "{{ collection_source }}/README.md"
force: true