Skip to content

Commit

Permalink
Fix configure.sh idepmpotency with project and application acls
Browse files Browse the repository at this point in the history
  • Loading branch information
macropin committed Jun 27, 2024
1 parent 43471cf commit 00b1a74
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ansible-bootstrap/templates/configure.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
# This script is idempotent.
#
# Path structure:
# /acl/<system_acl_policy_name>.aclpolicy
# /projects/<project_name>/<job_name>.yaml
# /projects/<project_name>/<acl_policy_name>.aclpolicy
# /projects/<project_name>/<project_acl_policy_name>.aclpolicy
#
# Using:
# - https://rundeck.github.io/rundeck-cli/commands/
Expand Down Expand Up @@ -51,7 +52,7 @@ get_installed_projects() {

create_project() {
echo "> Creating project ${1}"
rd projects create --project "${1}"
rd projects create --project "${1}" || true
}

load_project_job() {
Expand All @@ -67,9 +68,10 @@ load_project_acl() {
}

load_application_acl() {
# Load application ACL policies to database
# Load application ACL policies to database (need to create and delete, as this command isn't idempotent, also outputs whole policy which is undesirable)
echo "> Loading ACL $(basename "${1}")"
rd system acls create --file "${1}" --name=$(basename "${1}")
rd system acls delete --name "$(basename "${1}")" || true
rd system acls create --file "${1}" --name=$(basename "${1}") 1> /dev/null && echo "# Created System ACL Policy ${1}"
}

contains() {
Expand Down

0 comments on commit 00b1a74

Please sign in to comment.