tripleo-heat-templates/puppet/services/tripleo-packages.yaml

230 lines
9.3 KiB
YAML

heat_template_version: queens
description: >
TripleO Package installation settings
parameters:
ServiceData:
default: {}
description: Dictionary packing service data
type: json
ServiceNetMap:
default: {}
description: Mapping of service_name -> network name. Typically set
via parameter_defaults in the resource registry. This
mapping overrides those in ServiceNetMapDefaults.
type: json
DefaultPasswords:
default: {}
type: json
RoleName:
default: ''
description: Role name on which the service is applied
type: string
RoleParameters:
default: {}
description: Parameters specific to the role
type: json
EndpointMap:
default: {}
description: Mapping of service endpoint -> protocol. Typically set
via parameter_defaults in the resource registry.
type: json
EnablePackageInstall:
default: 'false'
description: Set to true to enable package installation at deploy time
type: boolean
FastForwardRepoType:
default: 'tripleo-repos'
type: string
constraints:
- allowed_values: ['tripleo-repos', 'custom-script']
FastForwardRepoArgs:
default: {'tripleo_repos': {'ocata': '-b ocata current', 'pike': '-b pike current', 'queens': '-b queens current'}}
type: json
FastForwardCustomRepoScriptContent:
default: |
#!/bin/bash
set -e
echo "If you use FastForwardRepoType 'custom-script' you have to provide the upgrade repo script content."
echo "It will be installed as /root/ffu_upgrade_repo.sh on the node"
echo "and passed the upstream name (ocata, pike, queens) of the release as first argument"
exit 1
type: string
UpgradeInitCommand:
type: string
description: |
Command or script snippet to run on all overcloud nodes to
initialize the upgrade process. E.g. a repository switch.
default: ''
UpgradeInitCommonCommand:
type: string
description: |
Common commands required by the upgrades process. This should not
normally be modified by the operator and is set and unset in the
major-upgrade-composable-steps.yaml and major-upgrade-converge.yaml
environment files.
default: ''
outputs:
role_data:
description: Role data for the TripleO package settings
value:
service_name: tripleo_packages
config_settings:
tripleo::packages::enable_install: {get_param: EnablePackageInstall}
step_config: |
include ::tripleo::packages
upgrade_tasks:
- name: Package and repo update tasks
when: step|int == 0
block:
- name: Run UpgradeInitCommand
shell:
list_join:
- ''
- - "#!/bin/bash\n\n"
- "if [[ -f /etc/resolv.conf.save ]] ; then rm /etc/resolv.conf.save; fi\n\n"
- {get_param: UpgradeInitCommand}
- name: Run UpgradeInitCommonCommand
shell:
list_join:
- ''
- - "#!/bin/bash\n\n"
- {get_param: UpgradeInitCommonCommand}
- name: Check yum for rpm-python present
package: "name=rpm-python state=present"
register: rpm_python_check
- name: Fail when rpm-python wasn't present
fail: msg="rpm-python package was not present before this run! Check environment before re-running"
when:
- rpm_python_check.changed != false
- name: Check for os-net-config upgrade
shell: "yum check-upgrade | awk '/os-net-config/{print}'"
register: os_net_config_need_upgrade
when: step|int == 3
- name: Check that os-net-config has configuration
shell: test -s /etc/os-net-config/config.json
register: os_net_config_has_config
ignore_errors: True
when: step|int == 3
- block:
- name: Upgrade os-net-config
yum: name=os-net-config state=latest
- name: take new os-net-config parameters into account now
command: os-net-config --no-activate -c /etc/os-net-config/config.json -v --detailed-exit-codes
register: os_net_config_upgrade
failed_when: os_net_config_upgrade.rc not in [0,2]
changed_when: os_net_config_upgrade.rc == 2
when:
- step|int == 3
- os_net_config_need_upgrade.stdout
- os_net_config_has_config.rc == 0
- name: Check if node is hosting a Ceph OSD
when: step|int == 3
# NOTE(gfidente): like we already do in
# https://github.com/openstack/tripleo-heat-templates/blob/stable/queens/extraconfig/tasks/pacemaker_common_functions.sh#L416-L419
command: pgrep -x ceph-osd
register: is_hosting_ceph_osd
ignore_errors: True
- name: Remove ceph-osd when possible
yum: name=ceph-osd state=absent
when:
- step|int == 3
- is_hosting_ceph_osd.rc != 0
- name: Update all but Ceph packages
when: step|int == 3
yum: name=* state=latest exclude=ceph*,librados*,librbd*,libcephfs*,librgw*,python-rados*,python-rbd*,python-cephfs*,python-rgw*,rbd-mirror
update_tasks:
- name: Check for existing yum.pid
stat: path=/var/run/yum.pid
register: yum_pid_file
when: step|int == 0 or step|int == 3
- name: Exit if existing yum process
fail: msg="ERROR existing yum.pid detected - can't continue! Please ensure there is no other package update process for the duration of the minor update worfklow. Exiting."
when: (step|int == 0 or step|int == 3) and yum_pid_file.stat.exists
- name: Check if node is hosting a Ceph OSD
when: step|int == 3
# NOTE(gfidente): like we already do in
# https://github.com/openstack/tripleo-heat-templates/blob/stable/queens/extraconfig/tasks/pacemaker_common_functions.sh#L416-L419
command: pgrep -x ceph-osd
register: is_hosting_ceph_osd
ignore_errors: True
- name: Remove ceph-osd when possible
yum: name=ceph-osd state=absent
when:
- step|int == 3
- is_hosting_ceph_osd.rc != 0
- name: Update all packages
yum: name=* state=latest update_cache=yes
when: step == "3"
fast_forward_upgrade_tasks:
- name: Register repo type and args
set_fact:
fast_forward_repo_type: {get_param: FastForwardRepoType}
fast_forward_repo_args: {get_param: FastForwardRepoArgs}
when: step|int == 3
- debug:
msg: "fast_forward_repo_type: {{ fast_forward_repo_type }} fast_forward_repo_args: {{ fast_forward_repo_args }}"
when: step|int == 3
- block:
- name: clone tripleo-repos
git:
repo: https://github.com/openstack/tripleo-repos.git
dest: /home/stack/tripleo-repos/
- name: install tripleo-repos
command: python setup.py install
args:
chdir: /home/stack/tripleo-repos/
- name: Enable tripleo-repos
command: "tripleo-repos {{ fast_forward_repo_args.tripleo_repos[release] }}"
when:
- step|int == 3
- ffu_packages_apply|bool
- fast_forward_repo_type == 'tripleo-repos'
- block:
- name: Create custom Script for upgrading repo.
copy:
dest: /root/ffu_update_repo.sh
content: {get_param: FastForwardCustomRepoScriptContent}
mode: 0700
- name: Execute custom script for upgrading repo.
shell: "/root/ffu_update_repo.sh {{release}}"
when:
- step|int == 3
- ffu_packages_apply|bool
- fast_forward_repo_type == 'custom-script'
fast_forward_post_upgrade_tasks:
- name: Register repo type and args
set_fact:
fast_forward_repo_type: {get_param: FastForwardRepoType}
fast_forward_repo_args: {get_param: FastForwardRepoArgs}
- debug:
msg: "fast_forward_repo_type: {{ fast_forward_repo_type }} fast_forward_repo_args: {{ fast_forward_repo_args }}"
- block:
- name: clone tripleo-repos
git:
repo: https://github.com/openstack/tripleo-repos.git
dest: /home/stack/tripleo-repos/
- name: install tripleo-repos
command: python setup.py install
args:
chdir: /home/stack/tripleo-repos/
- name: Enable tripleo-repos
command: "tripleo-repos {{ fast_forward_repo_args.tripleo_repos[release] }}"
when:
- ffu_packages_apply|bool
- fast_forward_repo_type == 'tripleo-repos'
- block:
- name: Create custom Script for upgrading repo.
copy:
dest: /root/ffu_update_repo.sh
content: {get_param: FastForwardCustomRepoScriptContent}
mode: 0700
- name: Execute custom script for upgrading repo.
shell: "/root/ffu_update_repo.sh {{release}}"
when:
- ffu_packages_apply|bool
- fast_forward_repo_type == 'custom-script'