1c68ae389b
This addresses the ansible aspects of fernet key bootstrapping as well as distributed key rotation. - Bootstrapping is handled in the same way as keystone bootstrap. - A new keystone-fernet and keystone-ssh container is created to allow the nodes to communicate with each other (taken from nova-ssh). - The keystone-fernet is a keystone container with crontab installed. This will handle key rotations through keystone-manage and trigger an rsync to push new tokens to other nodes. - Key rotation is setup to be balanced across the keystone nodes using a round-robbin style. This ensures that any node failures will not stop the keys from rotating. This is configured by a desired token expiration time which then determines the cron scheduling for each node as well as the number of fernet tokens in rotation. - Ability for recovered node to resync with the cluster. When a node starts it will run sanity checks to ensure that its fernet tokens are not stale. If they are it will rsync with other nodes to ensure its tokens are up to date. The Docker component is implemented in: https://review.openstack.org/#/c/349366 Change-Id: I15052c25a1d1149d364236f10ced2e2346119738 Implements: blueprint keystone-fernet-token
51 lines
2.3 KiB
YAML
51 lines
2.3 KiB
YAML
---
|
|
- name: Checking that libvirt is not running
|
|
stat: path=/var/run/libvirt/libvirt-sock
|
|
register: result
|
|
failed_when: result.stat.exists
|
|
when: inventory_hostname in groups['compute']
|
|
|
|
- name: Checking Docker version
|
|
command: docker version
|
|
register: result
|
|
changed_when: false
|
|
failed_when: result | failed
|
|
or (result.stdout | from_yaml).Server.Version | regex_replace('(\\d+\\.\\d+\\.\\d+).*', '\\1') | version_compare(docker_version_min, '<')
|
|
|
|
# When MountFlags is set to shared, a signal bit configured on 20th bit of a number
|
|
# We need to check the 20th bit. 2^20 = 1048576. So we are validating against it.
|
|
- name: Checking if 'MountFlags' for docker service is set to 'shared'
|
|
command: systemctl show docker
|
|
register: result
|
|
changed_when: false
|
|
failed_when: result.stdout.find('MountFlags=1048576') == -1
|
|
when:
|
|
- (inventory_hostname in groups['neutron-dhcp-agent']
|
|
or inventory_hostname in groups['neutron-l3-agent']
|
|
or inventory_hostname in groups['neutron-metadata-agent'])
|
|
- ansible_os_family == 'RedHat'
|
|
or (ansible_distribution == 'Ubuntu' and ansible_distribution_version > '14.04')
|
|
|
|
- name: Checking if '/run' mount flag is set to 'shared'
|
|
command: awk '$5 == "/run" {print $7}' /proc/self/mountinfo
|
|
register: result
|
|
changed_when: false
|
|
failed_when: result.stdout.find('shared') == -1
|
|
when:
|
|
- (inventory_hostname in groups['neutron-dhcp-agent']
|
|
or inventory_hostname in groups['neutron-l3-agent']
|
|
or inventory_hostname in groups['neutron-metadata-agent'])
|
|
- ansible_distribution == 'Ubuntu' and ansible_distribution_version == '14.04'
|
|
|
|
- name: Checking empty passwords in passwords.yml. Run kolla-genpwd if this task fails
|
|
local_action: command grep '^[^#].*:\s*$' "{{ CONFIG_DIR }}/passwords.yml"
|
|
register: result
|
|
changed_when: false
|
|
failed_when: result.stdout | regex_replace('(.*ssh_key.*)', '') | search(":")
|
|
|
|
- name: Checking fernet_token_expiry in globals.yml. Update fernet_token_expiry to allowed value if this task fails
|
|
local_action: command grep '^[^#]*fernet_token_expiry:\s*\d*' "{{ CONFIG_DIR }}/globals.yml" | sed 's/[^0-9]*//g'
|
|
register: result
|
|
changed_when: false
|
|
failed_when: result.stdout | regex_replace('(60|120|180|240|300|360|600|720|900|1200|1800|3600|7200|10800|14400|21600|28800|43200|86400|604800)', '') | search(".+")
|