Documentation

cs_loadbalancer_rule - Manages load balancer rules on Apache CloudStack based clouds.

New in version 2.0.

Synopsis

Add, update and remove load balancer rules.

Requirements (on host that executes module)

  • python >= 2.6
  • cs >= 0.6.10

Options

parameter required default choices comments
account
no
    Account the rule is related to.
    algorithm
    no source
    • source
    • roundrobin
    • leastconn
    Load balancer algorithm
    Required when using state=present.
    api_http_method
    no get
    • get
    • post
    HTTP method used.
    api_key
    no
      API key of the CloudStack API.
      api_region
      no cloudstack
        Name of the ini section in the cloustack.ini file.
        api_secret
        no
          Secret key of the CloudStack API.
          api_timeout
          no 10
            HTTP timeout.
            api_url
            no
              URL of the CloudStack API e.g. https://cloud.example.com/client/api.
              cidr
              no
                CIDR (full notation) to be used for firewall rule if required.
                description
                no
                  The description of the load balancer rule.
                  domain
                  no
                    Domain the rule is related to.
                    ip_address
                    yes
                      Public IP address from where the network traffic will be load balanced from.

                      aliases: public_ip
                      name
                      yes
                        The name of the load balancer rule.
                        open_firewall
                        no
                          Whether the firewall rule for public port should be created, while creating the new rule.
                          Use cs_firewall for managing firewall rules.
                          private_port
                          no
                            The private port of the private ip address/virtual machine where the network traffic will be load balanced to.
                            Required when using state=present.
                            Can not be changed once the rule exists due API limitation.
                            project
                            no
                              Name of the project the load balancer IP address is related to.
                              protocol
                              no
                                The protocol to be used on the load balancer
                                public_port
                                yes
                                  The public port from where the network traffic will be load balanced from.
                                  Required when using state=present.
                                  Can not be changed once the rule exists due API limitation.
                                  state
                                  yes present
                                  • present
                                  • absent
                                  State of the rule.
                                  zone
                                  no
                                    Name of the zone in which the rule shoud be created.
                                    If not set, default zone is used.

                                    Examples

                                    # Create a load balancer rule
                                    - local_action:
                                        module: cs_loadbalancer_rule
                                        name: balance_http
                                        public_ip: 1.2.3.4
                                        algorithm: leastconn
                                        public_port: 80
                                        private_port: 8080
                                    
                                    # update algorithm of an existing load balancer rule
                                    - local_action:
                                        module: cs_loadbalancer_rule
                                        name: balance_http
                                        public_ip: 1.2.3.4
                                        algorithm: roundrobin
                                        public_port: 80
                                        private_port: 8080
                                    
                                    # Delete a load balancer rule
                                    - local_action:
                                        module: cs_loadbalancer_rule
                                        name: balance_http
                                        public_ip: 1.2.3.4
                                        state: absent
                                    

                                    Return Values

                                    Common return values are documented here Common Return Values, the following are the fields unique to this module:

                                    name description returned type sample
                                    project Name of project the rule is related to. success string Production
                                    domain Domain the rule is related to. success string example domain
                                    protocol Protocol of the rule. success string tcp
                                    algorithm Load balancer algorithm used. success string source
                                    zone Name of zone the rule is related to. success string ch-gva-2
                                    tags List of resource tags associated with the rule. success dict [ { "key": "foo", "value": "bar" } ]
                                    public_port Public port. success string 80
                                    account Account the rule is related to. success string example account
                                    name Name of the rule. success string http-lb
                                    public_ip Public IP address. success string 1.2.3.4
                                    private_port Private IP address. success string 80
                                    state State of the rule. success string Add
                                    cidr CIDR to forward traffic from. success string
                                    id UUID of the rule. success string a6f7a5fc-43f8-11e5-a151-feff819cdc9f
                                    description Description of the rule. success string http load balancer rule


                                    Notes

                                    Note

                                    Ansible uses the cs library’s configuration method if credentials are not provided by the arguments api_url, api_key, api_secret. Configuration is read from several locations, in the following order. - The CLOUDSTACK_ENDPOINT, CLOUDSTACK_KEY, CLOUDSTACK_SECRET and CLOUDSTACK_METHOD. CLOUDSTACK_TIMEOUT environment variables. - A CLOUDSTACK_CONFIG environment variable pointing to an .ini file, - A cloudstack.ini file in the current working directory. - A .cloudstack.ini file in the users home directory. Optionally multiple credentials and endpoints can be specified using ini sections in cloudstack.ini. Use the argument api_region to select the section name, default section is cloudstack. See https://github.com/exoscale/cs for more information.

                                    Note

                                    This module supports check mode.

                                    This is an Extras Module

                                    For more information on what this means please read Extras Modules

                                    For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Helping Testing PRs and Developing Modules.