diff --git a/tripleo_ansible/releasenotes/notes/add_designate_bind_configuration-358db5e73e573b5b.yaml b/tripleo_ansible/releasenotes/notes/add_designate_bind_configuration-358db5e73e573b5b.yaml new file mode 100644 index 000000000..f318292be --- /dev/null +++ b/tripleo_ansible/releasenotes/notes/add_designate_bind_configuration-358db5e73e573b5b.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Added ``designate_bind_config`` to configure bind9 backend containers to + work with designate worker services. diff --git a/tripleo_ansible/roles/designate_bind_config/defaults/main.yml b/tripleo_ansible/roles/designate_bind_config/defaults/main.yml new file mode 100644 index 000000000..88a605b6b --- /dev/null +++ b/tripleo_ansible/roles/designate_bind_config/defaults/main.yml @@ -0,0 +1,3 @@ +--- +designate_named_conf_path: '/var/lib/config-data/ansible-generated/designate/etc/named.conf' +rndc_allowed_addresses: ['127.0.0.1'] diff --git a/tripleo_ansible/roles/designate_bind_config/meta/main.yml b/tripleo_ansible/roles/designate_bind_config/meta/main.yml new file mode 100644 index 000000000..2f3e6c223 --- /dev/null +++ b/tripleo_ansible/roles/designate_bind_config/meta/main.yml @@ -0,0 +1,42 @@ +--- +# Copyright 2021 Red Hat, Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +galaxy_info: + author: OpenStack + description: TripleO OpenStack Role -- designate_bind_pool + company: Red Hat + license: Apache-2.0 + min_ansible_version: 2.7 + # + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + platforms: + - name: CentOS + versions: + - 7 + - 8 + + galaxy_tags: + - tripleo + + +# List your role dependencies here, one per line. Be sure to remove the '[]' above, +# if you add dependencies to this list. +# dependencies: diff --git a/tripleo_ansible/roles/designate_bind_config/molecule/default/Dockerfile b/tripleo_ansible/roles/designate_bind_config/molecule/default/Dockerfile new file mode 100644 index 000000000..90646fff5 --- /dev/null +++ b/tripleo_ansible/roles/designate_bind_config/molecule/default/Dockerfile @@ -0,0 +1,37 @@ +# Molecule managed +# Copyright 2021 Red Hat, Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +{% if item.registry is defined %} +FROM {{ item.registry.url }}/{{ item.image }} +{% else %} +FROM {{ item.image }} +{% endif %} + +RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ + elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install sudo python*-devel python*-dnf bash {{ item.pkg_extras | default('') }} && dnf clean all; \ + elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl python-setuptools bash {{ item.pkg_extras | default('') }} && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ + elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml {{ item.pkg_extras | default('') }} && zypper clean -a; \ + elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates {{ item.pkg_extras | default('') }}; \ + elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates {{ item.pkg_extras | default('') }} && xbps-remove -O; fi + +{% for pkg in item.easy_install | default([]) %} +# install pip for centos where there is no python-pip rpm in default repos +RUN easy_install {{ pkg }} +{% endfor %} + + +CMD ["sh", "-c", "while true; do sleep 10000; done"] diff --git a/tripleo_ansible/roles/designate_bind_config/molecule/default/converge.yml b/tripleo_ansible/roles/designate_bind_config/molecule/default/converge.yml new file mode 100644 index 000000000..5e4aa1a4b --- /dev/null +++ b/tripleo_ansible/roles/designate_bind_config/molecule/default/converge.yml @@ -0,0 +1,21 @@ +--- +# Copyright 2021 Red Hat, Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +- name: Converge + hosts: all + roles: + - role: "designate_bind_config" diff --git a/tripleo_ansible/roles/designate_bind_config/molecule/default/molecule.yml b/tripleo_ansible/roles/designate_bind_config/molecule/default/molecule.yml new file mode 100644 index 000000000..f448198fe --- /dev/null +++ b/tripleo_ansible/roles/designate_bind_config/molecule/default/molecule.yml @@ -0,0 +1,48 @@ +--- +driver: + name: podman + +log: true + +platforms: + - name: ubi8 + hostname: ubi8 + image: ubi8/ubi-init + registry: + url: registry.access.redhat.com + dockerfile: Dockerfile + pkg_extras: python*setuptools + volumes: + - /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro + - /etc/pki/rpm-gpg:/etc/pki/rpm-gpg + privileged: true + environment: &env + http_proxy: "{{ lookup('env', 'http_proxy') }}" + https_proxy: "{{ lookup('env', 'https_proxy') }}" + ulimits: &ulimit + - host + +provisioner: + inventory: + hosts: + all: + hosts: + ubi8: + ansible_python_interpreter: /usr/bin/python3 + name: ansible + log: true + env: + ANSIBLE_STDOUT_CALLBACK: yaml + +scenario: + test_sequence: + - destroy + - create + - prepare + - converge + - check + - verify + - destroy + +verifier: + name: testinfra diff --git a/tripleo_ansible/roles/designate_bind_config/molecule/default/prepare.yml b/tripleo_ansible/roles/designate_bind_config/molecule/default/prepare.yml new file mode 100644 index 000000000..6e7049237 --- /dev/null +++ b/tripleo_ansible/roles/designate_bind_config/molecule/default/prepare.yml @@ -0,0 +1,21 @@ +--- +# Copyright 2021 Red Hat, Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +- name: Prepare + hosts: all + roles: + - role: test_deps diff --git a/tripleo_ansible/roles/designate_bind_config/tasks/main.yml b/tripleo_ansible/roles/designate_bind_config/tasks/main.yml new file mode 100644 index 000000000..24f1ca127 --- /dev/null +++ b/tripleo_ansible/roles/designate_bind_config/tasks/main.yml @@ -0,0 +1,12 @@ +--- +- name: ensure target directory exists + become: true + file: + path: "{{ designate_named_conf_path|dirname }}" + state: directory + +- name: generate named.conf + become: true + template: + src: named.conf.j2 + dest: "{{ designate_named_conf_path }}" diff --git a/tripleo_ansible/roles/designate_bind_config/templates/named.conf.j2 b/tripleo_ansible/roles/designate_bind_config/templates/named.conf.j2 new file mode 100644 index 000000000..416de4712 --- /dev/null +++ b/tripleo_ansible/roles/designate_bind_config/templates/named.conf.j2 @@ -0,0 +1,11 @@ +include "/etc/rndc.key"; + +options { + allow-new-zones yes; + minimal-responses yes; + directory "/var/named-persistent"; +}; + +controls { + inet {{ external_ip|default(ctlplane_ip)|default('127.0.0.1') }} allow { {{ rndc_allowed_addresses|join(';') }}; } keys { "rndc-key"; }; +}; diff --git a/zuul.d/molecule.yaml b/zuul.d/molecule.yaml index 3f2b9d676..0d5d388df 100644 --- a/zuul.d/molecule.yaml +++ b/zuul.d/molecule.yaml @@ -6,6 +6,7 @@ jobs: - tripleo-ansible-centos-8-molecule-aide - tripleo-ansible-centos-8-molecule-backup_and_restore + - tripleo-ansible-centos-8-molecule-designate_bind_config - tripleo-ansible-centos-8-molecule-login_defs - tripleo-ansible-centos-8-molecule-test_deps - tripleo-ansible-centos-8-molecule-test_package_action @@ -64,6 +65,7 @@ jobs: - tripleo-ansible-centos-8-molecule-aide - tripleo-ansible-centos-8-molecule-backup_and_restore + - tripleo-ansible-centos-8-molecule-designate_bind_config - tripleo-ansible-centos-8-molecule-login_defs - tripleo-ansible-centos-8-molecule-test_deps - tripleo-ansible-centos-8-molecule-test_package_action @@ -123,6 +125,7 @@ jobs: - tripleo-ansible-centos-8-molecule-aide - tripleo-ansible-centos-8-molecule-backup_and_restore + - tripleo-ansible-centos-8-molecule-designate_bind_config - tripleo-ansible-centos-8-molecule-login_defs - tripleo-ansible-centos-8-molecule-test_deps - tripleo-ansible-centos-8-molecule-test_package_action @@ -188,6 +191,13 @@ parent: tripleo-ansible-centos-8-base vars: tripleo_role_name: backup_and_restore +- job: + files: + - ^tripleo_ansible/roles/designate_bind_config/.* + name: tripleo-ansible-centos-8-molecule-designate_bind_config + parent: tripleo-ansible-centos-8-base + vars: + tripleo_role_name: designate_bind_config - job: files: - ^tripleo_ansible/roles/login_defs/.*