Playbooks to a new Lilik
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
715 B

  1. ---
  2. - name: 'set port redirection rule for {{ rule_name }}'
  3. uci:
  4. command: 'set'
  5. key: 'firewall.{{ item.0 }}'
  6. value: '{{ item.1 }}'
  7. loop:
  8. - [ '{{ rule_name }}', 'redirect' ]
  9. - [ '{{ rule_name }}.name', 'AnsibleManagedRedirect: {{ rule_name }}' ]
  10. - [ '{{ rule_name }}.proto', '{{ proto }}' ]
  11. - [ '{{ rule_name }}.src', 'wan' ]
  12. - [ '{{ rule_name }}.dest', 'secure' ]
  13. - [ '{{ rule_name }}.src_dport', '{{ port }}' ]
  14. - [ '{{ rule_name }}.dest_ip','{{ hostvars | ip_from_inventory(inventory_hostname) }}' ]
  15. - [ '{{ rule_name }}.dest_port', '{{ int_port | default(port) }}' ]
  16. delegate_to: '{{ firewall }}'
  17. notify:
  18. - 'uci commit firewall'
  19. - 'reload firewall'
  20. ...