CI: Move ansible installation & configuration to Ansible
Continue to reduce the scope of setup_gate.sh. Allows us to more easily select python 2 or 3. Change-Id: If2eeeacbbbdf58afb765b4a39772b5a1af7b952b Partially Implements: blueprint python-3
This commit is contained in:
parent
3a6577bada
commit
c320077f08
@ -137,9 +137,32 @@
|
|||||||
dest: ironic-agent.kernel
|
dest: ironic-agent.kernel
|
||||||
when: scenario == "ironic"
|
when: scenario == "ironic"
|
||||||
|
|
||||||
- name: install kolla-ansible
|
- name: ensure /etc/ansible exists
|
||||||
|
file:
|
||||||
|
path: /etc/ansible
|
||||||
|
state: directory
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: install kolla-ansible and dependencies
|
||||||
|
vars:
|
||||||
|
# Test latest ansible version on Ubuntu, minimum supported on others.
|
||||||
|
ansible_version_constraint: "{{ '>=2.6' if base_distro == 'ubuntu' else '<2.7' }}"
|
||||||
pip:
|
pip:
|
||||||
name: "{{ kolla_ansible_src_dir }}"
|
name:
|
||||||
|
- "{{ kolla_ansible_src_dir }}"
|
||||||
|
- "ansible{{ ansible_version_constraint }}"
|
||||||
|
- "ara<1.0.0"
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: get ARA callback plugin path
|
||||||
|
command: "python -m ara.setup.callback_plugins"
|
||||||
|
changed_when: false
|
||||||
|
register: ara_callback_plugins
|
||||||
|
|
||||||
|
- name: template ansible.cfg
|
||||||
|
template:
|
||||||
|
src: "{{ kolla_ansible_local_src_dir }}/tests/templates/ansible.cfg.j2"
|
||||||
|
dest: /etc/ansible/ansible.cfg
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: copy passwords.yml file
|
- name: copy passwords.yml file
|
||||||
@ -179,6 +202,10 @@
|
|||||||
need_build_image
|
need_build_image
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
|
- name: Record the running state of the environment as seen by the setup module
|
||||||
|
shell:
|
||||||
|
cmd: ansible all -i {{ kolla_inventory_path }} -e ansible_user={{ ansible_user }} -m setup > /tmp/logs/ansible/initial-setup
|
||||||
|
|
||||||
# NOTE(mgoddard): We are using the script module here and later to ensure
|
# NOTE(mgoddard): We are using the script module here and later to ensure
|
||||||
# we use the local copy of these scripts, rather than the one on the remote
|
# we use the local copy of these scripts, rather than the one on the remote
|
||||||
# host, which could be checked out to a previous release (in an upgrade
|
# host, which could be checked out to a previous release (in an upgrade
|
||||||
|
3
tests/templates/ansible.cfg.j2
Normal file
3
tests/templates/ansible.cfg.j2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[defaults]
|
||||||
|
callback_plugins = {{ ara_callback_plugins.stdout }}
|
||||||
|
host_key_checking = False
|
@ -83,31 +83,6 @@ EOF
|
|||||||
mkdir -p /tmp/logs/build
|
mkdir -p /tmp/logs/build
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup_ansible {
|
|
||||||
RAW_INVENTORY=/etc/kolla/inventory
|
|
||||||
|
|
||||||
# Test latest ansible version on Ubuntu, minimum supported on others.
|
|
||||||
if [[ $BASE_DISTRO == "ubuntu" ]]; then
|
|
||||||
ANSIBLE_VERSION=">=2.6"
|
|
||||||
else
|
|
||||||
ANSIBLE_VERSION="<2.7"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# TODO(SamYaple): Move to virtualenv
|
|
||||||
sudo pip install -U "ansible${ANSIBLE_VERSION}" "ara<1.0.0"
|
|
||||||
|
|
||||||
sudo mkdir /etc/ansible
|
|
||||||
ara_location=$(python -m ara.setup.callback_plugins)
|
|
||||||
sudo tee /etc/ansible/ansible.cfg<<EOF
|
|
||||||
[defaults]
|
|
||||||
callback_plugins = ${ara_location}
|
|
||||||
host_key_checking = False
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Record the running state of the environment as seen by the setup module
|
|
||||||
ansible all -i ${RAW_INVENTORY} -e ansible_user=$USER -m setup > /tmp/logs/ansible/initial-setup
|
|
||||||
}
|
|
||||||
|
|
||||||
function prepare_images {
|
function prepare_images {
|
||||||
if [[ "${BUILD_IMAGE}" == "False" ]]; then
|
if [[ "${BUILD_IMAGE}" == "False" ]]; then
|
||||||
return
|
return
|
||||||
@ -127,8 +102,8 @@ function prepare_images {
|
|||||||
|
|
||||||
setup_openstack_clients
|
setup_openstack_clients
|
||||||
|
|
||||||
setup_ansible
|
|
||||||
setup_config
|
setup_config
|
||||||
|
|
||||||
|
RAW_INVENTORY=/etc/kolla/inventory
|
||||||
tools/kolla-ansible -i ${RAW_INVENTORY} -e ansible_user=$USER -vvv bootstrap-servers &> /tmp/logs/ansible/bootstrap-servers
|
tools/kolla-ansible -i ${RAW_INVENTORY} -e ansible_user=$USER -vvv bootstrap-servers &> /tmp/logs/ansible/bootstrap-servers
|
||||||
prepare_images
|
prepare_images
|
||||||
|
Loading…
Reference in New Issue
Block a user