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

Dynamic zone and managed zone files #104

Open
Poil opened this issue Jul 27, 2018 · 4 comments
Open

Dynamic zone and managed zone files #104

Poil opened this issue Jul 27, 2018 · 4 comments

Comments

@Poil
Copy link

Poil commented Jul 27, 2018

Hi,

Is there anyway to not erase existing records in a zone file ?
We use dynamic records, so each time we run salt, the zone file is reseted

Best regards,

@ryanwalder
Copy link

ryanwalder commented Jul 31, 2018

In this formula all records are from pillar. This means each time the formula is run it will remove anything not in pillar anymore, so if you're adding things into the zonefile by some other method than salt they will get removed on the next state run.

The only way I can see this potentially working is to have the ability to add an $INCLUDE directive which points to a file not managed by salt. This however isn't supported by the current formula.

@Poil
Copy link
Author

Poil commented Aug 3, 2018

Perhaps we can only add a parameter on the available_zones "dynamic: True" (default to False) that will set the parameter "replace=False" on the file.managed zones ?

@Poil
Copy link
Author

Poil commented Aug 3, 2018

Also I think we can add a dependency on the service if there are some included files :

bind_restart:
  service.running:
    - name: {{ map.service }}
    - reload: False
    - watch:
      - file: {{ map.chroot_dir }}{{ map.log_dir }}/query.log
      - file: bind_key_directory
{% if salt['pillar.get']('bind.config.includes', []) %}
    - require:
  {% for included_file in salt['pillar.get']('bind.config.includes', []) %}
      - file: {{ included_file }}
  {% endfor %}
{% endif %}

@javierbertoli
Copy link
Member

Managing whole files with a tool like Salt and adding records dynamically, if definitelly not something that will end well 😋

The solution I think would work for you is to add a state (dynamic.sls?) to manage the records in the zone using the ddns state. In this case, you can declare a zone in the pillar, with your 'static' records in the zone, and add them through the dynamic.sls state.

Obviously, those zone files should be exclusivelly populated/managed with that state, but I think it's doable. WDYT?

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