Skip to content

Commit

Permalink
Deprecated item.role, use item.by_role instead
Browse files Browse the repository at this point in the history
  • Loading branch information
ypid committed Aug 26, 2016
1 parent 16f1a7f commit ceb5101
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
21 changes: 15 additions & 6 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ v0.2.2

*Unreleased*

- Use ``item.rule_state`` in the role defaults instead of the hereby deprecated
``item.when`` and ``item.delete``.
See `discussion <https://github.com/debops/ansible-apt_preferences/issues/12>`_.
``item.delete`` and ``item.when`` are currently still supported for backwards
compatibility. [ypid_]

Added
~~~~~

Expand All @@ -33,12 +27,27 @@ Changed

- Use the `Ansible package module`_ which requires Ansible v2.0. [ypid_]

- Be more precise about the expected format of ``item.by_role`` in
:ref:`default_rules`. [ypid_]

Fixed
~~~~~

- Don’t create duplicate forward rules when an interface has both an IPv4 and
an IPv6 address. [ypid_]

Deprecated
~~~~~~~~~~

- Use ``item.rule_state`` in the role defaults instead of the hereby deprecated
``item.when`` and ``item.delete``.
See `discussion <https://github.com/debops/ansible-apt_preferences/issues/12>`_.
``item.delete`` and ``item.when`` are currently still supported for backwards
compatibility. [ypid_]

- Deprecated ``item.role``, use ``item.by_role`` instead. Applies for:
:ref:`default_rules`. [ypid_]

v0.2.1
------

Expand Down
7 changes: 6 additions & 1 deletion docs/rules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,13 @@ the following keys:
Optional. Set rule name in ferm configuration file when ``item.filename`` is
not set and other places where a custom rule name might be useful.

``by_role``
Optional. Name of the Ansible role in the format ``ROLE_OWNER.ROLE_NAME``
which is responsable for the rule.
The sanitized name will be included in the autogenerated filename.

``role``
Optional. Custom name used in the generated ferm rule definition file.
Deprecated. Use ``by_role`` instead.

``role_weight``
Optional. This allows to set the same ``item.weight`` for all rules of a
Expand Down
4 changes: 2 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

- name: Remove ip(6)tables rules if requested
file:
path: '/etc/ferm/ferm.d/{{ ferm__weight_map[item.weight_class|d()] | d(item.weight | d(ferm__default_weight)) }}_{{ item.filename | d(((item.role + "_" + ((item.role_weight + "_") if item.role_weight|d() else "")) if item.role|d() else "") + item.type + "_" + item.name | d((item.dport[0] if item.dport|d() else "rules"))) }}.conf'
dest: '/etc/ferm/ferm.d/{{ ferm__weight_map[item.weight_class|d()] | d(item.weight | d(ferm__default_weight)) }}_{{ item.filename | d((((item.by_role|d(item.role)| replace(".", "_")) + "_" + ((item.role_weight + "_") if item.role_weight|d() else "")) if (item.by_role|d(item.role)|d()) else "") + item.type + "_" + item.name | d((item.dport[0] if item.dport|d() else "rules"))) }}.conf'
state: 'absent'
with_flattened:
- '{{ ferm_rules | d([]) | list }}'
Expand All @@ -92,7 +92,7 @@
- name: Configure ip(6)tables rules
template:
src: 'etc/ferm/ferm.d/{{ item.type }}.conf.j2'
dest: '/etc/ferm/ferm.d/{{ ferm__weight_map[item.weight_class|d()] | d(item.weight | d(ferm__default_weight)) }}_{{ item.filename | d(((item.role + "_" + ((item.role_weight + "_") if item.role_weight|d() else "")) if item.role|d() else "") + item.type + "_" + item.name | d((item.dport[0] if item.dport|d() else "rules"))) }}.conf'
dest: '/etc/ferm/ferm.d/{{ ferm__weight_map[item.weight_class|d()] | d(item.weight | d(ferm__default_weight)) }}_{{ item.filename | d((((item.by_role|d(item.role)| replace(".", "_")) + "_" + ((item.role_weight + "_") if item.role_weight|d() else "")) if (item.by_role|d(item.role)|d()) else "") + item.type + "_" + item.name | d((item.dport[0] if item.dport|d() else "rules"))) }}.conf'
owner: 'root'
group: 'adm'
mode: '0644'
Expand Down

0 comments on commit ceb5101

Please sign in to comment.