Skip to content

Commit a4b99a8

Browse files
authored
prepend local roles path to ANSIBLE_ROLES_PATH (#5118)
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]>
1 parent fb95981 commit a4b99a8

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# entries is a list of entries to include in
2+
# release notes and/or the migration guide
3+
entries:
4+
- description: >
5+
(ansible/v1) Previously, when scaffolding an Ansible-based operator with
6+
both Roles and Playbooks, the roles imported by the playbook could not be
7+
found when running locally (`make run`). This change prepends the
8+
`ANSIBLE_ROLES_PATH` environment variable with the path to the local
9+
roles directory.
10+
kind: "bugfix"
11+
breaking: false
12+
migration:
13+
header: (optional) Add local Ansible Roles path to Env in `make run`
14+
body: >
15+
If you would like to run your operator locally using `make run`, modify
16+
the `run` target in the `Makefile` to:
17+
`ANSIBLE_ROLES_PATH="$(ANSIBLE_ROLES_PATH):$(shell pwd)/roles"
18+
$(ANSIBLE_OPERATOR) run`

internal/plugins/ansible/v1/scaffolds/internal/templates/makefile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ help: ## Display this help.
8989
##@ Build
9090
9191
run: ansible-operator ## Run against the configured Kubernetes cluster in ~/.kube/config
92-
$(ANSIBLE_OPERATOR) run
92+
ANSIBLE_ROLES_PATH="$(ANSIBLE_ROLES_PATH):$(shell pwd)/roles" $(ANSIBLE_OPERATOR) run
9393
9494
docker-build: ## Build docker image with the manager.
9595
docker build -t ${IMG} .

testdata/ansible/memcached-operator/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ help: ## Display this help.
5959
##@ Build
6060

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

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

0 commit comments

Comments
 (0)