ansible.builtin.oneandone_firewall_policy (v2.9.27) — module

Configure 1&1 firewall policy.

| "added in version" 2.5 of ansible.builtin"

Authors: Amel Ajdinovic (@aajdinov), Ethan Devenport (@edevenport)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

Create, remove, reconfigure, update firewall policies. This module has a dependency on 1and1 >= 1.0


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.

# Provisioning example. Create and destroy a firewall policy.

- oneandone_firewall_policy:
    auth_token: oneandone_private_api_key
    name: ansible-firewall-policy
    description: Testing creation of firewall policies with ansible
    rules:
     -
       protocol: TCP
       port_from: 80
       port_to: 80
       source: 0.0.0.0
    wait: true
    wait_timeout: 500
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- oneandone_firewall_policy:
    auth_token: oneandone_private_api_key
    state: absent
    name: ansible-firewall-policy
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Update a firewall policy.

- oneandone_firewall_policy:
    auth_token: oneandone_private_api_key
    state: update
    firewall_policy: ansible-firewall-policy
    name: ansible-firewall-policy-updated
    description: Testing creation of firewall policies with ansible - updated
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Add server to a firewall policy.

- oneandone_firewall_policy:
    auth_token: oneandone_private_api_key
    firewall_policy: ansible-firewall-policy-updated
    add_server_ips:
     - server_identifier (id or name)
     - server_identifier #2 (id or name)
    wait: true
    wait_timeout: 500
    state: update
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Remove server from a firewall policy.

- oneandone_firewall_policy:
    auth_token: oneandone_private_api_key
    firewall_policy: ansible-firewall-policy-updated
    remove_server_ips:
     - B2504878540DBC5F7634EB00A07C1EBD (server's IP id)
    wait: true
    wait_timeout: 500
    state: update
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Add rules to a firewall policy.

- oneandone_firewall_policy:
    auth_token: oneandone_private_api_key
    firewall_policy: ansible-firewall-policy-updated
    description: Adding rules to an existing firewall policy
    add_rules:
     -
       protocol: TCP
       port_from: 70
       port_to: 70
       source: 0.0.0.0
     -
       protocol: TCP
       port_from: 60
       port_to: 60
       source: 0.0.0.0
    wait: true
    wait_timeout: 500
    state: update
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Remove rules from a firewall policy.

- oneandone_firewall_policy:
    auth_token: oneandone_private_api_key
    firewall_policy: ansible-firewall-policy-updated
    remove_rules:
     - rule_id #1
     - rule_id #2
     - ...
    wait: true
    wait_timeout: 500
    state: update

Inputs

    
name:
    description:
    - Firewall policy name used with present state. Used as identifier (id or name) when
      used with absent state. maxLength=128
    required: true

wait:
    default: 'yes'
    description:
    - wait for the instance to be in state 'running' before returning
    required: false
    type: bool

rules:
    description:
    - A list of rules that will be set for the firewall policy. Each rule must contain
      protocol parameter, in addition to three optional parameters (port_from, port_to,
      and source)

state:
    choices:
    - present
    - absent
    - update
    default: present
    description:
    - Define a firewall policy state to create, remove, or update.
    required: false

api_url:
    description:
    - Custom API URL. Overrides the ONEANDONE_API_URL environment variable.
    required: false

add_rules:
    description:
    - A list of rules that will be added to an existing firewall policy. It is syntax
      is the same as the one used for rules parameter. Used in combination with update
      state.
    required: false

auth_token:
    description:
    - Authenticating API token provided by 1&1.
    required: true

description:
    description:
    - Firewall policy description. maxLength=256
    required: false

remove_rules:
    description:
    - A list of rule ids that will be removed from an existing firewall policy. Used in
      combination with update state.
    required: false

wait_timeout:
    default: 600
    description:
    - how long before wait gives up, in seconds

wait_interval:
    default: 5
    description:
    - Defines the number of seconds to wait when using the _wait_for methods

add_server_ips:
    description:
    - A list of server identifiers (id or name) to be assigned to a firewall policy. Used
      in combination with update state.
    required: false

firewall_policy:
    description:
    - The identifier (id or name) of the firewall policy used with update state.
    required: true

remove_server_ips:
    description:
    - A list of server IP ids to be unassigned from a firewall policy. Used in combination
      with update state.
    required: false

Outputs

firewall_policy:
  description: Information about the firewall policy that was processed
  returned: always
  sample: '{"id": "92B74394A397ECC3359825C1656D67A6", "name": "Default Policy"}'
  type: dict