Commit 69617e4fa360dc8255678d450636964811a166ff

Authored by Macartur Carvalho
1 parent f04ec469

Adicionando script instalacao ldap e atualizando instalacaogitlab.sh

script/instalacaoGitlab.sh
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # Coloque aqui os ips do gitlab e do redmine 3 # Coloque aqui os ips do gitlab e do redmine
4 -IP_GITLAB=  
5 -IP_REDMINE= 4 +IP_GITLAB="localhost"
  5 +IP_REDMINE="localhost"
  6 +IP_LDAP="localhost"
  7 +PASSWORD_LDAP="12345678" #"cfl5OcVJ"
6 8
7 while [ -e $IP_GITLAB ] 9 while [ -e $IP_GITLAB ]
8 do 10 do
@@ -28,6 +30,26 @@ do @@ -28,6 +30,26 @@ do
28 fi 30 fi
29 done 31 done
30 32
  33 +while [ -e $IP_LDAP ]
  34 +do
  35 + echo "Digite o IP externo do Redmine: "
  36 + read IP_LDAP
  37 + echo "Senha Ldap:"
  38 + read PASSWORD_LDAP
  39 + echo "IP digitado: $IP_LDAP"
  40 + echo "PASSWORD digitado foi: $PASSWORD_LDAP"
  41 + echo "Confirma (y/n)?"
  42 + read CONFIRMA
  43 + if [ "$CONFIRMA" != "y" ] ; then
  44 + IP_LDAP=
  45 + PASSWORD_LDAP=
  46 + fi
  47 +done
  48 +
  49 +
  50 +
  51 +
  52 +
31 # Atualizar o sistema 53 # Atualizar o sistema
32 sudo yum update -y 54 sudo yum update -y
33 55
@@ -55,10 +77,6 @@ sudo echo "unicorn['port'] = 3456" >> /etc/gitlab/gitlab.rb @@ -55,10 +77,6 @@ sudo echo "unicorn['port'] = 3456" >> /etc/gitlab/gitlab.rb
55 sudo echo "gitlab_rails['internal_api_url'] = 'http://localhost:3456'" >> /etc/gitlab/gitlab.rb 77 sudo echo "gitlab_rails['internal_api_url'] = 'http://localhost:3456'" >> /etc/gitlab/gitlab.rb
56 sudo echo "external_url \"http://$IP_GITLAB\"" >> /etc/gitlab/gitlab.rb 78 sudo echo "external_url \"http://$IP_GITLAB\"" >> /etc/gitlab/gitlab.rb
57 79
58 -  
59 -# Habilitar sign_up  
60 -sudo echo "gitlab_rails['gitlab_signup_enabled'] = \"true\"" >> /etc/gitlab/gitlab.rb  
61 -  
62 # Adicionar integracao com redmine 80 # Adicionar integracao com redmine
63 sudo echo "gitlab_rails['issues_tracker_redmine'] = 'redmine'" >> /etc/gitlab/gitlab.rb 81 sudo echo "gitlab_rails['issues_tracker_redmine'] = 'redmine'" >> /etc/gitlab/gitlab.rb
64 sudo echo "gitlab_rails['issues_tracker_redmine_title'] = 'Redmine'" >> /etc/gitlab/gitlab.rb 82 sudo echo "gitlab_rails['issues_tracker_redmine_title'] = 'Redmine'" >> /etc/gitlab/gitlab.rb
@@ -75,7 +93,25 @@ sudo lokkit -s http -s ssh @@ -75,7 +93,25 @@ sudo lokkit -s http -s ssh
75 # -s 192.168.0.0/24 93 # -s 192.168.0.0/24
76 #sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT 94 #sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
77 95
78 -# Roda a configuracao do gitlab 96 +echo "configurando ldap"
  97 +
  98 +localhost=$IP_LDAP
  99 +base="dc=colab,dc=com"
  100 +port="389"
  101 +bind_dn="cn=admin,$base"
  102 +password=$PASSWORD_LDAP
  103 +
  104 +echo "gitlab_rails['ldap_enabled'] = true" >> /etc/gitlab/gitlab.rb
  105 +echo "gitlab_rails['ldap_host'] = '$localhost' " >> /etc/gitlab/gitlab.rb
  106 +echo "gitlab_rails['ldap_port'] = $port" >> /etc/gitlab/gitlab.rb
  107 +echo "gitlab_rails['ldap_base'] = '$base'" >> /etc/gitlab/gitlab.rb
  108 +echo "gitlab_rails['ldap_uid'] = 'uid'" >> /etc/gitlab/gitlab.rb
  109 +echo "gitlab_rails['ldap_method'] = 'plain'" >> /etc/gitlab/gitlab.rb
  110 +echo "gitlab_rails['ldap_bind_dn'] = '$bind_dn'" >> /etc/gitlab/gitlab.rb
  111 +echo "gitlab_rails['ldap_password'] = '$password'" >> /etc/gitlab/gitlab.rb
  112 +echo "gitlab_rails['ldap_allow_username_or_email_login'] = true" >> /etc/gitlab/gitlab.rb
  113 +
  114 +
79 echo "Iniciando gitlab" 115 echo "Iniciando gitlab"
80 sudo gitlab-ctl reconfigure 116 sudo gitlab-ctl reconfigure
81 sudo gitlab-ctl restart 117 sudo gitlab-ctl restart
script/instalacaoLdap.sh
1 #!/bin/sh 1 #!/bin/sh
2 2
3 -DC="dc=sei,dc=com"  
4 -PASSWORD="cfl5OcVJ" 3 +DC="dc=scom,dc=com"
  4 +PASSWORD= "12345" # "cfl5OcVJ"
5 5
6 sudo yum install openldap-servers openldap-clients sssd perl-LDAP.noarch -y 6 sudo yum install openldap-servers openldap-clients sssd perl-LDAP.noarch -y
7 7