Я создал sns, публикующую ANSI, и пытаюсь запустить ее, но она не работает и выдает ошибку .. Я отправляю весь arn для темы .Компонент sns не анализирует двоеточия
fatal: [localhost]: FAILED! => {
"failed": true,
"msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'snsTopicName' is undefined\n\nThe error appears to have been in '/var/opt/jenkins/data/workspace/working/cicd-pipeline/working-cicd-pipeline/lib/helper/sns-publish.yml': line 25, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Publish Jenkins Error to SNS topic for failures\n ^ here\n"
}
Сценарий вызова
if [ "$1" = "QA" ]
then
ansible-playbook -vvv -c local "sns-publishQA.yml" --extra-vars "environment:'$environment' snsTopicName:'$snsTopicName'"
else
ansible-playbook -vvv -c local "sns-publish.yml" --extra-vars "environment:'$environment' snsTopicName:'$snsTopicName'"
fi
if [[ $? -ne 0 ]]; then
exit 1
fi
cd -
}
Playbook:
- name: Publish Jenkins Error to SNS topic {{snsTopicName}}
sns:
msg: "Error happened when running the pipeline"
subject: "Jenkins Error"
topic: "{{snsTopicName}}"
aws_access_key: "{{ assumed_role.sts_creds.access_key }}"
aws_secret_key: "{{ assumed_role.sts_creds.secret_key }}"
region: "us-east-1"
Любая помощь будет оценена