diff --git a/api-docs.yml b/api-docs.yml index 9df7dd81..900bd5b3 100644 --- a/api-docs.yml +++ b/api-docs.yml @@ -1448,6 +1448,8 @@ paths: type: boolean dry_run: type: boolean + diff: + type: boolean playbook: type: string environment: diff --git a/db/Task.go b/db/Task.go index ff916595..c0934764 100644 --- a/db/Task.go +++ b/db/Task.go @@ -25,6 +25,7 @@ type Task struct { Debug bool `db:"debug" json:"debug"` DryRun bool `db:"dry_run" json:"dry_run"` + Diff bool `db:"diff" json:"diff"` // override variables Playbook string `db:"playbook" json:"playbook"` diff --git a/db/sql/migrations/v2.8.58.sql b/db/sql/migrations/v2.8.58.sql new file mode 100644 index 00000000..e6a9b72b --- /dev/null +++ b/db/sql/migrations/v2.8.58.sql @@ -0,0 +1 @@ +ALTER TABLE task ADD diff boolean NOT NULL DEFAULT false; \ No newline at end of file diff --git a/services/tasks/runner.go b/services/tasks/runner.go index 78ddde58..7859abfc 100644 --- a/services/tasks/runner.go +++ b/services/tasks/runner.go @@ -707,6 +707,10 @@ func (t *TaskRunner) getPlaybookArgs() (args []string, err error) { args = append(args, "-vvvv") } + if t.task.Diff { + args = append(args, "--diff") + } + if t.task.DryRun { args = append(args, "--check") } diff --git a/web2/src/components/TaskForm.vue b/web2/src/components/TaskForm.vue index d4e913e3..4d11ae54 100644 --- a/web2/src/components/TaskForm.vue +++ b/web2/src/components/TaskForm.vue @@ -123,6 +123,10 @@ Example: v-model="item.dry_run" label="Dry Run" > +