From 8900ce5dbc976537eccf8fd784ff5fadd0dcf50f Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 26 Aug 2021 21:52:10 +0200 Subject: [PATCH] Add the possibility to provide args to a Bastille template --- README.md | 3 +++ tasks/main.yml | 8 +++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index eef408f..95282e4 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,9 @@ bastille: ip: 10.17.89.1 templates: - "bastillebsd-templates/nginx" + template_args: + - user=root + - password=MYSUPERSECRETPASSWORD - name: thickjail release: 13.0-RELEASE ip: 10.17.89.2 diff --git a/tasks/main.yml b/tasks/main.yml index 6a430c5..90bdaaf 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -114,8 +114,6 @@ when: bastille_jails is defined - name: "Apply templates to jails" - command: bastille template "{{ item.0.name }}" "{{ item.1 }}" - with_subelements: - - "{{ bastille_jails }}" - - templates - - skip_missing: yes + command: bastille template {{ item.name }} {{ item.templates | map('quote') | join(' ') }} {{ ['--arg'] | product(item.template_args | default([]) | map('quote')) | map('join', ' ') | join(' ') }} + loop: "{{ bastille_jails }}" + when: item.templates is defined