summaryrefslogtreecommitdiff
path: root/bootstrap.mdwn
blob: 7154ec230af2fdc8fa74d15744f561c979b05abf (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
[[!toc  levels=4]]

Bootstrap de uma configura��o completa
======================================

Configura��o do puppet
----------------------

    apt-get install puppetmaster puppet git-core openssh-server
    cd /etc/puppet
    mkdir modules
    git init
    git add .
    
    repos="`lynx -dump http://git.sarava.org/?a=project_index | awk '{ print $1 }' | grep ^puppet-`"
    for repo in $repos; do
      module="`basename $repo .git | cut -d - -f 2`"
      if [ ! -d "modules/$module" ]; then
        git submodule add git://git.sarava.org/puppet-$module.git modules/$module
      fi
    done

No caso de bootstrap para um novo projeto, substitua as refer�ncias de git.sarava.org para git.dominio.

Configurando refer�ncias remotas em massa
-----------------------------------------

    # Configuracao
    origin="sarava.org"
    remotes="sarava.org:porta"
    repos="`lynx -dump http://git.$origin/?a=project_index | awk '{ print $1 }' | grep ^puppet-`"

    # Adicionando referencias
    for repo in $repos; do
      module="`basename $repo .git | cut -d - -f 2`"
      if [ -d "puppet-$module" ]; then
        cd puppet-$module
        for remote in $remotes; do
          ref="`echo $remote   | cut -d . -f 1`"
          domain="`echo remote | cut -d : -f 1`"
          port="`echo remote   | cut -d : -f 2`"
          git remote add $ref ssh://gitosis@git.$domain:$port/puppet-$module.git
          git push $ref master
        done
        cd ..
      fi
    done

Mudando refer�ncias em subm�dulos
---------------------------------

    # Configuracao
    origin="sarava.org"
    dest="exemplo.org"

    cd puppet
    sed -i -e "s/git.$origin/git.$dest/" .gitmodules
    cd modules
    for module in `ls`; do
      cd $module
      git remote rm origin
      git remote add origin git://git.$dest/puppet-$module.git
      git config branch.master.remote origin
      git config branch.master.merge refs/heads/master
      cd ..
    done

Exemplo de cria��o em massa de m�dulos
--------------------------------------

    # Configuracao
    origin="sarava.org"
    remotes="sarava.org:porta"

    mkdir puppet-{ikiwiki,moin,mysql,trac}/manifests -p
    touch puppet-{ikiwiki,moin,mysql,trac}/manifests/init.pp
    for module in ikiwiki moin mysql trac; do
      cd puppet-$module
      cp ../puppet-git/LICENSE .
      git init
      git add .
      git commit -a -m "Initial import"
      for remote in $remotes; do
        ref="`echo $remote   | cut -d . -f 1`"
        domain="`echo remote | cut -d : f 1`"
        port="`echo remote   | cut -d : f 2`"
        git remote add $ref ssh://gitosis@git.$domain:$port/puppet-$module.git
        git push $ref master
      done
      cd ..
    done