Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azure_Rm_deployment module does not work with parameters file. #132

Open
banicr opened this issue May 25, 2020 · 1 comment
Open

azure_Rm_deployment module does not work with parameters file. #132

banicr opened this issue May 25, 2020 · 1 comment
Labels
medium_priority Medium priority

Comments

@banicr
Copy link

banicr commented May 25, 2020

I am trying to use the azure_rm_deployment module to create azure vm. I have a custom byol template.
This template works fine if i use just the template.
But when i pass the parameters file along with the template, it throws the below mentioned error:

fatal: [localhost]: FAILED! => {"changed": false, "failed_deployment_operations": [], "msg": "Deployment failed with status code: 400 and message: Operation failed with status: 'Bad Request'. Details: 400 Client Error: Bad Request for url: https://management.azure.com/subscriptions/<subscription_id>/resourcegroups/<resource_group>/providers/Microsoft.Resources/deployments/<deployment_name??api-version=2017-05-10"}

When i click on the link, it gives some authorization error as shown below:
{"error":{"code":"AuthenticationFailed","message":"Authentication failed. The 'Authorization' header is missing."}}

But it does not throw this error if i remove the "parameters: "{{ (lookup('file', 'parameters.json') | from_json).parameters }}"" line from the playbook and pass the default values in the template file.

COMPONENT NAME

azure_rm_deployment

ANSIBLE VERSION

ansible 2.9.7

CONFIGURATION

ANSIBLE_SSH_CONTROL_PATH_DIR(/home/bhavani/ansible.cfg) = /tmp/.ansible/cp
ANSIBLE_SSH_EXECUTABLE(/home/bhavani/ansible.cfg) = /usr/bin/ssh
DEFAULT_LOG_PATH(/home/bhavani/ansible.cfg) = /home/bhavani/ansible.log
DEFAULT_VAULT_PASSWORD_FILE(/home/bhavani/ansible.cfg) = /home/bhavani/.vault-pass.txt
DEPRECATION_WARNINGS(/home/bhavani/ansible.cfg) = False
HOST_KEY_CHECKING(/home/bhavani/ansible.cfg) = False
LOCALHOST_WARNING(/home/bhavani/ansible.cfg) = False
RETRY_FILES_ENABLED(/home/bhavani/ansible.cfg) = False

STEPS TO REPRODUCE

playbook:

hosts: localhost
connection: local
gather_facts: yes
tasks:
name: Ensure the VM is deployed to Azure
azure_rm_deployment:
state: present
name: deploymentname
location: West India
resource_group_name: resource_group
template: "{{ lookup('file', 'deploy-f5-byol.json') }}"
parameters: "{{ (lookup('file', 'parameters.json') | from_json).parameters }}"

ACTUAL RESULTS

When i run the playbook, it throws the below error:
command: ansible-playbook ansiblevm.yaml
[WARNING]: No inventory was parsed, only implicit localhost is available

PLAY [localhost] *********************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************
ok: [localhost]

TASK [Ensure the VM is deployed to Azure] ********************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed_deployment_operations": [], "msg": "Deployment failed with status code: 400 and message: Operation failed with status: 'Bad Request'. Details: 400 Client Error: Bad Request for url: https://management.azure.com/subscriptions/<subscription_id>/resourcegroups/<resource_group>/providers/Microsoft.Resources/deployments/deploymentname?api-version=2017-05-10"}

PLAY RECAP ***************************************************************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

@raghureddy45
Copy link

Damnn.. No update since 2020. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
medium_priority Medium priority
Projects
None yet
Development

No branches or pull requests

3 participants