diff --git a/ansible/generate_tripleo_inventory.sh b/ansible/generate_tripleo_inventory.sh index d6204fb04..8bc2f90f7 100755 --- a/ansible/generate_tripleo_inventory.sh +++ b/ansible/generate_tripleo_inventory.sh @@ -52,3 +52,11 @@ fi sed -i '1iBrowbeat:\n hosts:\n undercloud: {}' ${out_file} sed -i '$aStockpile:\n hosts:\n undercloud: {}' ${out_file} + +# Copy heat-admin key so we can use jumpbox +echo "" +echo "---------------------------" +echo "Copying heat-admin key to local machine for use with ssh config file" +echo "---------------------------" +echo "" +scp -o "UserKnownHostsFile /dev/null" -o "StrictHostKeyChecking no" "${user}@${tripleo_ip_address}":/home/${user}/.ssh/id_rsa heat-admin-id_rsa diff --git a/ansible/install/roles/browbeat/tasks/main.yml b/ansible/install/roles/browbeat/tasks/main.yml index 5ff184b99..8b078797c 100644 --- a/ansible/install/roles/browbeat/tasks/main.yml +++ b/ansible/install/roles/browbeat/tasks/main.yml @@ -42,9 +42,17 @@ when: ansible_distribution_major_version == '8' - name: Install pip - easy_install: - name: pip - become: true + block: + - name: get the pip installer + get_url: + validate_certs: no + url: "https://bootstrap.pypa.io/pip/2.7/get-pip.py" + dest: "/tmp/get-pip.py" + force: yes + + - name: run pip installer + shell: python /tmp/get-pip.py + when: ansible_distribution_major_version < '8' - name: Update virtualenv and setuptools @@ -95,23 +103,32 @@ path: "{{ browbeat_path }}/ansible/hosts" register: hosts_file_exists -- debug: msg="Hosts file is already generated." - when: hosts_file_exists.stat.exists and hosts_file_exists.stat.isreg +- name: Determine if generate_tripleo_inventory has been run + stat: + path: "{{ browbeat_path }}/ansible/hosts.yml" + register: hosts_yml_file_exists + +- name: set either of inventory file exists + set_fact: + inventry_file: "{{ (hosts_file_exists.stat.exists and hosts_file_exists.stat.isreg) or (hosts_yml_file_exists.stat.exists and hosts_yml_file_exists.stat.isreg) }}" + +- debug: msg="Hosts file is already generated. {{ inventry_file }}" + when: inventry_file - name: Generate hosts and ssh-config on Browbeat Machine - Default(stack) - shell: . {{ home_dir }}/stackrc; {{ browbeat_path }}/ansible/generate_tripleo_hostfile.sh -t localhost --user stack - when: tripleo and (not hosts_file_exists.stat.exists or not hosts_file_exists.stat.isreg) and ansible_user!= "zuul" + shell: . {{ home_dir }}/stackrc; {{ browbeat_path }}/ansible/generate_tripleo_inventory.sh -l --user stack + when: tripleo and (not inventry_file) and ansible_user!= "zuul" - name: Generate hosts and ssh-config on Browbeat Machine - Zuul - shell: . {{ home_dir }}/stackrc; {{ browbeat_path }}/ansible/generate_tripleo_hostfile.sh -t localhost --user zuul - when: tripleo and (not hosts_file_exists.stat.exists or not hosts_file_exists.stat.isreg) and ansible_user== "zuul" + shell: . {{ home_dir }}/stackrc; {{ browbeat_path }}/ansible/generate_tripleo_inventory.sh -l --user zuul + when: tripleo and (not inventry_file) and ansible_user== "zuul" - name: Move files to correct location - command: mv {{ home_dir }}/{{item}} {{ browbeat_path }}/ansible/{{item}} + command: mv {{item}} {{ browbeat_path }}/ansible/{{item}} with_items: - - hosts + - hosts.yml - heat-admin-id_rsa - when: "(tripleo and (not hosts_file_exists.stat.exists or not hosts_file_exists.stat.isreg))" + when: "(tripleo and (not inventry_file))" - name: Install requirements.txt into browbeat-venv pip: diff --git a/browbeat-config.yaml b/browbeat-config.yaml index cb08a7c05..04240fed4 100644 --- a/browbeat-config.yaml +++ b/browbeat-config.yaml @@ -8,7 +8,7 @@ browbeat: # rerun_type: complete rerun_type: iteration ansible: - hosts: ansible/hosts + hosts: ansible/hosts.yml metadata_playbook: ansible/gather/stockpile.yml logging_playbook: ansible/common_logging/browbeat_logging.yml ssh_config: ansible/ssh-config diff --git a/requirements.txt b/requirements.txt index 6d9637c93..c651f6af8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,7 +7,8 @@ pyrsistent>=0.17.0;python_version>='3' grafyaml>=0.0.7 openstacksdk python-dateutil>=2.4.2 -python-openstackclient>=3.11.0 +python-openstackclient==3.11.0;python_version<'3' +python-openstackclient>=3.11.0;python_version>='3' pykwalify==1.7.0;python_version<'3' pykwalify>=1.8.0;python_version>='3'