Add external repo and img roles to bm undercloud
This commit replaces the actual repo configuration and overcloud images preparation inclusions with the already existing external dedicated roles (repo-setup and fetch-images). To configure this the two playbooks are modified and a new "packages" subrole is created under the main baremetal-undercloud one. With this in place it is possible to follow this sequence: - Provide and prepare the undercloud machine (role baremetal-undercloud) - Inventory the newly created machine (role tripleo-inventory) - Setup repositories (role repo-setup) - Install and configure packages on undercloud (baremetal-undercloud's subrole named "packages"): - tripleo package - additional packages (optional) - ntp configuration (replaces what was done before in the custom template undercloud-repos-conf.sh.j2) - Install the undercloud A new review to update the documentation will be done after this gets merged. Change-Id: Iba11c4d61a63bb05016177abd16403168d82331b
This commit is contained in:
parent
9b9b90fa35
commit
e9588bb424
@ -1,13 +1,11 @@
|
||||
---
|
||||
# Provision and initial undercloud setup
|
||||
- name: Baremetal undercloud install
|
||||
hosts: localhost
|
||||
roles:
|
||||
- baremetal-undercloud
|
||||
tags:
|
||||
- undercloud-bm-install
|
||||
- baremetal-undercloud
|
||||
|
||||
# Machine at this point is provided
|
||||
- name: Add the undercloud node to the generated inventory
|
||||
hosts: localhost
|
||||
gather_facts: yes
|
||||
@ -16,8 +14,23 @@
|
||||
tags:
|
||||
- undercloud-inventory
|
||||
|
||||
# Deploy the undercloud
|
||||
- name: Deploy undercloud
|
||||
- name: Setup repositories
|
||||
hosts: undercloud
|
||||
gather_facts: yes
|
||||
roles:
|
||||
- repo-setup
|
||||
tags:
|
||||
- undercloud-repo-setup
|
||||
|
||||
- name: Install packages
|
||||
hosts: undercloud
|
||||
gather_facts: no
|
||||
roles:
|
||||
- baremetal-undercloud/packages
|
||||
tags:
|
||||
- undercloud-pkgs-install
|
||||
|
||||
- name: Deploy the undercloud
|
||||
hosts: undercloud
|
||||
gather_facts: no
|
||||
roles:
|
||||
@ -25,7 +38,6 @@
|
||||
tags:
|
||||
- undercloud-deploy
|
||||
|
||||
# Baremetal preparation (with workarounds)
|
||||
- name: Prepare baremetal for the overcloud deployment
|
||||
hosts: undercloud
|
||||
roles:
|
||||
@ -33,7 +45,6 @@
|
||||
tags:
|
||||
- baremetal-prep-overcloud
|
||||
|
||||
# Prepare any additional configuration files required by the overcloud
|
||||
- name: Prepare configuration files for the overcloud deployment
|
||||
hosts: undercloud
|
||||
gather_facts: no
|
||||
@ -42,7 +53,15 @@
|
||||
tags:
|
||||
- overcloud-prep-config
|
||||
|
||||
# Prepare the overcloud images for deployment
|
||||
- name: Fetch the overcloud images
|
||||
hosts: undercloud
|
||||
gather_facts: no
|
||||
become: true
|
||||
roles:
|
||||
- fetch-images
|
||||
tags:
|
||||
- overcloud-fetch-images
|
||||
|
||||
- name: Prepare the overcloud images for deployment
|
||||
hosts: undercloud
|
||||
gather_facts: no
|
||||
@ -51,7 +70,6 @@
|
||||
tags:
|
||||
- overcloud-prep-images
|
||||
|
||||
# Prepare the overcloud flavor configuration
|
||||
- name: Prepare overcloud flavors
|
||||
hosts: undercloud
|
||||
gather_facts: no
|
||||
@ -60,7 +78,6 @@
|
||||
tags:
|
||||
- overcloud-prep-flavors
|
||||
|
||||
# Prepare the undercloud networks for the overcloud deployment
|
||||
- name: Prepare the undercloud networks for the overcloud deployment
|
||||
hosts: undercloud
|
||||
gather_facts: no
|
||||
@ -69,7 +86,6 @@
|
||||
tags:
|
||||
- overcloud-prep-network
|
||||
|
||||
# Deploy the overcloud
|
||||
- name: Deploy the overcloud
|
||||
hosts: undercloud
|
||||
gather_facts: yes
|
||||
@ -88,7 +104,6 @@
|
||||
tags:
|
||||
- overcloud-inventory
|
||||
|
||||
# Check the results of the deployment, note after inventory has executed
|
||||
- name: Check the result of the deployment
|
||||
hosts: localhost
|
||||
tasks:
|
||||
@ -102,7 +117,6 @@
|
||||
tags:
|
||||
- overcloud-deploy-check
|
||||
|
||||
# HA Validation
|
||||
- name: Validate the overcloud using HA tests
|
||||
hosts: undercloud
|
||||
gather_facts: no
|
||||
|
@ -1,13 +1,11 @@
|
||||
---
|
||||
# Provision and initial undercloud setup
|
||||
- name: Baremetal undercloud install
|
||||
hosts: localhost
|
||||
roles:
|
||||
- baremetal-undercloud
|
||||
tags:
|
||||
- undercloud-bm-install
|
||||
- baremetal-undercloud
|
||||
|
||||
# Machine at this point is provided
|
||||
- name: Add the undercloud node to the generated inventory
|
||||
hosts: localhost
|
||||
gather_facts: yes
|
||||
@ -16,7 +14,22 @@
|
||||
tags:
|
||||
- undercloud-inventory
|
||||
|
||||
# Deploy the undercloud
|
||||
- name: Setup repositories
|
||||
hosts: undercloud
|
||||
gather_facts: yes
|
||||
roles:
|
||||
- repo-setup
|
||||
tags:
|
||||
- undercloud-repo-setup
|
||||
|
||||
- name: Install packages
|
||||
hosts: undercloud
|
||||
gather_facts: no
|
||||
roles:
|
||||
- baremetal-undercloud/packages
|
||||
tags:
|
||||
- undercloud-pkgs-install
|
||||
|
||||
- name: Deploy the undercloud
|
||||
hosts: undercloud
|
||||
gather_facts: no
|
||||
@ -25,7 +38,6 @@
|
||||
tags:
|
||||
- undercloud-deploy
|
||||
|
||||
# Baremetal preparation (with workarounds)
|
||||
- name: Prepare baremetal for the overcloud deployment
|
||||
hosts: undercloud
|
||||
roles:
|
||||
@ -33,7 +45,6 @@
|
||||
tags:
|
||||
- baremetal-prep-overcloud
|
||||
|
||||
# Prepare any additional configuration files required by the overcloud
|
||||
- name: Prepare configuration files for the overcloud deployment
|
||||
hosts: undercloud
|
||||
gather_facts: no
|
||||
@ -42,7 +53,15 @@
|
||||
tags:
|
||||
- overcloud-prep-config
|
||||
|
||||
# Prepare the overcloud images for deployment
|
||||
- name: Fetch the overcloud images
|
||||
hosts: undercloud
|
||||
gather_facts: no
|
||||
become: true
|
||||
roles:
|
||||
- fetch-images
|
||||
tags:
|
||||
- overcloud-fetch-images
|
||||
|
||||
- name: Prepare the overcloud images for deployment
|
||||
hosts: undercloud
|
||||
gather_facts: no
|
||||
@ -51,7 +70,6 @@
|
||||
tags:
|
||||
- overcloud-prep-images
|
||||
|
||||
# Prepare the overcloud flavor configuration
|
||||
- name: Prepare overcloud flavors
|
||||
hosts: undercloud
|
||||
gather_facts: no
|
||||
@ -60,7 +78,6 @@
|
||||
tags:
|
||||
- overcloud-prep-flavors
|
||||
|
||||
# Prepare the undercloud networks for the overcloud deployment
|
||||
- name: Prepare the undercloud networks for the overcloud deployment
|
||||
hosts: undercloud
|
||||
gather_facts: no
|
||||
@ -69,7 +86,6 @@
|
||||
tags:
|
||||
- overcloud-prep-network
|
||||
|
||||
# Deploy the overcloud
|
||||
- name: Deploy the overcloud
|
||||
hosts: undercloud
|
||||
gather_facts: yes
|
||||
@ -86,9 +102,8 @@
|
||||
roles:
|
||||
- tripleo-inventory
|
||||
tags:
|
||||
- overcloud-deploy-inventory
|
||||
- overcloud-inventory
|
||||
|
||||
# Check the results of the deployment, note after inventory has executed
|
||||
- name: Check the result of the deployment
|
||||
hosts: localhost
|
||||
tasks:
|
||||
@ -102,7 +117,6 @@
|
||||
tags:
|
||||
- overcloud-deploy-check
|
||||
|
||||
# Validate the deployment
|
||||
- name: Validate the overcloud
|
||||
hosts: undercloud
|
||||
gather_facts: no
|
||||
|
@ -5,24 +5,8 @@ undercloud_key: "{{ local_working_dir }}/id_rsa_undercloud"
|
||||
|
||||
baremetal_provisioning_log: "{{ local_working_dir }}/baremetal_provision.log"
|
||||
|
||||
undercloud_repos_conf_script: undercloud-repos-conf.sh.j2
|
||||
undercloud_repos_conf_log: "{{ working_dir }}/undercloud_repos_conf.log"
|
||||
|
||||
overcloud_images_script: overcloud-images.sh.j2
|
||||
overcloud_images_log: "{{ working_dir }}/overcloud_images.log"
|
||||
|
||||
undercloud_local_interface: eth1
|
||||
undercloud_network_cidr: 192.0.2.0/24
|
||||
|
||||
step_provide_undercloud: true
|
||||
step_prepare_undercloud: true
|
||||
step_undercloud_repos: true
|
||||
step_overcloud_images: true
|
||||
|
||||
repo_configure_list:
|
||||
- delorean:
|
||||
name: "delorean.repo"
|
||||
location: "http://buildlogs.centos.org/centos/7/cloud/x86_64/rdo-trunk-{{ release }}-tested/delorean.repo"
|
||||
- delorean-deps:
|
||||
name: "delorean-deps.repo"
|
||||
location: "http://trunk.rdoproject.org/centos7-{{ release }}/delorean-deps.repo"
|
||||
|
22
roles/baremetal-undercloud/packages/defaults/main.yml
Normal file
22
roles/baremetal-undercloud/packages/defaults/main.yml
Normal file
@ -0,0 +1,22 @@
|
||||
# Base tripleo package
|
||||
undercloud_tripleo_pkg: python-tripleoclient
|
||||
|
||||
# Additional packages
|
||||
undercloud_additional_pkgs:
|
||||
- vim
|
||||
- tmux
|
||||
- openssl
|
||||
- wget
|
||||
- bind-utils
|
||||
- net-tools
|
||||
- git
|
||||
- lftp
|
||||
- libguestfs-tools
|
||||
- sos
|
||||
|
||||
# Configure ntp on undercloud
|
||||
step_undercloud_ntp: true
|
||||
|
||||
# Custom ntp servers
|
||||
undercloud_custom_ntps:
|
||||
- clock.redhat.com
|
27
roles/baremetal-undercloud/packages/tasks/main.yml
Normal file
27
roles/baremetal-undercloud/packages/tasks/main.yml
Normal file
@ -0,0 +1,27 @@
|
||||
---
|
||||
# tasks file for baremetal-undercloud's packages subrole
|
||||
|
||||
# Install the Tripleo package (usually python-tripleoclient)
|
||||
- name: Install TripleO package
|
||||
become: true
|
||||
package:
|
||||
name: "{{ undercloud_tripleo_pkg }}"
|
||||
state: present
|
||||
tags:
|
||||
- undercloud-tripleo-pkg
|
||||
|
||||
# Install additional packages (if declared)
|
||||
- name: Install additional packages
|
||||
become: true
|
||||
package:
|
||||
name: "{{ undercloud_additional_pkgs|default([]) }}"
|
||||
state: present
|
||||
tags:
|
||||
- undercloud-additional-pkgs
|
||||
|
||||
# Configure ntp on undercloud
|
||||
- include: ntp.yml
|
||||
become: true
|
||||
when: "{{ step_undercloud_ntp|bool }}"
|
||||
tags:
|
||||
- undercloud-ntp
|
64
roles/baremetal-undercloud/packages/tasks/ntp.yml
Normal file
64
roles/baremetal-undercloud/packages/tasks/ntp.yml
Normal file
@ -0,0 +1,64 @@
|
||||
# Ensure ntp packages are installed
|
||||
- name: Install ntp packages
|
||||
package:
|
||||
name: [ 'ntp', 'ntpdate' ]
|
||||
state: present
|
||||
|
||||
# Enable ntpd service
|
||||
- name: Enable ntpd service
|
||||
service:
|
||||
name: 'ntpd'
|
||||
enabled: yes
|
||||
|
||||
# Enable ntpdate service
|
||||
- name: Enable ntpdate service
|
||||
service:
|
||||
name: 'ntpdate'
|
||||
enabled: yes
|
||||
|
||||
# Stop ntpd service
|
||||
- name: Ensure ntp service is stopped to be able to launch ntpdate
|
||||
service:
|
||||
name: 'ntpd'
|
||||
state: stopped
|
||||
|
||||
# Disable default ntp servers if custom servers are defined
|
||||
- name: Disable configured servers in ntp.conf (if custom servers are defined)
|
||||
replace:
|
||||
destfile: /etc/ntp.conf
|
||||
regexp: '^server (.*)'
|
||||
replace: '#server \1'
|
||||
when: undercloud_custom_ntps is defined
|
||||
|
||||
# Enable custom ntp servers if custom servers are defined
|
||||
- name: Add new server in ntp.conf (if custom servers are defined)
|
||||
lineinfile:
|
||||
destfile: /etc/ntp.conf
|
||||
line: 'server {{ item }} iburst'
|
||||
with_items: '{{ undercloud_custom_ntps|default([]) }}'
|
||||
|
||||
# Setup custom ntp servers in step-tickers if custom servers are defined
|
||||
- name: Set step-ticker (if custom servers are defined)
|
||||
lineinfile:
|
||||
destfile: /etc/ntp/step-tickers
|
||||
line: '{{ item }}'
|
||||
create: yes
|
||||
with_items: '{{ undercloud_custom_ntps|default([]) }}'
|
||||
|
||||
# Configure ntpdate hardware synchronization
|
||||
- name: Configure ntpdate to synchronize the hardware clock
|
||||
lineinfile:
|
||||
destfile: /etc/sysconfig/ntpdate
|
||||
regexp: '^SYNC_HWCLOCK=.*'
|
||||
line: 'SYNC_HWCLOCK=yes'
|
||||
|
||||
# Sync time now
|
||||
- name: Synchronize time immediately with ntpdate
|
||||
shell: ntpdate $(grep ^server /etc/ntp.conf | tail -1 | awk '{print $2}')
|
||||
changed_when: false
|
||||
|
||||
# Start ntpd
|
||||
- name: Start ntpd service
|
||||
service:
|
||||
name: 'ntpd'
|
||||
state: started
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
# tasks file for ansible-role-tripleo-baremetal-undercloud
|
||||
# tasks file for baremetal-undercloud
|
||||
|
||||
# Do machine provisioning
|
||||
- include: machine-provisioning.yml
|
||||
@ -10,15 +10,3 @@
|
||||
- include: machine-setup.yml
|
||||
tags:
|
||||
- machine-setup
|
||||
|
||||
# Configure repos and packages
|
||||
- include: undercloud-repos-conf.yml
|
||||
delegate_to: "{{ virthost }}"
|
||||
tags:
|
||||
- undercloud-repos-conf
|
||||
|
||||
# Get overcloud images
|
||||
- include: overcloud-images.yml
|
||||
delegate_to: "{{ virthost }}"
|
||||
tags:
|
||||
- overcloud-images
|
||||
|
@ -1,11 +0,0 @@
|
||||
# Copy overcloud images script
|
||||
- name: Copy repositories configuration script
|
||||
template:
|
||||
src: "{{ overcloud_images_script }}"
|
||||
dest: "{{ working_dir }}/overcloud-images.sh"
|
||||
mode: 0755
|
||||
|
||||
- name: Overcloud images
|
||||
shell: >
|
||||
{{ working_dir }}/overcloud-images.sh > {{ overcloud_images_log }} 2>&1
|
||||
when: step_overcloud_images
|
@ -1,12 +0,0 @@
|
||||
# Copy repo configuration script
|
||||
- name: Copy repositories configuration script
|
||||
template:
|
||||
src: "{{ undercloud_repos_conf_script }}"
|
||||
dest: "{{ working_dir }}/undercloud-repos-conf.sh"
|
||||
mode: 0755
|
||||
|
||||
- name: Execute repositories configuration script
|
||||
shell: >
|
||||
{{ working_dir }}/undercloud-repos-conf.sh > {{ undercloud_repos_conf_log }} 2>&1
|
||||
when: step_prepare_undercloud
|
||||
become: true
|
@ -1,26 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eux
|
||||
|
||||
### --start_docs
|
||||
## Prepare the images to be used in the overcloud
|
||||
## ==============================================
|
||||
|
||||
## Prepare the images
|
||||
## ------------------
|
||||
|
||||
## * Retrieve images from the known urls
|
||||
## ::
|
||||
|
||||
wget "{{ overcloud_image_url }}"
|
||||
wget "{{ ipa_image_url }}"
|
||||
for i in *.tar; do
|
||||
tar xvfp $i
|
||||
done
|
||||
|
||||
## * Change root password on the image
|
||||
## ::
|
||||
|
||||
virt-customize -a overcloud-full.qcow2 --root-password password:redhat
|
||||
|
||||
### --stop_docs
|
@ -1,53 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eux
|
||||
|
||||
### --start_docs
|
||||
## Prepare repos and packages on the undercloud
|
||||
## ============================================
|
||||
|
||||
## Prepare repos and packages
|
||||
## --------------------------
|
||||
|
||||
## * Install base and useful packages.
|
||||
## ::
|
||||
|
||||
yum install -y ntp ntpdate vim tmux openssl wget bind-utils net-tools git lftp libguestfs-tools sos
|
||||
|
||||
## * Fix time issues with ntp.
|
||||
## ::
|
||||
|
||||
yum erase -y chrony
|
||||
rm -f /etc/chrony*
|
||||
sed -i s'/^server.*//' /etc/ntp.conf
|
||||
sh -c 'echo "server clock.redhat.com iburst" >> /etc/ntp.conf'
|
||||
sh -c 'echo clock.redhat.com > /etc/ntp/step-tickers'
|
||||
sh -c 'echo "SYNC_HWCLOCK=yes" >> /etc/sysconfig/ntpdate'
|
||||
ntpdate clock.redhat.com
|
||||
systemctl enable ntpdate
|
||||
systemctl enable ntpd
|
||||
systemctl start ntpd
|
||||
|
||||
## * Configure repos.
|
||||
## ::
|
||||
|
||||
{% for repo in repo_configure_list %} # repo_configure_list defined in config/general_release
|
||||
curl -o /etc/yum.repos.d/{{ repo["name"] }} {{ repo["location"] }}
|
||||
{% endfor %}
|
||||
|
||||
{% if release == 'liberty' %}
|
||||
# (trown) Install ironic-python-agent from mitaka delorean for LIO support.
|
||||
# We either need to do that or include tgt from EPEL, and upstream
|
||||
# ironic-python-agent project does not actually even gate the stable branch.
|
||||
# I am working on getting them to remove the stable branch, which will give us
|
||||
# LIO support in liberty delorean.
|
||||
yum install -y http://trunk.rdoproject.org/centos7/55/17/5517b8e9aea3ded1052209384b4194d2caa97541_673a78a2/openstack-ironic-python-agent-1.1.1-dev6.el7.centos.noarch.rpm http://trunk.rdoproject.org/centos7/55/17/5517b8e9aea3ded1052209384b4194d2caa97541_673a78a2/python2-ironic-python-agent-1.1.1-dev6.el7.centos.noarch.rpm
|
||||
{% endif %}
|
||||
|
||||
## * Install TripleO packages.
|
||||
## ::
|
||||
|
||||
yum install -y yum-plugin-priorities
|
||||
yum install -y python-tripleoclient
|
||||
|
||||
### --stop_docs
|
Loading…
x
Reference in New Issue
Block a user