diff --git a/playbooks/fips/README.rst b/playbooks/fips/README.rst new file mode 100644 index 00000000..6e61b8b1 --- /dev/null +++ b/playbooks/fips/README.rst @@ -0,0 +1,22 @@ +The enable-fips playbook can be invoked to enable FIPS mode on jobs. + +This playbook will call the enable-fips role in zuul-jobs, which will +turn FIPS mode on and then reboot the node. To get consistent results, +this role should be run very early in the node setup process, so that +resources set up later are not affected by the reboot. + +In practice, this means that the playbook is invoked as part of a base job +like openstack-multinode-fips for example. In order to avoid duplicating +complex inheritance trees, we expect to use this base job for most jobs. + +As most jobs will not require fips, a playbook variable enable_fips - which +defaults to False - is provided. To enable FIPS mode, a job will simply need +to set enable_fips to True as a job variable. + +**Job Variables** + +.. zuul:jobvar:: enable_fips + :default: False + + Whether to run the playbook and enable fips. Defaults to False. + diff --git a/playbooks/fips/enable-fips.yaml b/playbooks/fips/enable-fips.yaml index bc1dc04e..c6108bfd 100644 --- a/playbooks/fips/enable-fips.yaml +++ b/playbooks/fips/enable-fips.yaml @@ -1,3 +1,4 @@ - hosts: all roles: - enable-fips + when: enable_fips | default(false) diff --git a/playbooks/multinode/enable-multinode.yaml b/playbooks/multinode/enable-multinode.yaml new file mode 100644 index 00000000..6dd69933 --- /dev/null +++ b/playbooks/multinode/enable-multinode.yaml @@ -0,0 +1,30 @@ +- name: Configure a multi node environment + hosts: all + tasks: + # TODO: Add groups['all'] | length > 1 conditional when the truncated JSON + # issue is resolved, see: + # - https://github.com/ansible/ansible/issues/30385 + # - https://review.opendev.org/#/c/504238/ + - name: Set up multi-node known hosts + include_role: + name: multi-node-known-hosts + + - name: Set up multi-node hosts file + include_role: + name: multi-node-hosts-file + + - name: Set up multi-node firewall + include_role: + name: multi-node-firewall + +- name: Configure multi-node networking switch and peer nodes + hosts: + - switch + - peers + roles: + - multi-node-bridge + +- name: Copy the build ssh key to authorized_keys on all hosts for root + hosts: all + roles: + - copy-build-sshkey diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 992b9a37..56443b2f 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -862,6 +862,7 @@ pre-run: playbooks/fips/enable-fips.yaml vars: nslookup_target: 'opendev.org' + enable_fips: True - job: name: openstack-tox-functional-py38-fips @@ -872,6 +873,7 @@ pre-run: playbooks/fips/enable-fips.yaml vars: nslookup_target: 'opendev.org' + enable_fips: True - job: name: openstack-tox-validate @@ -2105,3 +2107,14 @@ wheel_python: python2 wheel-cache-ubuntu-xenial-python3: wheel_python: python3 + +- job: + name: openstack-multinode-fips + abstract: true + parent: openstack-fips + description: | + Base job for OpenStack jobs to enable mutinode jobs while + being able to enable FIPS by specifying enable_fips as True. + pre-run: + - playbooks/fips/enable-fips.yaml + - playbooks/multinode/enable-multinode.yaml