ceph-ansible/contrib/splitup.yml

70 lines
1.9 KiB
YAML
Raw Normal View History

---
# This repice can be used to split this repo and keep the part updated!
# Use it like this:
#
# ansible-playbook -i dummy-ansible-hosts contrib/splitup.yml \
# --tags split --extra-vars github=mhubig/ansible
#
# ansible-playbook -i dummy-ansible-hosts contrib/splitup.yml \
# --tags update --extra-vars github=mhubig/ansible
#
# To point to a specific role, ie: ceph-mon just run with "-e roles=ceph-mon"
#
- name: This recipe split the roles into repos and keeps them updated.
hosts: localhost
connection: local
gather_facts: False
vars:
github: ceph/ansible
roles:
- ceph-common
- ceph-mon
- ceph-osd
- ceph-mds
- ceph-rgw
- ceph-restapi
- ceph-agent
- ceph-fetch-keys
basedir: "{{ lookup('pipe', 'git rev-parse --show-toplevel') }}"
tasks:
- name: check for github prefix option on commandline
tags: split
fail:
msg: 'github prefix missing! e.g: (--extra-vars github=ceph/ansible).'
when: github == False
- name: split the repo in seperate branches
tags: split
command: git subtree split --prefix=roles/{{ item }} -b {{ item }} --squash
args:
chdir: "{{ basedir }}"
with_items: roles
- name: adds remote github repos for the splits
tags: split
command: git remote add {{ item }} git@github.com:{{ github }}-{{ item }}.git
args:
chdir: "{{ basedir }}"
with_items: roles
- name: adds upstream remote
tags: update
command: git remote add upstream git@github.com:ceph/ceph-ansible.git
failed_when: false
- name: pulles the newest changes from upstream
tags: update
command: git pull upstream master:master
- name: update the split repos from master
tags: update
shell: git push {{ item }} $(git subtree split --prefix roles/{{ item }} master):master --force
args:
chdir: "{{ basedir }}"
with_items: roles