-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from EnterpriseDB/REL-3_0_0
Merge the fixes from Release 3.0.0 to master branch
- Loading branch information
Showing
36 changed files
with
253 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
from __future__ import (absolute_import, division, print_function) | ||
__metaclass__ = type | ||
|
||
DOCUMENTATION = """ | ||
name: supported_roles | ||
author: Julien Tachoires | ||
short_description: Get the list of the supported roles by the current host | ||
description: | ||
- "Get the list of the supported roles byt the current host, based on its | ||
groups and attributes." | ||
""" | ||
|
||
EXAMPLES = """ | ||
- name: Get the supported roles by the current host | ||
debug: msg="{{ lookup('supported_roles') }}" | ||
""" | ||
|
||
RETURN = """ | ||
_value: | ||
description: | ||
- List of role name | ||
type: list | ||
elements: | ||
- string | ||
""" | ||
|
||
from ansible.errors import AnsibleError | ||
from ansible.plugins.lookup import LookupBase | ||
|
||
GROUP_ROLES = { | ||
'primary': [ | ||
'setup_repo', | ||
'install_dbserver', | ||
'init_dbserver', | ||
'manage_dbserver', | ||
'setup_efm', | ||
'autotuning' | ||
], | ||
'standby': [ | ||
'setup_repo', | ||
'install_dbserver', | ||
'setup_replication', | ||
'manage_dbserver', | ||
'setup_efm', | ||
'autotuning' | ||
], | ||
'pemserver': [ | ||
'setup_repo', | ||
'install_dbserver', | ||
'init_dbserver', | ||
'manage_dbserver', | ||
'setup_pemserver', | ||
'autotuning' | ||
], | ||
'pgbouncer': [ | ||
'setup_repo', | ||
'setup_pgbouncer', | ||
'manage_pgbouncer' | ||
], | ||
'pgpool2': [ | ||
'setup_repo', | ||
'setup_pgpool2', | ||
'manage_pgpool2' | ||
], | ||
'barmanserver': [ | ||
'setup_repo', | ||
'setup_barmanserver', | ||
'install_dbserver' | ||
] | ||
} | ||
|
||
class LookupModule(LookupBase): | ||
def run(self, terms, variables=None, **kwargs): | ||
supported_roles = [] | ||
# Inventory hostname | ||
hostname = variables['inventory_hostname'] | ||
|
||
myvars = getattr(self._templar, '_available_variables', {}) | ||
|
||
for group in variables['group_names']: | ||
supported_roles = list( | ||
set(supported_roles) | ||
| set(GROUP_ROLES.get(group, [])) | ||
) | ||
# Special case for the primary or standby nodes when the host | ||
# variable pgbouncer is set to true. | ||
if (group in ['primary', 'standby'] | ||
and myvars['hostvars'][hostname].get('pgbouncer', False)): | ||
supported_roles = list( | ||
set(supported_roles) | ||
| set(['setup_pgbouncer', 'manage_pgbouncer']) | ||
) | ||
# Special case for the primary or standby nodes when the | ||
# host variable pem_agent is set to true. | ||
if (group in ['primary', 'standby'] | ||
and myvars['hostvars'][hostname].get('pem_agent', False)): | ||
supported_roles = list( | ||
set(supported_roles) | ||
| set(['setup_pemagent']) | ||
) | ||
# Special case for the pemserver, primary or standby nodes when | ||
# the host variable barman is set to true. | ||
if (group in ['pemserver', 'primary', 'standby'] | ||
and myvars['hostvars'][hostname].get('barman', False)): | ||
supported_roles = list( | ||
set(supported_roles) | ||
| set(['setup_barman']) | ||
) | ||
return supported_roles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.