diff --git a/Asm/Ansible/Command/AnsiblePlaybook.php b/Asm/Ansible/Command/AnsiblePlaybook.php index 98dcfb4..5e9e159 100644 --- a/Asm/Ansible/Command/AnsiblePlaybook.php +++ b/Asm/Ansible/Command/AnsiblePlaybook.php @@ -175,7 +175,7 @@ public function diff(): AnsiblePlaybookInterface * * Example: * ```php - * $ansible = new Ansible()->playbook()->extraVars('/path/to/extra/vars.yml'); + * $ansible = new Ansible()->playbook()->extraVars('@"/path/to/extra/vars.yml"'); * ``` * * ## String @@ -210,8 +210,8 @@ public function extraVars(string|array $extraVars = ''): AnsiblePlaybookInterfac throw new InvalidArgumentException(sprintf('Expected string|array, got "%s"', gettype($extraVars))); } - if (!str_contains($extraVars, '=')) { - throw new InvalidArgumentException('The extra vars raw string should be in the "key=value" form.'); + if (!str_contains($extraVars, '=') && !str_starts_with($extraVars, '@')) { + throw new InvalidArgumentException('The extra vars raw string should either be in the "key=value" form or be a file path starting with @.'); } $this->addOption('--extra-vars', $extraVars);