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

Issue with multi MX records #17

Open
matrixise opened this issue Apr 20, 2021 · 3 comments
Open

Issue with multi MX records #17

matrixise opened this issue Apr 20, 2021 · 3 comments

Comments

@matrixise
Copy link

Hi,

I try to add multiple google MX entries for a domain, and when I check the result, there is only one MX record in the OVH panel.

Sorry, I have not debugged the code, but do you have any idea?

Thank you

  - name: Add MX 10 alt3.aspmx.l.google.com.
    ovh_dns:
      state: present
      domain: DOMAIN
      name:
      type: MX
      value: "10 alt3.aspmx.l.google.com."

  - name: Add MX 10 alt4.aspmx.l.google.com.
    ovh_dns:
      state: present
      domain: DOMAIN
      name:
      type: MX
      value: "10 alt4.aspmx.l.google.com."

  - name: Add MX 1 aspmx.l.google.com.
    ovh_dns:
      state: present
      domain: DOMAIN
      name:
      type: MX
      value: "1 aspmx.l.google.com."

  - name: Add 5 alt2.aspmx.l.google.com.
    ovh_dns:
      state: present
      domain: DOMAIN
      name:
      type: MX
      value: "5 alt2.aspmx.l.google.com."

  - name: Add 5 alt1.aspmx.l.google.com.
    ovh_dns:
      state: present
      domain: DOMAIN
      name:
      type: MX
      value: "5 alt1.aspmx.l.google.com."
@lalmeras
Copy link
Collaborator

I suppose only your last record is kept.

You must provide a replace: with a pattern so that ovh_dns does not replace all records, but only records with the same priority.

Without replace, ovh_dns updates the same DOMAIN MX record.

  - name: Add MX 1 aspmx.l.google.com.
    ovh_dns:
      state: present
      domain: DOMAIN
      name:
      type: MX
      value: "1 aspmx.l.google.com."
      replace: "1 .*"
  - name: Add 5 alt1.aspmx.l.google.com.
    ovh_dns:
      state: present
      domain: DOMAIN
      name:
      type: MX
      value: "5 alt1.aspmx.l.google.com."
      replace: "5 .*"

From my knowledge, you cannot manage multi-value records. I don't know how to handle easily how to set two MX record for each priority.

@matrixise
Copy link
Author

Thanks for the suggestion/solution.

Yep, in fact, when you add a new record to OVH, you receive an ID, this ID should be store somewhere, but it's not the case.

I have tried with terraform and I don't have the issue because there is the state file.

@setop
Copy link

setop commented Oct 31, 2022

I suppose only your last record is kept.

You must provide a replace: with a pattern so that ovh_dns does not replace all records, but only records with the same priority.

Without replace, ovh_dns updates the same DOMAIN MX record.

  - name: Add MX 1 aspmx.l.google.com.
    ovh_dns:
      state: present
      domain: DOMAIN
      name:
      type: MX
      value: "1 aspmx.l.google.com."
      replace: "1 .*"
  - name: Add 5 alt1.aspmx.l.google.com.
    ovh_dns:
      state: present
      domain: DOMAIN
      name:
      type: MX
      value: "5 alt1.aspmx.l.google.com."
      replace: "5 .*"

From my knowledge, you cannot manage multi-value records. I don't know how to handle easily how to set two MX record for each priority.

You can have multiple MX records using "append" instead of "present". But in that case, I don't know how to remove previous values ...

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

No branches or pull requests

3 participants