From 37e7700938f71678b3d4896848fe2dfd29b5b789 Mon Sep 17 00:00:00 2001 From: Donovan Francesco Date: Mon, 8 Aug 2016 14:46:04 +0200 Subject: [PATCH] Adding support for Magnum In addition to adding the magnum role to the repo build process we also include the os-magnum-install.yml to deploy magnum to hosts tagged with os_magnum. Change-Id: I32dee168d1005572510f630a21f7d7a7a05640d9 Implements: blueprint role-magnum --- ansible-role-requirements.yml | 4 ++ etc/openstack_deploy/conf.d/magnum.yml.aio | 3 + .../conf.d/magnum.yml.example | 8 +++ etc/openstack_deploy/user_secrets.yml | 6 ++ .../repo_packages/openstack_services.yml | 6 ++ playbooks/inventory/env.d/magnum.yml | 39 ++++++++++++ playbooks/inventory/group_vars/magnum_all.yml | 24 +++++++ playbooks/os-magnum-install.yml | 63 +++++++++++++++++++ playbooks/vars/configs/haproxy_config.yml | 8 +++ .../add-magnum-to-repo-548f243b3a253b04.yaml | 5 ++ tests/test_inventory.py | 5 ++ 11 files changed, 171 insertions(+) create mode 100644 etc/openstack_deploy/conf.d/magnum.yml.aio create mode 100644 etc/openstack_deploy/conf.d/magnum.yml.example create mode 100755 playbooks/inventory/env.d/magnum.yml create mode 100755 playbooks/inventory/group_vars/magnum_all.yml create mode 100755 playbooks/os-magnum-install.yml create mode 100644 releasenotes/notes/add-magnum-to-repo-548f243b3a253b04.yaml diff --git a/ansible-role-requirements.yml b/ansible-role-requirements.yml index b8959c0f54..da1af7dccd 100644 --- a/ansible-role-requirements.yml +++ b/ansible-role-requirements.yml @@ -78,6 +78,10 @@ scm: git src: https://git.openstack.org/openstack/openstack-ansible-os_ironic version: master +- name: os_magnum + scm: git + src: https://git.openstack.org/openstack/openstack-ansible-os_magnum + version: master - name: os_neutron scm: git src: https://git.openstack.org/openstack/openstack-ansible-os_neutron diff --git a/etc/openstack_deploy/conf.d/magnum.yml.aio b/etc/openstack_deploy/conf.d/magnum.yml.aio new file mode 100644 index 0000000000..187b94193b --- /dev/null +++ b/etc/openstack_deploy/conf.d/magnum.yml.aio @@ -0,0 +1,3 @@ +magnum-infra_hosts: + aio1: + ip: 172.29.236.100 \ No newline at end of file diff --git a/etc/openstack_deploy/conf.d/magnum.yml.example b/etc/openstack_deploy/conf.d/magnum.yml.example new file mode 100644 index 0000000000..e62381c4fb --- /dev/null +++ b/etc/openstack_deploy/conf.d/magnum.yml.example @@ -0,0 +1,8 @@ +# The infra nodes that will be running the magnum services +magnum-infra_hosts: + infra1: + ip: 172.20.236.111 + infra2: + ip: 172.20.236.112 + infra3: + ip: 172.20.236.113 \ No newline at end of file diff --git a/etc/openstack_deploy/user_secrets.yml b/etc/openstack_deploy/user_secrets.yml index 1d6b8207b4..ab507c9380 100644 --- a/etc/openstack_deploy/user_secrets.yml +++ b/etc/openstack_deploy/user_secrets.yml @@ -118,3 +118,9 @@ swift_hash_path_prefix: ## haproxy stats password haproxy_stats_password: haproxy_keepalived_authentication_password: + +## Magnum Options +magnum_service_password: +magnum_galera_password: +magnum_rabbitmq_password: +magnum_trustee_password: diff --git a/playbooks/defaults/repo_packages/openstack_services.yml b/playbooks/defaults/repo_packages/openstack_services.yml index d60c1f3e1f..cbd51adaf8 100644 --- a/playbooks/defaults/repo_packages/openstack_services.yml +++ b/playbooks/defaults/repo_packages/openstack_services.yml @@ -160,3 +160,9 @@ ironic_git_repo: https://git.openstack.org/openstack/ironic ironic_git_install_branch: 66b66fd6296398482d95f7ef5383ada9f6f60264 # HEAD of "master" as of 01.08.2016 ironic_git_dest: "/opt/ironic_{{ ironic_git_install_branch | replace('/', '_') }}" ironic_git_project_group: ironic_all + +## Magnum service +magnum_git_repo: https://git.openstack.org/openstack/magnum +magnum_git_install_branch: 83d154607e626ad09cee75521d6a3b51f48b2c6d # HEAD of "master" as of 08.08.2016 +magnum_git_dest: "/opt/magnum_{{ magnum_git_install_branch | replace('/', '_') }}" +magnum_git_project_group: magnum_all diff --git a/playbooks/inventory/env.d/magnum.yml b/playbooks/inventory/env.d/magnum.yml new file mode 100755 index 0000000000..c22200c8cd --- /dev/null +++ b/playbooks/inventory/env.d/magnum.yml @@ -0,0 +1,39 @@ +--- +# Copyright 2016 Internet Solutions (Pty) Ltd +# +# 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. +# +# (c) 2016 Donovan Francesco +# (c) 2016 Paul Stevens + +component_skel: + magnum: + belongs_to: + - magnum_all + +container_skel: + magnum_container: + belongs_to: + - magnum-infra_containers + contains: + - magnum + properties: + service_name: magnum + +physical_skel: + magnum-infra_containers: + belongs_to: + - all_containers + magnum-infra_hosts: + belongs_to: + - hosts diff --git a/playbooks/inventory/group_vars/magnum_all.yml b/playbooks/inventory/group_vars/magnum_all.yml new file mode 100755 index 0000000000..ccbff2242d --- /dev/null +++ b/playbooks/inventory/group_vars/magnum_all.yml @@ -0,0 +1,24 @@ +--- +# Copyright 2016 Internet Solutions (Pty) Ltd +# +# 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. + +magnum_galera_user: magnum +magnum_galera_database_name: magnum_service +magnum_galera_address: "{{ galera_address }}" + +magnum_rabbitmq_userid: magnum +magnum_rabbitmq_vhost: /magnum +magnum_rabbitmq_port: "{{ rabbitmq_port }}" +magnum_rabbitmq_servers: "{{ rabbitmq_servers }}" +magnum_rabbitmq_use_ssl: "{{ rabbitmq_use_ssl }}" diff --git a/playbooks/os-magnum-install.yml b/playbooks/os-magnum-install.yml new file mode 100755 index 0000000000..139208b476 --- /dev/null +++ b/playbooks/os-magnum-install.yml @@ -0,0 +1,63 @@ +--- +# Copyright 2016 Internet Solutions (Pty) Ltd +# +# 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. +# +# (c) 2016 Donovan Francesco +# (c) 2016 Paul Stevens + +- name: Install magnum server + hosts: magnum_all + max_fail_percentage: 20 + user: root + pre_tasks: + - include: common-tasks/os-lxc-container-setup.yml + - include: common-tasks/os-log-dir-setup.yml + vars: + log_dirs: + - src: "/openstack/log/{{ inventory_hostname }}-magnum" + dest: "/var/log/magnum" + - include: common-tasks/rabbitmq-servers-sort.yml + vars: + sort_group_name: "magnum_all" + - include: common-tasks/rabbitmq-vhost-user.yml + vars: + user: "{{ magnum_rabbitmq_userid }}" + password: "{{ magnum_rabbitmq_password }}" + vhost: "{{ magnum_rabbitmq_vhost }}" + when: + - inventory_hostname == groups['magnum_all'][0] + - groups['rabbitmq_all'] | length > 0 + - include: common-tasks/mysql-db-user.yml + vars: + user_name: "{{ magnum_galera_user }}" + password: "{{ magnum_galera_password }}" + login_host: "{{ magnum_galera_address }}" + db_name: "{{ magnum_galera_database }}" + when: inventory_hostname == groups['magnum_all'][0] + roles: + - role: "os_magnum" + magnum_venv_tag: "{{ openstack_release }}" + magnum_venv_download_url: "{{ openstack_repo_url }}/venvs/{{ openstack_release }}/{{ ansible_distribution | lower }}/magnum-{{ openstack_release }}.tgz" + pip_lock_to_internal_repo: "{{ (pip_links | length) >= 1 }}" + tags: + - "os-magnum" + - { role: "openstack_openrc", tags: [ "openstack-openrc" ] } + - role: "rsyslog_client" + rsyslog_client_log_rotate_file: magnum_log_rotate + rsyslog_client_log_dir: "/var/log/magnum" + rsyslog_client_config_name: "99-magnum-rsyslog-client.conf" + tags: + - "magnum-rsyslog-client" + vars: + is_metal: "{{ properties.is_metal|default(false) }}" diff --git a/playbooks/vars/configs/haproxy_config.yml b/playbooks/vars/configs/haproxy_config.yml index 12466183b3..1633b57f11 100644 --- a/playbooks/vars/configs/haproxy_config.yml +++ b/playbooks/vars/configs/haproxy_config.yml @@ -235,3 +235,11 @@ haproxy_default_services: - 192.168.0.0/16 - 172.16.0.0/12 - 10.0.0.0/8 + - service: + haproxy_service_name: magnum + haproxy_backend_nodes: "{{ groups['magnum_all'] | default([]) }}" + haproxy_ssl: "{{ haproxy_ssl }}" + haproxy_port: 9511 + haproxy_balance_type: http + haproxy_backend_options: + - "httpchk HEAD /" diff --git a/releasenotes/notes/add-magnum-to-repo-548f243b3a253b04.yaml b/releasenotes/notes/add-magnum-to-repo-548f243b3a253b04.yaml new file mode 100644 index 0000000000..d6c914b94d --- /dev/null +++ b/releasenotes/notes/add-magnum-to-repo-548f243b3a253b04.yaml @@ -0,0 +1,5 @@ +--- +features: + - Adding support for Magnum to be built as part of the repo build process. + - Adding the ``os-magnum-install.yml`` file to deploy magnum to hosts tagged + with hostgroup ``magnum_all``. diff --git a/tests/test_inventory.py b/tests/test_inventory.py index ff432672dc..61d21bf64c 100644 --- a/tests/test_inventory.py +++ b/tests/test_inventory.py @@ -147,6 +147,11 @@ class TestAnsibleInventoryFormatConstraints(unittest.TestCase): 'log_all', 'log_containers', 'log_hosts', + 'magnum', + 'magnum_all', + 'magnum_container', + 'magnum-infra_containers', + 'magnum-infra_hosts', 'memcached', 'memcached_all', 'memcached_container',