Skip to content

Commit 86e2bba

Browse files
updated
1 parent 897165d commit 86e2bba

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

‎ansible/execute.yaml‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,32 @@ tasks:
7474
--ssh-password "{{ .SSH_PASSWORD }}" \
7575
--parameters "{{ .PARAMS }}" \
7676
--progress plain -vv
77+
78+
execute-ansible-minimal:
79+
desc: Execute Ansible playbook on remote host without src/inventory (env-bound SSH creds, optional requirements file)
80+
vars:
81+
MODULE: github.com/stuttgart-things/blueprints/vm
82+
VERSION: v2.0.0
83+
FUNCTION: execute-ansible
84+
HOSTS:
85+
sh: |
86+
gum input --placeholder "Hosts e.g. 10.31.103.58,10.31.103.59"
87+
PLAYBOOKS:
88+
sh: |
89+
gum choose --no-limit "sthings.baseos.setup" "sthings.container.docker" "sthings.baseos.dev" | paste -sd ","
90+
REQUIREMENTS_FILE:
91+
sh: |
92+
if gum confirm "Provide a requirements file?"; then
93+
gum input --prompt "Path to requirements.yaml: " --value "/home/sthings/projects/blueprints/vm/ansible.go"
94+
else
95+
echo ""
96+
fi
97+
cmds:
98+
- |
99+
dagger call -m {{ .MODULE }}@{{ .VERSION }} {{ .FUNCTION }} \
100+
--playbooks "{{ .PLAYBOOKS }}" \
101+
--hosts "{{ .HOSTS }}" \
102+
{{ if .REQUIREMENTS_FILE }}--requirements "{{ .REQUIREMENTS_FILE }}" \
103+
{{ end }}--ssh-user=env:SSH_USER \
104+
--ssh-password=env:SSH_PASSWORD \
105+
--progress plain -vv

0 commit comments

Comments
 (0)