??????????????
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 173
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 174
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 175
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 176
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 177
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 178
ó
àUdac @` s d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d d
l Z d d
l
Z
d d
l Z d d l m
Z
d d l m Z d d
l m Z m Z d Z d Z d d d g Z d Z d Z d e f d „ ƒ YZ d e f d „ ƒ YZ d „ Z e d k re ƒ n d
S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bysk
---
module: haproxy
version_added: "1.9"
short_description: Enable, disable, and set weights for HAProxy backend servers using socket commands
author:
- Ravi Bhure (@ravibhure)
description:
- Enable, disable, drain and set weights for HAProxy backend servers using socket commands.
notes:
- Enable, disable and drain commands are restricted and can only be issued on
sockets configured for level 'admin'. For example, you can add the line
'stats socket /var/run/haproxy.sock level admin' to the general section of
haproxy.cfg. See U(http://haproxy.1wt.eu/download/1.5/doc/configuration.txt).
- Depends on netcat (nc) being available; you need to install the appropriate
package for your operating system before this module can be used.
options:
backend:
description:
- Name of the HAProxy backend pool.
- If this parameter is unset, it will be auto-detected.
type: str
drain:
description:
- Wait until the server has no active connections or until the timeout
determined by wait_interval and wait_retries is reached.
- Continue only after the status changes to 'MAINT'.
- This overrides the shutdown_sessions option.
type: bool
version_added: "2.4"
host:
description:
- Name of the backend host to change.
type: str
required: true
shutdown_sessions:
description:
- When disabling a server, immediately terminate all the sessions attached
to the specified server.
- This can be used to terminate long-running sessions after a server is put
into maintenance mode. Overridden by the drain option.
type: bool
default: no
socket:
description:
- Path to the HAProxy socket file.
type: path
default: /var/run/haproxy.sock
state:
description:
- Desired state of the provided backend host.
- Note that C(drain) state was added in version 2.4.
- It is supported only by HAProxy version 1.5 or later,
- When used on versions < 1.5, it will be ignored.
type: str
required: true
choices: [ disabled, drain, enabled ]
fail_on_not_found:
description:
- Fail whenever trying to enable/disable a backend host that does not exist
type: bool
default: no
version_added: "2.2"
wait:
description:
- Wait until the server reports a status of 'UP' when C(state=enabled),
status of 'MAINT' when C(state=disabled) or status of 'DRAIN' when C(state=drain)
type: bool
default: no
version_added: "2.0"
wait_interval:
description:
- Number of seconds to wait between retries.
type: int
default: 5
version_added: "2.0"
wait_retries:
description:
- Number of times to check for status after changing the state.
type: int
default: 25
version_added: "2.0"
weight:
description:
- The value passed in argument.
- If the value ends with the `%` sign, then the new weight will be
relative to the initially configured weight.
- Relative weights are only permitted between 0 and 100% and absolute
weights are permitted between 0 and 256.
type: str
s¡
- name: Disable server in 'www' backend pool
haproxy:
state: disabled
host: '{{ inventory_hostname }}'
backend: www
- name: Disable server without backend pool name (apply to all available backend pool)
haproxy:
state: disabled
host: '{{ inventory_hostname }}'
- name: Disable server, provide socket file
haproxy:
state: disabled
host: '{{ inventory_hostname }}'
socket: /var/run/haproxy.sock
backend: www
- name: Disable server, provide socket file, wait until status reports in maintenance
haproxy:
state: disabled
host: '{{ inventory_hostname }}'
socket: /var/run/haproxy.sock
backend: www
wait: yes
# Place server in drain mode, providing a socket file. Then check the server's
# status every minute to see if it changes to maintenance mode, continuing if it
# does in an hour and failing otherwise.
- haproxy:
state: disabled
host: '{{ inventory_hostname }}'
socket: /var/run/haproxy.sock
backend: www
wait: yes
drain: yes
wait_interval: 1
wait_retries: 60
- name: Disable backend server in 'www' backend pool and drop open sessions to it
haproxy:
state: disabled
host: '{{ inventory_hostname }}'
backend: www
socket: /var/run/haproxy.sock
shutdown_sessions: yes
- name: Disable server without backend pool name (apply to all available backend pool) but fail when the backend host is not found
haproxy:
state: disabled
host: '{{ inventory_hostname }}'
fail_on_not_found: yes
- name: Enable server in 'www' backend pool
haproxy:
state: enabled
host: '{{ inventory_hostname }}'
backend: www
- name: Enable server in 'www' backend pool wait until healthy
haproxy:
state: enabled
host: '{{ inventory_hostname }}'
backend: www
wait: yes
- name: Enable server in 'www' backend pool wait until healthy. Retry 10 times with intervals of 5 seconds to retrieve the health
haproxy:
state: enabled
host: '{{ inventory_hostname }}'
backend: www
wait: yes
wait_retries: 10
wait_interval: 5
- name: Enable server in 'www' backend pool with change server(s) weight
haproxy:
state: enabled
host: '{{ inventory_hostname }}'
socket: /var/run/haproxy.sock
weight: 10
backend: www
- name: Set the server in 'www' backend pool to drain mode
haproxy:
state: drain
host: '{{ inventory_hostname }}'
socket: /var/run/haproxy.sock
backend: www
N( t Template( t
AnsibleModule( t to_bytest to_texts /var/run/haproxy.socki t enabledt disabledt draini i t TimeoutExceptionc B` s e Z RS( ( t __name__t
__module__( ( ( sE /usr/lib/python2.7/site-packages/ansible/modules/net_tools/haproxy.pyR × s t HAProxyc B` s† e Z d Z d „ Z d e d „ Z d „ Z d „ Z d „ Z d d „ Z
d „ Z d „ Z d
„ Z
d „ Z d d
„ Z d „ Z RS( s]
Used for communicating with HAProxy through its local UNIX socket interface.
Perform common tasks in Haproxy related to enable server and
disable server.
The complete set of external commands Haproxy handles is documented
on their website:
http://haproxy.1wt.eu/download/1.5/doc/configuration.txt#Unix Socket commands
c C` sç | | _ | j j d | _ | j j d | _ | j j d | _ | j j d | _ | j j d | _ | j j d | _ | j j d | _ | j j d | _ | j j d | _
| j j d
| _ | j j d | _ i | _
d S( Nt statet hostt backendt weightt sockett shutdown_sessionst fail_on_not_foundt waitt wait_retriest
wait_intervalR ( t modulet paramsR R R R R R R R R R t _draint command_results( t selfR ( ( sE /usr/lib/python2.7/site-packages/ansible/modules/net_tools/haproxy.pyt __init__ç s iÈ c C` sÑ t j t j t j ƒ | _ | j j | j ƒ | j j t d | ƒ ƒ d } d } | j j t ƒ } x&