From a082bd2446cca960846e879be39ed4d894806e2a Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Thu, 16 Feb 2017 10:44:27 +0000 Subject: [PATCH] Support Kolla install from source We need to make some downstream changes to Kolla currently, so let's install from source rather than patching. --- ansible/group_vars/all/globals | 3 ++ ansible/group_vars/all/kolla | 13 +++++++ ansible/group_vars/{seed/vm => all/seed-vm} | 0 .../files/baremetal-docker_yum_repo.j2.patch | 10 ------ .../files/baremetal-pre-install.yml.patch | 27 -------------- .../files/ironic-api.json.j2.patch | 11 ------ .../files/ironic-conductor.json.j2.patch | 11 ------ .../kolla-ansible/files/kolla-ansible.patch | 11 ------ .../files/prechecks-port_checks.yml.patch | 11 ------ ansible/roles/kolla-ansible/tasks/config.yml | 34 ------------------ ansible/roles/kolla-ansible/tasks/install.yml | 19 ---------- ansible/roles/kolla-ansible/tasks/main.yml | 35 +++++++++++++++++-- ansible/roles/kolla-openstack/tasks/main.yml | 4 --- ansible/roles/kolla/tasks/main.yml | 21 +++++++++-- etc/kayobe/globals.yml | 3 ++ etc/kayobe/kolla.yml | 13 +++++++ 16 files changed, 83 insertions(+), 143 deletions(-) rename ansible/group_vars/{seed/vm => all/seed-vm} (100%) delete mode 100644 ansible/roles/kolla-ansible/files/baremetal-docker_yum_repo.j2.patch delete mode 100644 ansible/roles/kolla-ansible/files/baremetal-pre-install.yml.patch delete mode 100644 ansible/roles/kolla-ansible/files/ironic-api.json.j2.patch delete mode 100644 ansible/roles/kolla-ansible/files/ironic-conductor.json.j2.patch delete mode 100644 ansible/roles/kolla-ansible/files/kolla-ansible.patch delete mode 100644 ansible/roles/kolla-ansible/files/prechecks-port_checks.yml.patch delete mode 100644 ansible/roles/kolla-ansible/tasks/config.yml delete mode 100644 ansible/roles/kolla-ansible/tasks/install.yml diff --git a/ansible/group_vars/all/globals b/ansible/group_vars/all/globals index 411080678..3e02c501b 100644 --- a/ansible/group_vars/all/globals +++ b/ansible/group_vars/all/globals @@ -9,3 +9,6 @@ kayobe_config_path: "{{ lookup('env', 'KAYOBE_CONFIG_PATH') | default('/etc/kayo # Path in which to cache downloaded images. image_cache_path: "{{ ansible_user_dir ~ '/kayobe-image-cache' }}" + +# Path on which to checkout source code repositories. +source_checkout_path: "{{ ansible_user_dir ~ '/kayobe-source' }}" diff --git a/ansible/group_vars/all/kolla b/ansible/group_vars/all/kolla index 7b730e1dc..9c8f52206 100644 --- a/ansible/group_vars/all/kolla +++ b/ansible/group_vars/all/kolla @@ -1,4 +1,17 @@ --- +############################################################################### +# Kolla installation. + +# Type of Kolla control installation. One of 'binary' or 'source'. +kolla_ctl_install_type: source + +# URL of Kolla source code repository if type is 'source'. +kolla_source_url: "https://github.com/stackhpc/kolla" + +# Version (branch, tag, etc.) of Kolla source code repository if type is +# 'source'. +kolla_source_version: "stackhpc-{{ kolla_openstack_release }}" + ############################################################################### # Kolla configuration. diff --git a/ansible/group_vars/seed/vm b/ansible/group_vars/all/seed-vm similarity index 100% rename from ansible/group_vars/seed/vm rename to ansible/group_vars/all/seed-vm diff --git a/ansible/roles/kolla-ansible/files/baremetal-docker_yum_repo.j2.patch b/ansible/roles/kolla-ansible/files/baremetal-docker_yum_repo.j2.patch deleted file mode 100644 index f7b7bfa1d..000000000 --- a/ansible/roles/kolla-ansible/files/baremetal-docker_yum_repo.j2.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- /usr/share/kolla/ansible/roles/baremetal/templates/docker_yum_repo.j2.old 2017-01-10 16:21:05.305626808 -0500 -+++ /usr/share/kolla/ansible/roles/baremetal/templates/docker_yum_repo.j2 2017-01-10 16:21:09.216645923 -0500 -@@ -1,6 +1,6 @@ - [docker-repo] - name=Docker main Repository --baseurl={{docker_yum_url}}/repo/main/{{ansible_distribution|lower}}/{{ansible_distribution_major_version|lower}} -+baseurl={{docker_yum_url}}/repo/main/{% if ansible_distribution == 'RedHat' %}centos{% else %}{{ansible_distribution|lower}}{% endif %}/{{ansible_distribution_major_version|lower}} - enabled=1 - gpgcheck=1 - gpgkey={{docker_yum_url}}/gpg diff --git a/ansible/roles/kolla-ansible/files/baremetal-pre-install.yml.patch b/ansible/roles/kolla-ansible/files/baremetal-pre-install.yml.patch deleted file mode 100644 index 9a3e2c0a9..000000000 --- a/ansible/roles/kolla-ansible/files/baremetal-pre-install.yml.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- /usr/share/kolla/ansible/roles/baremetal/tasks/pre-install.yml.old 2017-01-06 17:23:12.444746830 +0000 -+++ /usr/share/kolla/ansible/roles/baremetal/tasks/pre-install.yml 2017-01-06 17:22:27.864278879 +0000 -@@ -28,6 +28,7 @@ - {% for host in groups['all'] %} - {{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }} {{ hostvars[host]['ansible_hostname'] }} - {% endfor %} -+ become: True - when: customize_etc_hosts | bool - - - name: ensure sudo group is present -@@ -126,7 +127,7 @@ - recurse: yes - owner: kolla - group: kolla -- mode: 755 -+ mode: 0755 - become: True - when: create_kolla_user | bool == True - -@@ -135,6 +136,6 @@ - path: /etc/kolla - state: directory - recurse: yes -- mode: 666 -+ mode: 0666 - become: True - when: create_kolla_user | bool == False diff --git a/ansible/roles/kolla-ansible/files/ironic-api.json.j2.patch b/ansible/roles/kolla-ansible/files/ironic-api.json.j2.patch deleted file mode 100644 index 84546681b..000000000 --- a/ansible/roles/kolla-ansible/files/ironic-api.json.j2.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- /usr/share/kolla/ansible/roles/ironic/templates/ironic-api.json.j2.old 2017-01-06 13:56:52.881061188 +0000 -+++ /usr/share/kolla/ansible/roles/ironic/templates/ironic-api.json.j2 2017-01-06 14:00:21.757338271 +0000 -@@ -10,7 +10,7 @@ - ], - "permissions": [ - { -- "path": "/var/log/kolla/ironic" -+ "path": "/var/log/kolla/ironic", - "owner": "ironic:ironic", - "recurse": true - } diff --git a/ansible/roles/kolla-ansible/files/ironic-conductor.json.j2.patch b/ansible/roles/kolla-ansible/files/ironic-conductor.json.j2.patch deleted file mode 100644 index 97946dae3..000000000 --- a/ansible/roles/kolla-ansible/files/ironic-conductor.json.j2.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- /usr/share/kolla/ansible/roles/ironic/templates/ironic-conductor.json.j2.old 2017-01-06 14:28:35.048365453 +0000 -+++ /usr/share/kolla/ansible/roles/ironic/templates/ironic-conductor.json.j2 2017-01-06 14:28:44.858467071 +0000 -@@ -20,7 +20,7 @@ - "recurse": true - }, - { -- "path": "/tftpboot" -+ "path": "/tftpboot", - "owner": "ironic:ironic", - "recurse": true - } diff --git a/ansible/roles/kolla-ansible/files/kolla-ansible.patch b/ansible/roles/kolla-ansible/files/kolla-ansible.patch deleted file mode 100644 index f5c6acaa3..000000000 --- a/ansible/roles/kolla-ansible/files/kolla-ansible.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ansible/kolla-venv/bin/kolla-ansible.orig 2017-01-29 21:20:29.189225104 +0000 -+++ ansible/kolla-venv/bin/kolla-ansible 2017-01-31 16:31:07.203695865 +0000 -@@ -9,6 +9,8 @@ - BASEDIR=/usr/share/kolla - elif [[ ${dir_name} == "/usr/local/bin" ]]; then - BASEDIR=/usr/local/share/kolla -+ elif [[ ${dir_name} == "${VIRTUAL_ENV}/bin" ]]; then -+ BASEDIR="${VIRTUAL_ENV}/share/kolla" - else - BASEDIR="$(dirname ${dir_name})" - fi diff --git a/ansible/roles/kolla-ansible/files/prechecks-port_checks.yml.patch b/ansible/roles/kolla-ansible/files/prechecks-port_checks.yml.patch deleted file mode 100644 index 565fbb4f7..000000000 --- a/ansible/roles/kolla-ansible/files/prechecks-port_checks.yml.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ansible/kolla-venv/share/kolla/ansible/roles/prechecks/tasks/port_checks.yml.orig 2017-01-31 16:26:26.021463306 +0000 -+++ ansible/kolla-venv/share/kolla/ansible/roles/prechecks/tasks/port_checks.yml 2017-01-31 16:27:22.045711530 +0000 -@@ -601,7 +601,7 @@ - changed_when: false - failed_when: "'169.254.' not in kolla_internal_vip_address and \ - kolla_internal_vip_address | ipaddr(ip_addr_output.stdout.split()[3]) is none" -- when: enable_haproxy | bool -+ when: false - - - name: Checking the network_interface is present - fail: "msg='Please check the network_interface property - interface {{ network_interface }} not found'" diff --git a/ansible/roles/kolla-ansible/tasks/config.yml b/ansible/roles/kolla-ansible/tasks/config.yml deleted file mode 100644 index a0cc1da25..000000000 --- a/ansible/roles/kolla-ansible/tasks/config.yml +++ /dev/null @@ -1,34 +0,0 @@ ---- -- name: Ensure the Kolla configuration directores exist - file: - path: "{{ item }}" - state: directory - mode: 0755 - become: True - with_items: - - "{{ kolla_config_path }}/inventory" - - "{{ kolla_node_custom_config_path }}" - -- name: Ensure the Kolla configuration files exist - template: - src: "{{ item.src }}" - dest: "{{ kolla_config_path }}/{{ item.dest }}" - mode: 0644 - become: True - with_items: - - { src: seed.j2, dest: inventory/seed } - - { src: overcloud.j2, dest: inventory/overcloud } - - { src: globals.yml.j2, dest: globals.yml } - -- name: Check whether the Kolla passwords file exists - stat: - path: "{{ kolla_config_path }}/passwords.yml" - register: kolla_passwords_stat - -- name: Generate Kolla passwords - shell: > - cp {{ kolla_install_dir }}/etc_examples/kolla/passwords.yml {{ kolla_config_path }}/passwords.yml.generated - && {{ kolla_venv }}/bin/kolla-genpwd -p {{ kolla_config_path }}/passwords.yml.generated - && mv {{ kolla_config_path }}/passwords.yml.generated {{ kolla_config_path }}/passwords.yml - become: True - when: not kolla_passwords_stat.stat.exists diff --git a/ansible/roles/kolla-ansible/tasks/install.yml b/ansible/roles/kolla-ansible/tasks/install.yml deleted file mode 100644 index 726f14d38..000000000 --- a/ansible/roles/kolla-ansible/tasks/install.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -- name: Ensure Kolla patches are applied - patch: - src: "{{ item.src }}" - dest: "{{ item.dest }}" - become: True - with_items: - - src: baremetal-docker_yum_repo.j2.patch - dest: "{{ kolla_install_dir }}/ansible/roles/baremetal/templates/docker_yum_repo.j2" - - src: baremetal-pre-install.yml.patch - dest: "{{ kolla_install_dir }}/ansible/roles/baremetal/tasks/pre-install.yml" - - src: ironic-api.json.j2.patch - dest: "{{ kolla_install_dir }}/ansible/roles/ironic/templates/ironic-api.json.j2" - - src: ironic-conductor.json.j2.patch - dest: "{{ kolla_install_dir }}/ansible/roles/ironic/templates/ironic-conductor.json.j2" - - src: prechecks-port_checks.yml.patch - dest: "{{ kolla_install_dir }}/ansible/roles/prechecks/tasks/port_checks.yml" - - src: kolla-ansible.patch - dest: "{{ kolla_venv }}/bin/kolla-ansible" diff --git a/ansible/roles/kolla-ansible/tasks/main.yml b/ansible/roles/kolla-ansible/tasks/main.yml index 8570db68c..a0cc1da25 100644 --- a/ansible/roles/kolla-ansible/tasks/main.yml +++ b/ansible/roles/kolla-ansible/tasks/main.yml @@ -1,3 +1,34 @@ --- -- include: install.yml -- include: config.yml +- name: Ensure the Kolla configuration directores exist + file: + path: "{{ item }}" + state: directory + mode: 0755 + become: True + with_items: + - "{{ kolla_config_path }}/inventory" + - "{{ kolla_node_custom_config_path }}" + +- name: Ensure the Kolla configuration files exist + template: + src: "{{ item.src }}" + dest: "{{ kolla_config_path }}/{{ item.dest }}" + mode: 0644 + become: True + with_items: + - { src: seed.j2, dest: inventory/seed } + - { src: overcloud.j2, dest: inventory/overcloud } + - { src: globals.yml.j2, dest: globals.yml } + +- name: Check whether the Kolla passwords file exists + stat: + path: "{{ kolla_config_path }}/passwords.yml" + register: kolla_passwords_stat + +- name: Generate Kolla passwords + shell: > + cp {{ kolla_install_dir }}/etc_examples/kolla/passwords.yml {{ kolla_config_path }}/passwords.yml.generated + && {{ kolla_venv }}/bin/kolla-genpwd -p {{ kolla_config_path }}/passwords.yml.generated + && mv {{ kolla_config_path }}/passwords.yml.generated {{ kolla_config_path }}/passwords.yml + become: True + when: not kolla_passwords_stat.stat.exists diff --git a/ansible/roles/kolla-openstack/tasks/main.yml b/ansible/roles/kolla-openstack/tasks/main.yml index 65f5c00f1..e7d438cb7 100644 --- a/ansible/roles/kolla-openstack/tasks/main.yml +++ b/ansible/roles/kolla-openstack/tasks/main.yml @@ -3,8 +3,6 @@ file: path: "{{ kolla_node_custom_config_path }}/{{ item.name }}" state: directory - owner: kolla - group: kolla mode: 0755 become: True with_items: @@ -15,8 +13,6 @@ template: src: "{{ item.src }}" dest: "{{ kolla_node_custom_config_path }}/{{ item.dest }}" - owner: kolla - group: kolla mode: 0644 become: True with_items: diff --git a/ansible/roles/kolla/tasks/main.yml b/ansible/roles/kolla/tasks/main.yml index d4af85850..81d14f1ab 100644 --- a/ansible/roles/kolla/tasks/main.yml +++ b/ansible/roles/kolla/tasks/main.yml @@ -21,16 +21,31 @@ with_items: - { name: pip } +- name: Ensure Kolla source code checkout exists + git: + repo: "{{ kolla_source_url }}" + dest: "{{ source_checkout_path }}/kolla" + version: "{{ kolla_source_version }}" + when: "{{ kolla_ctl_install_type == 'source' }}" + - name: Ensure required Python packages are installed pip: name: "{{ item.name }}" - version: "{{ item.version }}" + version: "{{ item.version | default(omit) }}" state: present virtualenv: "{{ kolla_venv }}" with_items: - - { name: kolla, version: "{{ kolla_openstack_release }}" } + # Intall Kolla from source. + - name: "{{ source_checkout_path }}/kolla" + install: "{{ kolla_ctl_install_type == 'source' }}" + # Intall Kolla from PyPI. + - name: "kolla" + version: "{{ kolla_openstack_release }}" + install: "{{ kolla_ctl_install_type == 'binary' }}" # Required for kolla-genpwd. - - { name: PyYAML, version: "3.12" } + - name: PyYAML + version: "3.12" + when: "{{ item.install | default(True) | bool }}" - name: Ensure the Kolla configuration directores exist file: diff --git a/etc/kayobe/globals.yml b/etc/kayobe/globals.yml index 68756cb42..a78c725a8 100644 --- a/etc/kayobe/globals.yml +++ b/etc/kayobe/globals.yml @@ -10,6 +10,9 @@ # Path in which to cache downloaded images. #image_cache_path: +# Path on which to checkout source code repositories. +#source_checkout_path: + ############################################################################### # Dummy variable to allow Ansible to accept this file. workaround_ansible_issue_8743: yes diff --git a/etc/kayobe/kolla.yml b/etc/kayobe/kolla.yml index 60be86d73..99b1a32f3 100644 --- a/etc/kayobe/kolla.yml +++ b/etc/kayobe/kolla.yml @@ -1,6 +1,19 @@ --- # Kayobe Kolla configuration. +############################################################################### +# Kolla installation. + +# Type of Kolla control installation. One of 'binary' or 'source'. +#kolla_ctl_install_type: + +# URL of Kolla source code repository if type is 'source'. +#kolla_source_url: + +# Version (branch, tag, etc.) of Kolla source code repository if type is +# 'source'. +#kolla_source_version: + ############################################################################### # Kolla configuration.