diff options
Diffstat (limited to 'xci/installer/osa/playbooks/configure-opnfvhost.yml')
-rw-r--r-- | xci/installer/osa/playbooks/configure-opnfvhost.yml | 96 |
1 files changed, 59 insertions, 37 deletions
diff --git a/xci/installer/osa/playbooks/configure-opnfvhost.yml b/xci/installer/osa/playbooks/configure-opnfvhost.yml index 4c30f4d1..47e9a65f 100644 --- a/xci/installer/osa/playbooks/configure-opnfvhost.yml +++ b/xci/installer/osa/playbooks/configure-opnfvhost.yml @@ -10,25 +10,37 @@ - hosts: opnfv remote_user: root vars_files: - - "{{ XCI_PATH }}/xci/var/opnfv.yml" - - "{{ XCI_PATH }}/xci/installer/osa/files/openstack_services.yml" + - "{{ xci_path }}/xci/var/opnfv.yml" + - "{{ xci_path }}/xci/installer/osa/files/openstack_services.yml" + environment: + http_proxy: "{{ lookup('env','http_proxy') }}" + https_proxy: "{{ lookup('env','https_proxy') }}" + no_proxy: "{{ lookup('env','no_proxy') }}" + HTTP_PROXY: "{{ lookup('env','http_proxy') }}" + HTTPS_PROXY: "{{ lookup('env','https_proxy') }}" + NO_PROXY: "{{ lookup('env','no_proxy') }}" pre_tasks: - name: Load distribution variables include_vars: file: "{{ item }}" with_items: - - "{{ XCI_PATH }}/xci/var/{{ ansible_os_family }}.yml" - - "{{ XCI_FLAVOR_ANSIBLE_FILE_PATH }}/flavor-vars.yml" + - "{{ xci_path }}/xci/var/{{ ansible_os_family }}.yml" + - "{{ xci_flavor_ansible_file_path }}/flavor-vars.yml" - name: Set facts for remote deployment set_fact: remote_xci_path: "{{ ansible_env.HOME }}/releng-xci" - remote_xci_flavor_files: "{{ ansible_env.HOME }}/releng-xci/xci/installer/{{INSTALLER_TYPE}}/files/{{ XCI_FLAVOR }}" + remote_xci_flavor_files: "{{ ansible_env.HOME }}/releng-xci/xci/installer/{{installer_type}}/files/{{ xci_flavor }}" remote_xci_playbooks: "{{ ansible_env.HOME }}/releng-xci/xci/playbooks" roles: - role: bootstrap-host - configure_network: XCI_FLAVOR != 'aio' + configure_network: xci_flavor != 'aio' + - role: peru.proxy_settings + proxy_settings_http_proxy: "{{ lookup('env','http_proxy') }}" + proxy_settings_https_proxy: "{{ lookup('env','https_proxy') }}" + proxy_settings_ftp_proxy: "{{ lookup('env','ftp_proxy') }}" + proxy_settings_no_proxy: "{{ lookup('env','no_proxy') }}" tasks: - name: generate SSH keys @@ -38,61 +50,71 @@ - name: fetch public key fetch: src: "{{ ansible_env.HOME }}/.ssh/id_rsa.pub" - dest: "{{ XCI_PATH }}/xci/files/authorized_keys" + dest: "{{ xci_path }}/xci/files/authorized_keys" flat: yes - name: Copy releng-xci to remote host synchronize: - src: "{{ XCI_PATH }}/" + src: "{{ xci_path }}/" dest: "{{ remote_xci_path }}" recursive: yes delete: yes - name: copy flavor inventory shell: "/bin/cp -rf {{ remote_xci_flavor_files }}/inventory {{ remote_xci_playbooks }}" - name: copy openstack_deploy - shell: "/bin/cp -rf {{OPENSTACK_OSA_PATH}}/etc/openstack_deploy {{OPENSTACK_OSA_ETC_PATH}}" + shell: "/bin/cp -rf {{openstack_osa_path}}/etc/openstack_deploy {{openstack_osa_etc_path}}" - name: copy openstack_user_config.yml - shell: "/bin/cp -rf {{ remote_xci_flavor_files }}/openstack_user_config.yml {{OPENSTACK_OSA_ETC_PATH}}" + shell: "/bin/cp -rf {{ remote_xci_flavor_files }}/openstack_user_config.yml {{openstack_osa_etc_path}}" failed_when: false - name: copy all user override files - shell: "/bin/cp -rf {{ remote_xci_flavor_files }}/user_variables.yml {{OPENSTACK_OSA_ETC_PATH}}" + shell: "/bin/cp -rf {{ remote_xci_flavor_files }}/user_variables.yml {{openstack_osa_etc_path}}" failed_when: false - name: copy cinder.yml - shell: "/bin/cp -rf {{ remote_xci_path }}/xci/installer/osa/files/cinder.yml {{OPENSTACK_OSA_ETC_PATH}}/env.d" + shell: "/bin/cp -rf {{ remote_xci_path }}/xci/installer/osa/files/cinder.yml {{openstack_osa_etc_path}}/env.d" - name: Configure OpenStack-Ansible components lineinfile: - path: "{{ OPENSTACK_OSA_ETC_PATH }}/user_variables.yml" + path: "{{ openstack_osa_etc_path }}/user_variables.yml" line: "{{ item.component }}: {{ item.value }}" state: present with_items: - - { component: "tempest_install", value: "{{ RUN_TEMPEST | bool }}" } - - { component: "tempest_run", value: "{{ RUN_TEMPEST | bool }}" } - - { component: "core_openstack", value: "{{ CORE_OPENSTACK_INSTALL | bool }}" } + - { component: "tempest_install", value: "{{ run_tempest | bool }}" } + - { component: "tempest_run", value: "{{ run_tempest | bool }}" } + - { component: "core_openstack", value: "{{ core_openstack_install | bool }}" } - block: - name: copy ceph.yml - shell: "/bin/cp -rf {{ remote_xci_flavor_files }}/ceph.yml {{OPENSTACK_OSA_ETC_PATH}}/conf.d/" + shell: "/bin/cp -rf {{ remote_xci_flavor_files }}/ceph.yml {{openstack_osa_etc_path}}/conf.d/" - name: copy user_ceph.yml - shell: "/bin/cp -rf {{ remote_xci_flavor_files }}/user_ceph.yml {{OPENSTACK_OSA_ETC_PATH}}/user_ceph.yml" + shell: "/bin/cp -rf {{ remote_xci_flavor_files }}/user_ceph.yml {{openstack_osa_etc_path}}/user_ceph.yml" - name: copy user_variables_ceph.yml - shell: "/bin/cp -rf {{ remote_xci_flavor_files }}/user_variables_ceph.yml {{OPENSTACK_OSA_ETC_PATH}}/user_variables_ceph.yml" - when: XCI_CEPH_ENABLED == "true" + shell: "/bin/cp -rf {{ remote_xci_flavor_files }}/user_variables_ceph.yml {{openstack_osa_etc_path}}/user_variables_ceph.yml" + when: xci_ceph_enabled == "true" + - block: + - name: copy user_variables_proxy.yml + shell: "/bin/cp -rf {{ remote_xci_path }}/xci/installer/osa/files/user_variables_proxy.yml {{openstack_osa_etc_path}}/user_variables_proxy.yml" + - name: "Configure http_proxy_env_url" + lineinfile: + path: "{{openstack_osa_etc_path}}/user_variables_proxy.yml" + regexp: "^http_proxy_env_url:.*" + line: "{{ 'http_proxy_env_url: ' + lookup('env','http_proxy') }}" + when: + - lookup('env','http_proxy') != "randomfoobarstring" - name: copy OPNFV OpenStack playbook - shell: "/bin/cp -rf {{ remote_xci_path }}/xci/installer/osa/files/setup-openstack.yml {{OPENSTACK_OSA_PATH}}/playbooks" + shell: "/bin/cp -rf {{ remote_xci_path }}/xci/installer/osa/files/setup-openstack.yml {{openstack_osa_path}}/playbooks" - name: copy pinned versions of OSA Roles and global requirements - shell: "/bin/cp -rf {{ remote_xci_path }}/xci/installer/osa/files/{{ item }} {{OPENSTACK_OSA_PATH}}/{{ item }}" + shell: "/bin/cp -rf {{ remote_xci_path }}/xci/installer/osa/files/{{ item }} {{openstack_osa_path}}/{{ item }}" with_items: - "ansible-role-requirements.yml" - "global-requirement-pins.txt" when: - - OPENSTACK_OSA_VERSION != "master" + - openstack_osa_version != "master" - name: copy pinned versions of OpenStack services - shell: "/bin/cp -rf {{ remote_xci_path }}/xci/installer/osa/files/openstack_services.yml {{OPENSTACK_OSA_PATH}}/playbooks/defaults/repo_packages/openstack_services.yml" + shell: "/bin/cp -rf {{ remote_xci_path }}/xci/installer/osa/files/openstack_services.yml {{openstack_osa_path}}/playbooks/defaults/repo_packages/openstack_services.yml" when: - - OPENSTACK_OSA_VERSION != "master" - - include: bootstrap-scenarios.yml + - openstack_osa_version != "master" + - include: "{{ xci_path }}/xci/playbooks/bootstrap-scenarios.yml" - name: bootstrap ansible on opnfv host command: "/bin/bash ./scripts/bootstrap-ansible.sh" args: - chdir: "{{OPENSTACK_OSA_PATH}}" + chdir: "{{openstack_osa_path}}" - name: install opnfv pip required packages pip: name: "{{ item }}" @@ -103,9 +125,9 @@ - python-neutronclient - python-openstackclient - name: generate password token - command: "python pw-token-gen.py --file {{OPENSTACK_OSA_ETC_PATH}}/user_secrets.yml" + command: "python pw-token-gen.py --file {{openstack_osa_etc_path}}/user_secrets.yml" args: - chdir: "{{OPENSTACK_OSA_PATH}}/scripts" + chdir: "{{openstack_osa_path}}/scripts" - name: check if certificate directory /etc/ssl/certs exists already stat: path=/etc/ssl/certs register: check_etc_ssl_certs @@ -132,7 +154,7 @@ become: true - name: fetch xci environment copy: - src: "{{ XCI_PATH }}/.cache/xci.env" + src: "{{ xci_path }}/.cache/xci.env" dest: /root/xci.env - hosts: localhost @@ -140,12 +162,12 @@ tasks: - name: Append public keys to authorized_keys - shell: "/bin/cat {{ ansible_env.HOME }}/.ssh/id_rsa.pub >> {{ XCI_PATH }}/xci/files/authorized_keys" + shell: "/bin/cat {{ ansible_env.HOME }}/.ssh/id_rsa.pub >> {{ xci_path }}/xci/files/authorized_keys" - hosts: opnfv remote_user: root vars_files: - - "{{ XCI_PATH }}/xci/var/opnfv.yml" + - "{{ xci_path }}/xci/var/opnfv.yml" pre_tasks: - name: Load distribution variables @@ -153,9 +175,9 @@ file: "{{ item }}" failed_when: false with_items: - - "{{ XCI_PATH }}/xci/var/{{ ansible_os_family }}.yml" - - "{{ XCI_FLAVOR_ANSIBLE_FILE_PATH }}/flavor-vars.yml" - - "{{ XCI_FLAVOR_ANSIBLE_FILE_PATH }}/user_variables.yml" + - "{{ xci_path }}/xci/var/{{ ansible_os_family }}.yml" + - "{{ xci_flavor_ansible_file_path }}/flavor-vars.yml" + - "{{ xci_flavor_ansible_file_path }}/user_variables.yml" roles: - role: "openstack-ansible-openstack_openrc" @@ -169,10 +191,10 @@ - name: fetch generated openrc fetch: src: "{{ ansible_env.HOME }}/openrc" - dest: "{{ XCI_PATH }}/.cache/openrc" + dest: "{{ xci_path }}/.cache/openrc" flat: true - name: add public key to host copy: - src: "{{ XCI_PATH }}/xci/files/authorized_keys" + src: "{{ xci_path }}/xci/files/authorized_keys" dest: /root/.ssh/authorized_keys |