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_dnszone fails when using private DNS zones #87

Closed
bit4man opened this issue Mar 31, 2020 · 14 comments · Fixed by #122
Closed

azure_rm_dnszone fails when using private DNS zones #87

bit4man opened this issue Mar 31, 2020 · 14 comments · Fixed by #122

Comments

@bit4man
Copy link

bit4man commented Mar 31, 2020

SUMMARY

Trying to create a private DNS Zone:

$ ansible -i inventory localhost -m azure_rm_dnszone -a "resource_group=rg name=private.example.com state=present type=private"
[WARNING]: Azure API profile latest does not define an entry for DnsManagementClient
localhost | FAILED! => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"msg": "Error creating or updating zone rhocp.us - Operation failed with status: 'Bad Request'. Details: The feature you are trying to use is not available."
}

ISSUE TYPE
  • Bug Report
COMPONENT NAME

azure_rm_dnszone

ANSIBLE VERSION
$ ansible --version
ansible 2.9.6
  config file = /home/ocp/azure/ansible/ansible.cfg
  configured module search path = ['/home/ocp/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.7.6 (default, Jan 30 2020, 09:44:41) [GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
CONFIGURATION
$ ansible-config dump --only-changed
COMMAND_WARNINGS(/home/ocp/azure/ansible/ansible.cfg) = False
DEFAULT_FILTER_PLUGIN_PATH(/home/ocp/azure/ansible/ansible.cfg) = ['/home/ocp/azure/ansible/filter_plugins']
DEFAULT_HOST_LIST(/home/ocp/azure/ansible/ansible.cfg) = ['/home/ocp/azure/ansible/inventory']
DEPRECATION_WARNINGS(/home/ocp/azure/ansible/ansible.cfg) = False
HOST_KEY_CHECKING(/home/ocp/azure/ansible/ansible.cfg) = False
INTERPRETER_PYTHON(/home/ocp/azure/ansible/ansible.cfg) = auto
OS / ENVIRONMENT

Fedora 31

STEPS TO REPRODUCE

Run the command in the summary

$ ansible -i inventory localhost -m azure_rm_dnszone -a "resource_group=rg name=private.example.com state=present type=private"
EXPECTED RESULTS

Zone created or data for existing zone returned.

ACTUAL RESULTS

Error: The feature you are trying to use is not available.

localhost | FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3"
    },
    "changed": false,
    "msg": "Error creating or updating zone rhocp.us - Operation failed with status: 'Bad Request'. Details: The feature you are trying to use is not available."
}
@thekoma
Copy link

thekoma commented Apr 7, 2020

I confirm this problem.
Also seems that the private/public type: flag is ignored and the zone is alwais created as public.

@imjoseangel
Copy link
Contributor

Guys, Could you please check if you can create from the Azure Portal? From my side, it is working fine:

ansible -i inventories/local/hosts localhost -m azure_rm_dnszone -a "resource_group=rg name=private.example.com state=present type=private"
localhost | CHANGED => {
    "changed": true,
    "check_mode": false,
    "state": {
        "id": "/subscriptions/hidden/resourceGroups/rg/providers/Microsoft.Network/dnszones/private.example.com",
        "name": "private.example.com",
        "name_servers": null,
        "number_of_record_sets": 1,
        "registration_virtual_networks": null,
        "resolution_virtual_networks": null,
        "type": "private"
    }
}

@Fred-sun
Copy link
Collaborator

Fred-sun commented Apr 9, 2020

@bit4man My test is also OK, could you tell me how you met this question? Thank you very much!

localhost | CHANGED => {
    "changed": true,
    "check_mode": false,
    "state": {
        "id": "/subscriptions/*********************************/resourceGroups/v-xisurg/providers/Microsoft.Network/dnszones/private1.example.com",
        "name": "private1.example.com",
        "name_servers": null,
        "number_of_record_sets": 1,
        "registration_virtual_networks": null,
        "resolution_virtual_networks": null,
        "tags": {},
        "type": "private"
    }
}

@bit4man
Copy link
Author

bit4man commented Apr 10, 2020

@imjoseangel Note I'm uzing AzureUSGovernment - not the commercial end point. When I use the azure portal it's "portal.azure.us" - and I can create and link private DNS zones on the portal side (a few weeks back I could not). I don't have all the data at my finger tips, but the API and implementation of PrivateDNS has changed very recently on AzureUSGov and it looks like the old implementation is no longer available.

@imjoseangel
Copy link
Contributor

imjoseangel commented Apr 10, 2020

Thank you @bit4man . Could you please test specifiying the cloud_environment as defined under azure_rm_dnszone_module documentation?

- name: Create a DNS zone
  azure_rm_dnszone:
    resource_group: rg
    name: private.example.com
    type: private
    cloud_environment: AzureUSGovernment

or

ansible -i inventories/local/hosts localhost -m azure_rm_dnszone -a "resource_group=rg name=private.example.com state=present type=private cloud_environment=AzureUSGovernment"

Thank you!

@Fred-sun
Copy link
Collaborator

@bit4man Dns zones and private Dns are two different modules, in which Dns zones(type: public and private). You can refer to the following two links. thank you!
private Dns: https://docs.microsoft.com/en-us/rest/api/dns/privatedns/privatezones
Dns zones: https://docs.microsoft.com/en-us/rest/api/dns/zones

@Fred-sun
Copy link
Collaborator

@haiyuazhang Could you please help confirm whether a new module azure_rm_dnsprivatezone needs to be added to distinguish between DNS zone and private DNS? Thank you very much!

@haiyuazhang
Copy link
Contributor

@Fred-sun Yes, a private DNS can no longer be created via this module, so a new module need to be
created.

@Fred-sun
Copy link
Collaborator

Fred-sun commented May 8, 2020

@haiyuazhang Thanks for your feedback. Will you add this module? Thank you!

@imjoseangel
Copy link
Contributor

@haiyuazhang @Fred-sun Do you want me to work in the module? I will need you @haiyuazhang to test it.

@Fred-sun
Copy link
Collaborator

@haiyuazhang @Fred-sun Do you want me to work in the module? I will need you @haiyuazhang to test it.

@imjoseangel Welcome you work to add this module. I will test when you finish change! Thank you very much!

@imjoseangel
Copy link
Contributor

imjoseangel commented May 16, 2020

@Fred-sun PR #122 created. As soon as we test and merge this, I will work in the info one.

I have kept the name as azure_rm_privatednszone instead of azure_rm_dnsprivatezone to maintain naming consistency with Azure SDK. Tell me if you agree or you prefer to rename the module.

Thank you very much for your help!

@imjoseangel
Copy link
Contributor

@Fred-sun and @haiyuazhang

I also have developed the azure_rm_privatednszone_info. As soon as we get this merged, I will create a new PR.

Have a nice rest of the weekend

@Fred-sun
Copy link
Collaborator

@imjoseangel Sorry reply you later, we will review and advance the merger as soon as possible. Thank you!

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

Successfully merging a pull request may close this issue.

5 participants