summaryrefslogtreecommitdiffstats
path: root/setup.sh
blob: 8d67d6d6d2551571d5dee9bd999e8f4c5a04e709 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#! /bin/bash

. opts.sh

action=$1
shift

case "$action" in
    all)
        ./setup.sh -i $inventory network "$@" || exit 1
        ./setup.sh -i $inventory prepare "$@" || exit 1
        ./setup.sh -i $inventory openshift "$@" || exit 1
        ./setup.sh -i $inventory gluster "$@" || exit 1
        ./setup.sh -i $inventory configure "$@" || exit 1
        ./setup.sh -i $inventory projects "$@" || exit 1
        ;;
    local)
        apply playbooks/local.yml "$@" || exit 1
        ;;
    vm)
        apply playbooks/ands-vm-setup.yml "$@" || exit 1
        ;;
    network)
        apply playbooks/ands-network.yml "$@" || exit 1
        ;;
    prepare)
        apply playbooks/ands-prepare.yml "$@" || exit 1
        ;;
    openshift)
        apply playbooks/openshift-install.yml "$@" || exit 1
        ;;
    gluster)
        apply playbooks/ands-gluster.yml "$@" || exit 1
        ;;
    migrate)
        from=$1
        to=$2
        [ -z "$from" -o -z "$to" ] && { usage "you must specify source and destination ip addresses" ; exit 1 ; }
        shift 2
        apply playbooks/ands-gluster-migrate.yml --extra-vars "gfs_from=$from gfs_to=$to"  "$@" || exit 1
#        echo "Currently unsupported, use scripts..."
        ;;
    ganesha)
        apply playbooks/ands-gluster-ganesha.yml "$@" || exit 1
        ;;
    configure)
        apply playbooks/openshift-setup.yml "$@" || exit 1
        ;;
    projects)
        apply playbooks/openshift-setup-projects.yml "$@" || exit 1
        ;;
    project)
        project=$1
        shift
        [ -n "$project" ] || { usage 'project name should be specified...' ; exit 1; }
        apply playbooks/openshift-setup-project.yml --extra-vars "ands_configure_project=$project" "$@" || exit 1
        ;;
    project_groups)
        project=$1
        shift
        [ -n "$project" ] || { usage 'project name should be specified...' ; exit 1; }
        apply playbooks/openshift-setup-project-groups.yml --extra-vars "ands_configure_project=$project" "$@" || exit 1
        ;;
    apps|project_apps)
        [ -n "$1" ] || { usage 'project name should be specified...' ; exit 1; }

        vars="ands_configure_project=$1"
        shift
        
        if [[ -n "$1" && ${1:0:1} != "-" ]]; then
            vars="$vars ands_configure_app=$1"
            shift
        fi
        apply playbooks/openshift-setup-apps.yml --extra-vars "$vars"  "$@" || exit 1
        ;;
    templates)
        if [ -n "$1" ]; then
            ./setup.sh -i $inventory project_templates "$@" || exit 1
        else
            ./setup.sh -i $inventory global_templates "$@" || exit 1
        fi
        ;;
    global_templates)
        apply playbooks/openshift-setup-resources.yml "$@" || exit 1
        ;;
    project_templates)
        [ -n "$1" ] || { usage 'project name should be specified...' ; exit 1; }

        vars="ands_configure_project=$1"
        shift
        
        if [[ -n "$1" && ${1:0:1} != "-" ]]; then
            vars="$vars ands_configure_template=$1"
            shift
        fi
        apply playbooks/openshift-setup-templates.yml --extra-vars "$vars"  "$@" || exit 1
        ;;
    adei_template)
        vars="ands_configure_project=adei ands_configure_template=60-adei.yml*"
        apply playbooks/openshift-setup-templates.yml --extra-vars "$vars"  "$@" || exit 1
        ;;
    openshift-masters)
        apply playbooks/openshift-add-masters.yml "$@" || exit 1
        ;;
    openshift-nodes)
        apply playbooks/openshift-add-nodes.yml "$@" || exit 1
        ;;
    openshift-etcd)
        apply playbooks/openshift-add-etcd.yml "$@" || exit 1
        ;;
    openshift-gluster)
        apply playbooks/openshift-add-gluster.yml "$@" || exit 1
        ;;
    masters)
        ./setup.sh -i $inventory network "$@" || exit 1
        ./setup.sh -i $inventory prepare "$@" || exit 1
        ./setup.sh -i $inventory openshift-masters "$@" || exit 1
        ./setup.sh -i $inventory gluster "$@" || exit 1
        ./setup.sh -i $inventory configure "$@" || exit 1
        ;;
    nodes)
        ./setup.sh -i $inventory network "$@" || exit 1
        ./setup.sh -i $inventory prepare "$@" || exit 1
        ./setup.sh -i $inventory openshift-nodes "$@" || exit 1
        ./setup.sh -i $inventory gluster "$@" || exit 1
        ./setup.sh -i $inventory configure "$@" || exit 1
        ;;
    users)
        apply playbooks/openshift-setup-users.yml "$@" || exit 1
        ;;
    security)
        apply playbooks/openshift-setup-security.yml "$@" || exit 1
        ;;
    storage)
        apply playbooks/openshift-setup-storage.yml "$@" || exit 1
        ;;
    vpn)
        apply playbooks/openshift-setup-vpn.yml "$@" || exit 1
        ;;
    certs)
        apply playbooks/openshift-redeploy-certificates.yml --extra-vars "openshift_certificates_redeploy_ca=true" "$@" || exit 1
        ;;
    upgrade)
        apply playbooks/openshift-upgrade.yml "$@" || exit 1
        ;;    
    health)
        apply playbooks/openshift-health.yml "$@" || exit
        ;;
    maintain)
        apply playbooks/maintain.yml "$@" || exit
        ;;
    software)
        apply playbooks/software.yml "$@" || exit
        ;;
    current)
        apply playbooks/current.yml "$@" || exit
        ;;
    setup)
        subrole=$2
        shift
        [ -n "$subrole" ] || { usage "Specify that to setup"; exit 1; }
        apply ands_openshift -e "subrole=$subrole" "$@"
        ;;
    *)
        apply $action "$@" || exit 1
esac