Skip to content

Commit

Permalink
prepend local roles path to ANSIBLE_ROLES_PATH
Browse files Browse the repository at this point in the history
closes: #4071

When running locally, we set the ANSIBLE_ROLES_PATH to include the local
roles path, preventing users from needing to manually setting this
environment variable for normal development.

Signed-off-by: austin <[email protected]>
  • Loading branch information
asmacdo committed Aug 4, 2021
1 parent 88607b3 commit aaec357
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
18 changes: 18 additions & 0 deletions changelog/fragments/ansible-set-local-rolespath.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# entries is a list of entries to include in
# release notes and/or the migration guide
entries:
- description: >
(ansible/v1) Previously, when scaffolding an Ansible-based operator with
both Roles and Playbooks, the roles imported by the playbook could not be
found when running locally (`make run`). This change prepends the
`ANSIBLE_ROLES_PATH` environment variable with the path to the local
roles directory.
kind: "bugfix"
breaking: false
migration:
header: (optional) Add local Ansible Roles path to Env in `make run`
body: >
If you would like to run your operator locally using `make run`, modify
the `run` target in the `Makefile` to:
`ANSIBLE_ROLES_PATH="$(ANSIBLE_ROLES_PATH):$(shell pwd)/roles"
$(ANSIBLE_OPERATOR) run`
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ help: ## Display this help.
##@ Build
run: ansible-operator ## Run against the configured Kubernetes cluster in ~/.kube/config
$(ANSIBLE_OPERATOR) run
ANSIBLE_ROLES_PATH="$(ANSIBLE_ROLES_PATH):$(shell pwd)/roles" $(ANSIBLE_OPERATOR) run
docker-build: ## Build docker image with the manager.
docker build -t ${IMG} .
Expand Down
2 changes: 1 addition & 1 deletion testdata/ansible/memcached-operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ help: ## Display this help.
##@ Build

run: ansible-operator ## Run against the configured Kubernetes cluster in ~/.kube/config
$(ANSIBLE_OPERATOR) run
ANSIBLE_ROLES_PATH="$(ANSIBLE_ROLES_PATH):$(shell pwd)/roles" $(ANSIBLE_OPERATOR) run

docker-build: ## Build docker image with the manager.
docker build -t ${IMG} .
Expand Down

0 comments on commit aaec357

Please sign in to comment.