noderings¶
Declare NodeRings resources in Salt states: SSH keys, DNS zones and records, firewall rulesets and virtual machines.
Every state supports test=True. Credentials come from noderings:token
in the minion configuration or pillar, or the NODERINGS_TOKEN environment
variable; see the execution module.
laptop-key:
noderings.ssh_key_present:
- name: laptop
- public_key: ssh-ed25519 AAAA... me@laptop
example.com:
noderings.dns_zone_present
web-1:
noderings.vm_present:
- plan_code: SC-GC-1C-1G-20
- country: United States
- city: Ashburn
- distro: ubuntu_24_04
- ssh_keys: [laptop]
- firewall_ruleset: web
- require:
- noderings: laptop-key
- noderings: web-firewall
www:
noderings.dns_record_present:
- zone: example.com
- rtype: A
- values:
- {{ salt['noderings.get_vm']('web-1')['ipv4'] }}
- saltext.noderings.states.noderings_mod.ssh_key_present(name, public_key, profile='noderings')[source]¶
Ensure an SSH key with this name holds
public_key. A key with the same name but another public key is replaced.- name
Key name.
- public_key
The public key, for example
ssh-ed25519 AAAA... me@laptop.
- saltext.noderings.states.noderings_mod.ssh_key_absent(name, profile='noderings')[source]¶
Ensure no SSH key has this name.
- saltext.noderings.states.noderings_mod.dns_zone_present(name, dnssec=False, profile='noderings')[source]¶
Ensure a DNS zone exists, and optionally that it is signed with DNSSEC. Set the zone’s nameservers (in the
nameserverschange) at the registrar.- name
Domain, for example
example.com.- dnssec
Sign the zone. Add the DS record from
noderings.get_dnssecat the registrar afterwards. Turning signing off is left tonoderings.delete_zoneor the console, because doing it while the registrar has the DS record breaks the domain.
- saltext.noderings.states.noderings_mod.dns_zone_absent(name, force=False, profile='noderings')[source]¶
Ensure a DNS zone does not exist. Deleting it deletes all its records.
- saltext.noderings.states.noderings_mod.dns_record_present(name, zone, rtype, values, ttl=3600, profile='noderings')[source]¶
Ensure the records of one name and type hold exactly
values.- name
Record name relative to the zone (
www,@for the apex), or fully qualified.- zone
Zone name or ID.
- rtype
Record type, for example
A,AAAA,CNAME,MXorTXT.- values
List of values. Hostnames should end with a dot. TXT values are plain text without quotes.
- ttl
Time to live in seconds, 30 to 86400.
- saltext.noderings.states.noderings_mod.dns_record_absent(name, zone, rtype, profile='noderings')[source]¶
Ensure there are no records of this name and type. A missing zone counts as absent.
- saltext.noderings.states.noderings_mod.firewall_ruleset_present(name, rules=None, profile='noderings')[source]¶
Ensure a firewall ruleset exists and, when
rulesis given, holds exactly these rules in this order.Rules run top to bottom, and traffic that matches no rule is accepted, so end the list with a drop rule. Each rule is a mapping with
direction(ingressoregress),action(acceptordrop),protocol(defaulttcp),sourceanddestination(each withcidrs,address_groups,address_group_idsorvm_tags), anddestination_ports/source_ports(one port such as443or one range such as8000-8100).web-firewall: noderings.firewall_ruleset_present: - name: web - rules: - {direction: ingress, action: accept, protocol: tcp, destination_ports: "22", source: {cidrs: [198.51.100.0/24]}} - {direction: ingress, action: accept, protocol: tcp, destination_ports: "443", source: {cidrs: [0.0.0.0/0]}} - {direction: ingress, action: drop, protocol: any, source: {cidrs: [0.0.0.0/0]}}
- saltext.noderings.states.noderings_mod.firewall_ruleset_absent(name, force=False, profile='noderings')[source]¶
Ensure a firewall ruleset does not exist.
force=Truedeletes it even while it is attached to virtual machines.
- saltext.noderings.states.noderings_mod.vm_present(name, plan_code=None, country=None, city=None, distro='ubuntu_24_04', billing_type='usage', ssh_keys=None, tags=None, firewall_ruleset=None, power_state='running', allow_reinstall=False, plan_id=None, region_id=None, provider_id=None, password=None, wait_timeout=900, profile='noderings')[source]¶
Ensure a virtual machine with this hostname exists, in the given state.
A new VM is ordered from the cheapest offer for
plan_codeincountryandcity(or exactlyplan_idandregion_id). Ordering costs money:billing_type=usagebills by the hour from prepaid credit. For an existing VM,tags,firewall_rulesetandpower_stateare updated in place. A differentdistroreinstalls the VM only withallow_reinstall=True, because reinstalling erases the disk; otherwise the state reports the difference and fails. The plan and region of an existing VM are never changed.- name
Hostname. Must be unique in the organization.
- power_state
runningorstopped.- firewall_ruleset
Name or ID of a ruleset to attach.
""detaches the current one;None(the default) leaves it alone.