The new syntax has been supported since ~2017. From the docs, in case they change: ! New Style test.random_hash: module.run: - test.random_hash: - size: 42 - hash_type: sha256 ! Legacy Style test.random_hash: module.run: - size: 42 - hash_type: sha256pull/218/head
linux_host_{{ name }}_order_fix: | linux_host_{{ name }}_order_fix: | ||||
module.run: | module.run: | ||||
{%- if 'module.run' in salt['config.get']('use_superseded', default=[]) %} | |||||
- file.replace: | |||||
- path: /etc/hosts | |||||
- pattern: {{ before }} | |||||
- repl: {{ after }} | |||||
{%- else %} | |||||
- name: file.replace | - name: file.replace | ||||
- path: /etc/hosts | - path: /etc/hosts | ||||
- pattern: {{ before }} | - pattern: {{ before }} | ||||
- repl: {{ after }} | - repl: {{ after }} | ||||
{%- endif %} | |||||
- watch: | - watch: | ||||
- host: linux_host_{{ name }} | - host: linux_host_{{ name }} | ||||
- onlyif: | - onlyif: |
- template: jinja | - template: jinja | ||||
- require: | - require: | ||||
- pkg: openvswitch_pkgs | - pkg: openvswitch_pkgs | ||||
openvswitch_sytemctl_reload: | |||||
module.run: | module.run: | ||||
{%- if 'module.run' in salt['config.get']('use_superseded', default=[]) %} | |||||
- service.systemctl_reload: [] | |||||
{%- else %} | |||||
- name: service.systemctl_reload | - name: service.systemctl_reload | ||||
{%- endif %} | |||||
- onchanges: | - onchanges: | ||||
- file: /etc/systemd/system/openvswitch-switch.service | - file: /etc/systemd/system/openvswitch-switch.service | ||||
create_disk_label_{{ disk_name }}: | create_disk_label_{{ disk_name }}: | ||||
module.run: | module.run: | ||||
{%- if 'module.run' in salt['config.get']('use_superseded', default=[]) %} | |||||
- partition.mklabel: | |||||
- device: {{ disk_name }} | |||||
- label_type: {{ disk.get('type', 'dos') }} | |||||
{%- else %} | |||||
- name: partition.mklabel | - name: partition.mklabel | ||||
- device: {{ disk_name }} | - device: {{ disk_name }} | ||||
- label_type: {{ disk.get('type', 'dos') }} | - label_type: {{ disk.get('type', 'dos') }} | ||||
{%- endif %} | |||||
- unless: "fdisk -l {{ disk_name }} | grep -i 'Disklabel type: {{ disk.get('type', 'dos') }}'" | - unless: "fdisk -l {{ disk_name }} | grep -i 'Disklabel type: {{ disk.get('type', 'dos') }}'" | ||||
- require: | - require: | ||||
- pkg: parted | - pkg: parted | ||||
create_partition_{{ disk_name }}_{{ loop.index }}: | create_partition_{{ disk_name }}_{{ loop.index }}: | ||||
module.run: | module.run: | ||||
{%- if 'module.run' in salt['config.get']('use_superseded', default=[]) %} | |||||
- partition.mkpart: | |||||
- device: {{ disk_name }} | |||||
- part_type: primary | |||||
{%- if partition.type is defined %} | |||||
- fs_type: {{ partition.type }} | |||||
{%- endif %} | |||||
- start: {{ end_size }}MB | |||||
- end: {{ end_size + partition.size }}MB | |||||
{%- else %} | |||||
- name: partition.mkpart | - name: partition.mkpart | ||||
- device: {{ disk_name }} | - device: {{ disk_name }} | ||||
- part_type: primary | - part_type: primary | ||||
{%- if partition.type is defined %} | |||||
{%- if partition.type is defined %} | |||||
- fs_type: {{ partition.type }} | - fs_type: {{ partition.type }} | ||||
{%- endif %} | |||||
{%- endif %} | |||||
- start: {{ end_size }}MB | - start: {{ end_size }}MB | ||||
- end: {{ end_size + partition.size }}MB | - end: {{ end_size + partition.size }}MB | ||||
{%- endif %} | |||||
- unless: "blkid {{ disk_name }}{{ loop.index }} {{ disk_name }}p{{ loop.index }}" | - unless: "blkid {{ disk_name }}{{ loop.index }} {{ disk_name }}p{{ loop.index }}" | ||||
- require: | - require: | ||||
- module: create_disk_label_{{ disk_name }} | - module: create_disk_label_{{ disk_name }} | ||||
probe_partions_{{ disk_name }}: | probe_partions_{{ disk_name }}: | ||||
module.run: | module.run: | ||||
{%- if 'module.run' in salt['config.get']('use_superseded', default=[]) %} | |||||
- partition.probe: | |||||
- device: {{ disk_name }} | |||||
{%- else %} | |||||
- name: partition.probe | - name: partition.probe | ||||
- device: {{ disk_name }} | - device: {{ disk_name }} | ||||
{%- endif %} | |||||
{%- for partition in disk.get('partitions', []) %} | {%- for partition in disk.get('partitions', []) %} | ||||
mkfs_partition_{{ disk_name }}_{{ loop.index }}: | mkfs_partition_{{ disk_name }}_{{ loop.index }}: | ||||
module.run: | module.run: | ||||
{%- if 'module.run' in salt['config.get']('use_superseded', default=[]) %} | |||||
- xfs.mkfs: | |||||
- device: {{ disk_name }}{{ loop.index }} | |||||
{%- else %} | |||||
- name: xfs.mkfs | - name: xfs.mkfs | ||||
- device: {{ disk_name }}{{ loop.index }} | - device: {{ disk_name }}{{ loop.index }} | ||||
{%- endif %} | |||||
- unless: "blkid {{ disk_name }}{{ loop.index }} {{ disk_name }}p{{ loop.index }} | grep xfs" | - unless: "blkid {{ disk_name }}{{ loop.index }} {{ disk_name }}p{{ loop.index }} | grep xfs" | ||||
- require: | - require: | ||||
- module: create_partition_{{ disk_name }}_{{ loop.index }} | - module: create_partition_{{ disk_name }}_{{ loop.index }} |
{{ swap.device }}: | {{ swap.device }}: | ||||
module.run: | module.run: | ||||
{%- if 'module.run' in salt['config.get']('use_superseded', default=[]) %} | |||||
- mount.rm_fstab: | |||||
- m_name: none | |||||
- device: {{ swap.device }} | |||||
{%- else %} | |||||
- name: mount.rm_fstab | - name: mount.rm_fstab | ||||
- m_name: none | - m_name: none | ||||
- device: {{ swap.device }} | - device: {{ swap.device }} | ||||
{%- endif %} | |||||
- onlyif: grep -q {{ swap.device }} /etc/fstab | - onlyif: grep -q {{ swap.device }} /etc/fstab | ||||
linux_disable_swap_{{ swap.engine }}_{{ swap.device }}: | linux_disable_swap_{{ swap.engine }}_{{ swap.device }}: |
{% if salt['file.file_exists']('/sys/'+ core_key) %} | {% if salt['file.file_exists']('/sys/'+ core_key) %} | ||||
governor_write_sysfs_cpu_core_{{ cpu_core }}: | governor_write_sysfs_cpu_core_{{ cpu_core }}: | ||||
module.run: | module.run: | ||||
{%- if 'module.run' in salt['config.get']('use_superseded', default=[]) %} | |||||
- sysfs.write: | |||||
- key: {{ core_key }} | |||||
- value: {{ system.cpu.governor }} | |||||
{%- else %} | |||||
- name: sysfs.write | - name: sysfs.write | ||||
- key: {{ core_key }} | - key: {{ core_key }} | ||||
- value: {{ system.cpu.governor }} | - value: {{ system.cpu.governor }} | ||||
{%- endif %} | |||||
{% endif %} | {% endif %} | ||||
{%- endfor %} | {%- endfor %} |
refresh_db: | refresh_db: | ||||
{%- if system.get('refresh_repos_meta', True) %} | {%- if system.get('refresh_repos_meta', True) %} | ||||
module.run: | module.run: | ||||
{%- if 'module.run' in salt['config.get']('use_superseded', default=[]) %} | |||||
- pkg.refresh_db: [] | |||||
{%- else %} | |||||
- name: pkg.refresh_db | - name: pkg.refresh_db | ||||
{% endif %} | |||||
{%- else %} | {%- else %} | ||||
test.succeed_without_changes | test.succeed_without_changes | ||||
{%- endif %} | {%- endif %} |
{#- Sysfs cannot be set in docker, LXC, etc. #} | {#- Sysfs cannot be set in docker, LXC, etc. #} | ||||
linux_sysfs_write_{{ list_idx }}_{{ name }}_{{ key }}: | linux_sysfs_write_{{ list_idx }}_{{ name }}_{{ key }}: | ||||
module.run: | module.run: | ||||
{%- if 'module.run' in salt['config.get']('use_superseded', default=[]) %} | |||||
- sysfs.write: | |||||
- key: {{ key }} | |||||
- value: {{ value }} | |||||
{%- else %} | |||||
- name: sysfs.write | - name: sysfs.write | ||||
- key: {{ key }} | - key: {{ key }} | ||||
- value: {{ value }} | - value: {{ value }} | ||||
{%- endif %} | |||||
{%- endif %} | {%- endif %} | ||||
{%- endif %} | {%- endif %} | ||||
{%- endfor %} | {%- endfor %} |