UpCloudLtd/upcloud-ansible

How to set the comment field for the firewalls using ansible?

onnimonni opened this issue · 2 comments

I see that it's possible to add custom comment into the firewall rules but I didn't find out how to use it with your API.

screen shot 2017-03-24 at 11 16 46 am

Is this currently possible?

The API client and the API both support the "comment" attribute discussed here:
https://www.upcloud.com/api/11-firewall/

The ansible module passes everything you give it on to the API client (see https://github.com/UpCloudLtd/upcloud-ansible/blob/master/modules/upcloud_firewall.py#L237) so in theory, that feature should work with:

- name: configure firewall
  upcloud_firewall:
    state: present
    hostname: www13.example.com
    firewall_rules:
      - direction: in,
        family: IPv4,
        protocol: tcp,
        source_address_start: 192.168.1.1,
        source_address_end: 192.168.1.255,
        destination_port_start: 22,

        destination_port_end: 22,

        action: reject,
        comment: lorem ipsum foobar

hope that helps !

Thanks! This works just fine :)