Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
aegir_ansible/ansible_services/src/hostingService_http_ansible_haproxy.php /
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
74 lines (65 sloc)
1.72 KB
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
| <?php | |
| /** | |
| * @file | |
| * Hosting service classes for the Hosting web server module.osting service classes for the Hosting web server module. | |
| */ | |
| class hostingService_http_ansible_haproxy extends hostingService_http_cluster | |
| { | |
| public $type = 'ansible_haproxy'; | |
| public $service = 'http'; | |
| public $name = 'Ansible: HAProxy'; | |
| function form(&$form) | |
| { | |
| parent::form($form); | |
| } | |
| function load() | |
| { | |
| parent::load(); | |
| $this->roles = $this->getRoleNames(); | |
| // Transform the chosen web servers into ansible variables. | |
| // See https://github.com/geerlingguy/ansible-role-haproxy#role-variables | |
| $web_servers = node_load_multiple($this->web_servers); | |
| foreach ($web_servers as $server_node) { | |
| $this->ansible_vars['haproxy_backend_servers'][] = array( | |
| 'name' => $server_node->title, | |
| 'address' => array_shift($server_node->ip_addresses), | |
| ); | |
| } | |
| } | |
| function insert() { | |
| parent::insert(); | |
| } | |
| function delete() { | |
| parent::delete(); | |
| } | |
| function update() { | |
| parent::update(); | |
| } | |
| /** | |
| * The list of ansible roles that this service depends on. | |
| * | |
| * @return array | |
| */ | |
| function getRoles() { | |
| return array( | |
| 'geerlingguy.haproxy' | |
| ); | |
| } | |
| /** | |
| * The list of ansible roles that this service depends on. | |
| * | |
| * @return array | |
| */ | |
| function getRoleNames() { | |
| $roles = $this->getRoles(); | |
| foreach ($roles as $role) { | |
| if (isset($role['name'])) { | |
| $names[] = $role['name']; | |
| } | |
| else { | |
| $names[] = $role; | |
| } | |
| } | |
| return $names; | |
| } | |
| } |