tripleo-common/workbooks/ceph-ansible.yaml
Giulio Fidente 4de3893f0d Make Ansible env variables configurable
Some env variables set for the ansible-playbook execution were
hardcoded; this change configures them as a default workflow
input so they can be overridden from the called (tripleo templates).

Also adds to the list /var/log/mistral as default location
for the ceph-install workflow logging.

Change-Id: Ibf748c5ee579e4c84785b6ef7674ee32fc3573e5
2017-08-22 15:12:02 +00:00

91 lines
4.3 KiB
YAML

---
version: '2.0'
name: tripleo.storage.v1
description: TripleO manages Ceph with ceph-ansible
workflows:
ceph-install:
# allows for additional extra_vars via workflow input
input:
- ansible_playbook_verbosity: 0
- ansible_skip_tags: 'package-install,with_pkg'
- ansible_extra_env_variables:
ANSIBLE_CONFIG: /usr/share/ceph-ansible/ansible.cfg
ANSIBLE_ACTION_PLUGINS: /usr/share/ceph-ansible/plugins/actions/
ANSIBLE_ROLES_PATH: /usr/share/ceph-ansible/roles/
ANSIBLE_RETRY_FILES_ENABLED: 'False'
ANSIBLE_LOG_PATH: /var/log/mistral/ceph-install-workflow.log
ANSIBLE_LIBRARY: /usr/share/ceph-ansible/library/
- ceph_ansible_extra_vars: {}
- ceph_ansible_playbook: /usr/share/ceph-ansible/site-docker.yml.sample
tasks:
enable_ssh_admin:
workflow: tripleo.access.v1.enable_ssh_admin
on-success: get_private_key
get_private_key:
action: tripleo.validations.get_privkey
publish:
private_key: <% task(get_private_key).result %>
on-success: set_ip_lists
set_ip_lists:
publish:
mon_ips: <% env().get('service_ips', {}).get('ceph_mon_ctlplane_node_ips', []) %>
osd_ips: <% env().get('service_ips', {}).get('ceph_osd_ctlplane_node_ips', []) %>
mds_ips: <% env().get('service_ips', {}).get('ceph_mds_ctlplane_node_ips', []) %>
rgw_ips: <% env().get('service_ips', {}).get('ceph_rgw_ctlplane_node_ips', []) %>
client_ips: <% env().get('service_ips', {}).get('ceph_client_ctlplane_node_ips', []) %>
on-success: set_fork_count
set_fork_count:
publish: # unique list of all IPs: make each list a set, take unions and count
fork_count: <% min($.mon_ips.toSet().union($.osd_ips.toSet()).union($.mds_ips.toSet()).union($.rgw_ips.toSet()).union($.client_ips.toSet()).count(), 100) %> # don't use >100 forks
on-success: make_fetch_directory
make_fetch_directory:
action: tripleo.files.make_temp_dir
publish:
fetch_directory: <% task(make_fetch_directory).result.path %>
on-success: set_role_vars
set_role_vars:
publish:
# NOTE(gfidente): collect role settings from all tht roles
mon_vars: <% env().get('role_merged_configs').items().select($[1].get('ceph_mon_ansible_vars', {})).aggregate($1.mergeWith($2)) %>
osd_vars: <% env().get('role_merged_configs').items().select($[1].get('ceph_osd_ansible_vars', {})).aggregate($1.mergeWith($2)) %>
mds_vars: <% env().get('role_merged_configs').items().select($[1].get('ceph_mds_ansible_vars', {})).aggregate($1.mergeWith($2)) %>
rgw_vars: <% env().get('role_merged_configs').items().select($[1].get('ceph_rgw_ansible_vars', {})).aggregate($1.mergeWith($2)) %>
on-success: build_extra_vars
build_extra_vars:
publish:
# NOTE(gfidente): merge vars from all ansible roles
extra_vars: <% {'fetch_directory'=> $.fetch_directory} + $.mon_vars + $.osd_vars + $.mds_vars + $.rgw_vars + $.ceph_ansible_extra_vars %>
on-success: ceph_install
ceph_install:
action: tripleo.ansible-playbook
input:
inventory:
mons:
hosts: <% $.mon_ips.toDict($, {}) %>
osds:
hosts: <% $.osd_ips.toDict($, {}) %>
mdss:
hosts: <% $.mds_ips.toDict($, {}) %>
rgws:
hosts: <% $.rgw_ips.toDict($, {}) %>
clients:
hosts: <% $.client_ips.toDict($, {}) %>
playbook: <% $.ceph_ansible_playbook %>
remote_user: tripleo-admin
become: true
become_user: root
verbosity: <% $.ansible_playbook_verbosity %>
forks: <% $.fork_count %>
ssh_private_key: <% $.private_key %>
ssh_common_args: '-o StrictHostKeyChecking=no'
ssh_extra_args: '-o UserKnownHostsFile=/dev/null'
skip_tags: <% $.ansible_skip_tags %>
extra_env_variables: <% $.ansible_extra_env_variables %>
extra_vars: <% $.extra_vars %>
publish:
output: <% task(ceph_install).result %>
on-complete: purge_fetch_directory
purge_fetch_directory:
action: tripleo.files.remove_temp_dir path=<% $.fetch_directory %>