Resolved Keystone Federation bugs
The keystone role needed a few updates to deal with modern Ansible.
* The changeset pulls in the needed updates to resolve issues causing
the keystone_sp plugin, which powers federation, to crash.
* The changeset pulls in style changes for keystone cert sync removing
the need for the role to leverage the now deprecated memcached key
module.
Closes-Bug: 1660626
Change-Id: I29d444c9631a7511123aa6cd521a20a0e7588645
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
# import module snippets
|
# import module snippets
|
||||||
from ansible.module_utils.basic import *
|
from ansible.module_utils.basic import *
|
||||||
@@ -80,6 +81,8 @@ class KeystoneSp(object):
|
|||||||
self.identities_return_list = list()
|
self.identities_return_list = list()
|
||||||
self.protocols_return_list = list()
|
self.protocols_return_list = list()
|
||||||
self.sp_data = self.module.params['sp_data']
|
self.sp_data = self.module.params['sp_data']
|
||||||
|
if isinstance(self.sp_data, str):
|
||||||
|
self.sp_data = json.loads(self.sp_data.replace("'", '"'))
|
||||||
|
|
||||||
def populate_sp_data(self):
|
def populate_sp_data(self):
|
||||||
trusted_idp_list = self.sp_data['trusted_idp_list']
|
trusted_idp_list = self.sp_data['trusted_idp_list']
|
||||||
@@ -113,8 +116,7 @@ def main():
|
|||||||
'keystone_federated_protocols': ksp.protocols_return_list}
|
'keystone_federated_protocols': ksp.protocols_return_list}
|
||||||
)
|
)
|
||||||
except Exception as exp:
|
except Exception as exp:
|
||||||
resp = {'stderr': exp}
|
module.fail_json(msg='Failed Process: "%s"' % exp)
|
||||||
module.fail_json(msg='Failed Process', **resp)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -37,38 +37,46 @@
|
|||||||
- Restart service on other nodes
|
- Restart service on other nodes
|
||||||
- Restart Shibd
|
- Restart Shibd
|
||||||
|
|
||||||
- name: Store Shibboleth SP key-pair
|
- name: Store sp cert
|
||||||
memcached:
|
slurp:
|
||||||
name: "{{ item.name }}"
|
src: "/etc/shibboleth/sp-cert.pem"
|
||||||
file_path: "{{ item.src }}"
|
register: _keystone_sp_cert
|
||||||
state: "present"
|
changed_when: false
|
||||||
server: "{{ memcached_servers }}"
|
|
||||||
encrypt_string: "{{ memcached_encryption_key }}"
|
|
||||||
with_items:
|
|
||||||
- { src: "/etc/shibboleth/sp-cert.pem", name: "keystone_sp_cert" }
|
|
||||||
- { src: "/etc/shibboleth/sp-key.pem", name: "keystone_sp_key" }
|
|
||||||
register: memcache_keys
|
|
||||||
until: memcache_keys|success
|
|
||||||
retries: 5
|
|
||||||
delay: 2
|
|
||||||
when: inventory_hostname == groups['keystone_all'][0]
|
when: inventory_hostname == groups['keystone_all'][0]
|
||||||
|
|
||||||
- name: Distribute the Shibboleth SP key-pair
|
- name: Store sp key
|
||||||
memcached:
|
slurp:
|
||||||
name: "{{ item.name }}"
|
src: "/etc/shibboleth/sp-key.pem"
|
||||||
file_path: "{{ item.src }}"
|
register: _keystone_sp_key
|
||||||
state: "retrieve"
|
changed_when: false
|
||||||
file_mode: "{{ item.file_mode }}"
|
when: inventory_hostname == groups['keystone_all'][0]
|
||||||
dir_mode: "{{ item.dir_mode }}"
|
|
||||||
server: "{{ memcached_servers }}"
|
- name: Register a fact for the cert and key
|
||||||
encrypt_string: "{{ memcached_encryption_key }}"
|
set_fact:
|
||||||
with_items:
|
keystone_sp_cert_fact: "{{ _keystone_sp_cert.content }}"
|
||||||
- { src: "/etc/shibboleth/sp-cert.pem", name: "keystone_sp_cert", file_mode: "0640", dir_mode: "0750" }
|
keystone_sp_key_fact: "{{ _keystone_sp_key.content }}"
|
||||||
- { src: "/etc/shibboleth/sp-key.pem", name: "keystone_sp_key", file_mode: "0600", dir_mode: "0750" }
|
when: inventory_hostname == groups['keystone_all'][0]
|
||||||
register: memcache_keys
|
|
||||||
until: memcache_keys|success
|
- name: Distribute sp key
|
||||||
retries: 5
|
copy:
|
||||||
delay: 2
|
dest: "/etc/shibboleth/sp-key.pem"
|
||||||
|
content: "{{ hostvars[groups['keystone_all'][0]]['keystone_sp_key_fact'] | b64decode }}"
|
||||||
|
owner: "{{ keystone_system_user_name }}"
|
||||||
|
group: "{{ keystone_system_group_name }}"
|
||||||
|
mode: "0640"
|
||||||
|
when: inventory_hostname != groups['keystone_all'][0]
|
||||||
|
notify:
|
||||||
|
- Restart service on first node
|
||||||
|
- Restart service on other nodes
|
||||||
|
- Restart Shibd
|
||||||
|
|
||||||
|
- name: Distribute sp cert
|
||||||
|
copy:
|
||||||
|
dest: "/etc/shibboleth/sp-cert.pem"
|
||||||
|
content: "{{ hostvars[groups['keystone_all'][0]]['keystone_sp_cert_fact'] | b64decode }}"
|
||||||
|
owner: "{{ keystone_system_user_name }}"
|
||||||
|
group: "{{ keystone_system_group_name }}"
|
||||||
|
mode: "0640"
|
||||||
when: inventory_hostname != groups['keystone_all'][0]
|
when: inventory_hostname != groups['keystone_all'][0]
|
||||||
notify:
|
notify:
|
||||||
- Restart service on first node
|
- Restart service on first node
|
||||||
|
|||||||
@@ -82,7 +82,9 @@
|
|||||||
when:
|
when:
|
||||||
- keystone_database_enabled | bool
|
- keystone_database_enabled | bool
|
||||||
- inventory_hostname == groups['keystone_all'][0]
|
- inventory_hostname == groups['keystone_all'][0]
|
||||||
- keystone_get_venv | changed or keystone_venv_dir | changed or install_packages | changed
|
- (keystone_get_venv is defined and keystone_get_venv | changed) or
|
||||||
|
(keystone_venv_dir is defined and keystone_venv_dir | changed) or
|
||||||
|
(install_packages is defined and install_packages | changed)
|
||||||
tags:
|
tags:
|
||||||
- keystone-config
|
- keystone-config
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user