common_node_config_options:
  - dest: /etc/ssh/sshd_config
    regexp: '^#?Port'
    line: Port {{ ssh_port }}
    validate: sshd -t -f %s

  - dest: /etc/ssh/sshd_config
    regexp: '^#?PasswordAuthentication'
    line: 'PasswordAuthentication yes'
    validate: sshd -t -f %s

  - dest: /etc/ssh/sshd_config
    regexp: '^#?UseDNS'
    line: 'UseDNS no'
    validate: sshd -t -f %s

  - dest: /etc/sudoers
    regexp: '^{{ username }}'
    line: '{{ username }} ALL=(ALL) NOPASSWD: ALL'
    validate: visudo -cf %s

  - dest: /etc/sudoers
    regexp: '^Defaults.*requiretty'
    line: 'Defaults    !requiretty'
    validate: visudo -cf %s

common_node_config_options:
  - dest: /etc/ssh/sshd_config
    regexp: '^#?Port'
    line: Port {{ ssh_port | default('22') }}
    validate: sshd -t -f %s

  - dest: /etc/ssh/sshd_config
    regexp: '^#?PasswordAuthentication'
    line: 'PasswordAuthentication yes'
    validate: sshd -t -f %s

  - dest: /etc/ssh/sshd_config
    regexp: '^#?UseDNS'
    line: 'UseDNS no'
    validate: sshd -t -f %s

  - dest: /etc/sudoers
    regexp: '^{{ username }}'
    line: '{{ username }} ALL=(ALL) NOPASSWD: ALL'
    validate: visudo -cf %s

  - dest: /etc/sudoers
    regexp: '^Defaults.*requiretty'
    line: 'Defaults    !requiretty'
    validate: visudo -cf %s

Set ssh_port to 22 if undefined
Set ssh_port to 22 if undefined
