20507623d0
This patch fixes the latest references that are around and refer to the old repository name (tripleo-quickstart-utils), changing it into the new tripleo-ha-utils. Change-Id: I426387486b832314882a3094966e4f2806218331
129 lines
5.0 KiB
YAML
129 lines
5.0 KiB
YAML
---
|
|
- name: check ANSIBLE_ROLES_PATH variable
|
|
hosts: localhost
|
|
tasks:
|
|
|
|
- shell: |
|
|
echo $ANSIBLE_ROLES_PATH
|
|
name: check $ANSIBLE_ROLES_PATH variable
|
|
register: ansible_roles_path_out
|
|
|
|
- name: check $ANSIBLE_ROLES_PATH is set
|
|
fail:
|
|
msg: Please export ANSIBLE_ROLES_PATH='plugins/tripleo-ha-utils/roles' ; Before running this playbook with infrared.
|
|
when: '"tripleo-ha-utils" not in ansible_roles_path_out.stdout'
|
|
|
|
|
|
#manual override because of https://github.com/ansible/ansible/issues/26336
|
|
#- name: Configure Instance HA
|
|
# hosts: undercloud
|
|
# gather_facts: yes
|
|
#
|
|
# tasks:
|
|
#
|
|
# - include_role:
|
|
# name: instance-ha
|
|
|
|
#This creates the clouds.yaml file from undercloud/overcloud credentials
|
|
#for use in pythonsdk api for osp connection and querrying:
|
|
|
|
- name: create clouds.yaml for pythonsdk api
|
|
hosts: undercloud
|
|
tasks:
|
|
|
|
- name: get undercloud variables
|
|
shell: |
|
|
for key in $( set | awk '{FS="="} /^OS_/ {print $1}' ); do unset $key ; done
|
|
source /home/stack/stackrc
|
|
echo -n "undercloud: {'auth': { 'auth_url': '$OS_AUTH_URL', 'username': '$OS_USERNAME', 'password': '$OS_PASSWORD', 'project_name': '${OS_PROJECT_NAME:-$OS_TENANT_NAME}', 'project_domain_name': '$OS_PROJECT_DOMAIN_NAME', 'user_domain_name': '$OS_USER_DOMAIN_NAME'}}"
|
|
|
|
register: cloud_details
|
|
|
|
- name: create clouds.yaml if doesn't exist
|
|
blockinfile:
|
|
content: 'clouds:'
|
|
dest: /home/stack/clouds.yaml
|
|
marker: "#{mark} HEADER"
|
|
create: yes
|
|
|
|
- name: insert undercloud parameters
|
|
blockinfile:
|
|
dest: /home/stack/clouds.yaml
|
|
block: |5
|
|
{{ cloud_details.stdout|from_yaml|to_nice_yaml(indent=4) }}
|
|
insertbefore: "#END undercloud SECTION"
|
|
marker: "#{mark} undercloud PARAMETERS"
|
|
|
|
- name: get overcloud variables
|
|
shell: |
|
|
for key in $( set | awk '{FS="="} /^OS_/ {print $1}' ); do unset $key ; done
|
|
source /home/stack/overcloudrc
|
|
echo -n "overcloud: {'auth': { 'auth_url': '$OS_AUTH_URL', 'username': '$OS_USERNAME', 'password': '$OS_PASSWORD', 'project_name': '${OS_PROJECT_NAME:-$OS_TENANT_NAME}', 'project_domain_name': '$OS_PROJECT_DOMAIN_NAME', 'user_domain_name': '$OS_USER_DOMAIN_NAME' }}"
|
|
|
|
register: cloud_details
|
|
|
|
- name: create clouds.yaml if doesn't exist
|
|
blockinfile:
|
|
content: 'clouds:'
|
|
dest: /home/stack/clouds.yaml
|
|
marker: "#{mark} HEADER"
|
|
create: yes
|
|
|
|
- name: insert overcloud parameters
|
|
blockinfile:
|
|
dest: /home/stack/clouds.yaml
|
|
block: |5
|
|
{{ cloud_details.stdout|from_yaml|to_nice_yaml(indent=4) }}
|
|
insertbefore: "#END overcloud SECTION"
|
|
marker: "#{mark} overcloud PARAMETERS"
|
|
|
|
|
|
#This executes all from the undercloud itself:
|
|
|
|
- name: Configure Instance HA
|
|
hosts: undercloud
|
|
gather_facts: no
|
|
tasks:
|
|
|
|
- name: create ansible hosts file
|
|
template:
|
|
src: templates/ansible_hosts.yml.j2
|
|
dest: /home/stack/hosts
|
|
owner: stack
|
|
group: stack
|
|
mode: 0644
|
|
|
|
- name: create ssh.config.ansible file
|
|
shell: |
|
|
source /home/stack/stackrc
|
|
echo -e "Host undercloud\n Hostname 127.0.0.1\n IdentityFile /home/stack/.ssh/id_rsa\n User stack\n StrictHostKeyChecking no\n UserKnownHostsFile=/dev/null\n" > ssh.config.ansible
|
|
openstack server list -c Name -c Networks | awk '/ctlplane/ {print $2, $4}' | sed s/ctlplane=//g | while read node; do node_name=$(echo $node | cut -f 1 -d " "); node_ip=$(echo $node | cut -f 2 -d " "); echo -e "Host $node_name\n Hostname $node_ip\n IdentityFile /home/stack/.ssh/id_rsa\n User heat-admin\n StrictHostKeyChecking no\n UserKnownHostsFile=/dev/null\n"; done >> ssh.config.ansible
|
|
|
|
- name: get tripleo-ha-utils repo
|
|
git:
|
|
repo: 'https://github.com/openstack/tripleo-ha-utils.git'
|
|
dest: /home/stack/tripleo-ha-utils
|
|
|
|
- name: create ansible env file
|
|
shell: |
|
|
cat >/home/stack/ansible_ha.env<<EOF
|
|
export ANSIBLE_INVENTORY="/home/stack/hosts"
|
|
export ANSIBLE_SSH_ARGS="-F /home/stack/ssh.config.ansible"
|
|
export ANSIBLE_CONFIG="/home/stack/ansible.cfg"
|
|
|
|
- name: create ansible.cfg file
|
|
shell: |
|
|
printf "[defaults]\nroles_path = /home/stack/tripleo-ha-utils/roles" > /home/stack/ansible.cfg
|
|
|
|
- name: run instance-ha deploy script
|
|
shell: |
|
|
source /home/stack/ansible_ha.env
|
|
ansible-playbook -v /home/stack/tripleo-ha-utils/playbooks/overcloud-instance-ha.yml -e release={{release}} -e stonith_devices={{stonith_devices}} -e instance_ha_shared_storage={{instance_ha_shared_storage}} -e instance_ha_action={{instance_ha_action}}
|
|
register: instance_ha_deploy_outcome
|
|
|
|
vars:
|
|
instance_ha_action: '{{ install.instance_ha_action }}'
|
|
release: '{{ install.release }}'
|
|
stonith_devices: '{{ install.stonith_devices }}'
|
|
instance_ha_shared_storage: '{{ install.instance_ha_shared_storage }}'
|