2.2.3. Modify Pool Member State¶
It is a common task to modify pool member states to make application updates.
You will pass variables using extra-vars to override playbook variables.
Use the -e, or --extra-vars argument of ansible-playbook
Create pool member forced offline playbook
Create a playbook
offline.yaml.- Type
nano playbooks/offline.yaml - Type the following into the
playbooks/offline.yamlfile.
--- - name: "Pool member offline" hosts: bigips gather_facts: False connection: local vars: pool: "" pmhost: "" pmport: "" state: "present" environment: "{{ bigip_env }}" tasks: - name: Modify pool member state bigip_pool_member: state: "{{ state }}" session_state: "disabled" monitor_state: "disabled" host: "{{ pmhost }}" port: "{{ pmport }}" pool: "{{ pool }}"
- Type
Run this playbook enable pool member.
- Type
ansible-playbook playbooks/offline.yaml -e @creds.yaml --ask-vault-pass -e pool="hack11_pl" -e pmhost="10.1.20.17" -e pmport="80"
You will be prompted for a password before executing the playbook. Password is password. If successful, you should see config for virtual servers, pools and nodes.
Note
ansible-vaultis used to store passwords and other sensitive info for use by ansible playbooks.Type
cat creds.yamlto confirm vault file is encrypted. Typeansible-vault view creds.yamlto view the vault file. Typeansible-vault edit creds.yamlto modify the vault file.- Type
Verify if pool member 10.1.20.17 is
forced offline- Select Local Traffic -> Pools -> Pool List -> hack11_pl -> Members
Create pool member enable playbook
Create a playbook
enable.yaml.- Type
nano playbooks/enable.yaml - Type the following into the
playbooks/enable.yamlfile.
--- - name: "Pool member enable" hosts: bigips gather_facts: False connection: local vars: pool: "" pmhost: "" pmport: "" state: "present" environment: "{{ bigip_env }}" tasks: - name: Modify pool member state bigip_pool_member: state: "{{ state }}" session_state: "enabled" monitor_state: "enabled" host: "{{ pmhost }}" port: "{{ pmport }}" pool: "{{ pool }}"
- Type
Run this playbook enable pool member.
- Type
ansible-playbook playbooks/enable.yaml -e @creds.yaml --ask-vault-pass -e pool="hack11_pl" -e pmhost="10.1.20.17" -e pmport="80"
- Type
Verify if pool member 10.1.20.17 is
enabled- Select Local Traffic -> Pools -> Pool List -> hack11_pl -> Members