>_Ansible – Playbook phpMyAdmin para CentOS e Debian

ansible

Adotando o modelo de infraestrutura como código, segue o primeiro tutorial ou playbook da instalação e configuração do phpMyAdmin para CentOS e Debian.
Obs: Para executar este tutorial, recomendo que tenha no mínimo o conhecimento básico do Ansible.

Passo 1 – Instalação do Ansible.

# pip install ansible

Caso não possua o pip instalado, leia o tutorial abaixo:
http://tutoriaisgnulinux.com/?p=15170

Passo 2 – Criação do diretório do Ansible (/etc/ansible). Toda a estrutura dos playbooks, e dos módulos deverão estar dentro do diretório /etc/ansible.

# mkdir -p /etc/ansible/

Passo 3 – Download do módulo Blockinfile. O playbook ansible-phpmyadmin depende desse módulo para ser executado.
https://github.com/yaegashi/ansible-role-blockinfile

# cd /etc/ansible/
# ansible-galaxy install yaegashi.blockinfile
- downloading role 'blockinfile', owned by yaegashi
- downloading role from https://github.com/yaegashi/ansible-role-blockinfile/archive/v0.6.tar.gz
- extracting yaegashi.blockinfile to /etc/ansible/roles/yaegashi.blockinfile

Passo 4 – Download do pacote ansible-phpmyadmin

# wget https://github.com/vandocouto/ansible-phpmyadmin/archive/master.zip

Passo 5 – Extração do pacote master.zip (ansible-phpmyadmin).

# unzip master.zip 
Archive:  master.zip
3c7e0fe6d52245c7bcbd915b41507c812e93d87d
   creating: ansible-phpmyadmin-master/
  inflating: ansible-phpmyadmin-master/README.md  
 extracting: ansible-phpmyadmin-master/hosts  
   creating: ansible-phpmyadmin-master/phpmyadmin/
  inflating: ansible-phpmyadmin-master/phpmyadmin/README.md  
   creating: ansible-phpmyadmin-master/phpmyadmin/defaults/
 extracting: ansible-phpmyadmin-master/phpmyadmin/defaults/main.yml  
   creating: ansible-phpmyadmin-master/phpmyadmin/handlers/
  inflating: ansible-phpmyadmin-master/phpmyadmin/handlers/main.yml  
   creating: ansible-phpmyadmin-master/phpmyadmin/meta/
  inflating: ansible-phpmyadmin-master/phpmyadmin/meta/main.yml  
   creating: ansible-phpmyadmin-master/phpmyadmin/tasks/
  inflating: ansible-phpmyadmin-master/phpmyadmin/tasks/centos.yml  
  inflating: ansible-phpmyadmin-master/phpmyadmin/tasks/debian.yml  
  inflating: ansible-phpmyadmin-master/phpmyadmin/tasks/main.yml  
  inflating: ansible-phpmyadmin-master/phpmyadmin/tasks/mysql.yml  
   creating: ansible-phpmyadmin-master/phpmyadmin/templates/
  inflating: ansible-phpmyadmin-master/phpmyadmin/templates/phpMyAdmin.conf-temp  
   creating: ansible-phpmyadmin-master/phpmyadmin/vars/
  inflating: ansible-phpmyadmin-master/phpmyadmin/vars/main.yml  
  inflating: ansible-phpmyadmin-master/site.yml  
    linking: ansible-phpmyadmin-master/variavies  -> phpmyadmin/vars/main.yml 
finishing deferred symbolic links:
  ansible-phpmyadmin-master/variavies -> phpmyadmin/vars/main.yml

Passo 6 – Acessando o diretório do playbook ansible-phpmyadmin.

# cd ansible-phpmyadmin-master/

Passo 7 – Ajustando o arquivo hosts (inventory). Arquivo responsável por informar em quais instâncias/clouds serão executado o playbook ansible-phpmyadmin.
Obs: Não esqueça de fazer a troca das chaves entre as instâncias/clouds. Caso contrário, será necessário informar a senha do usuário root/super user.

# vim hosts

Obs: Neste caso, estou instalando na mesma instância/cloud (127.0.0.1).

[phpmyadmin]
127.0.0.1

Passo 8 – Ajustando as variáveis.

# vim variavies 
---
# vars file for phpmyadmin
ntp_timezone: Sao_Paulo
# MySQL User root
mysql_user: root
# MySQL Password - para gerar a senha utilize o pwgen.
mysql_password: senha
# FQDN do servidor. (hostname).
hostname_fqdn: note-evandrocouto.tgl.com

Passo 9 – Executando o playbook.

# ansible-playbook -i hosts site.yml

Passo 10 – Por fim, basta acessar o phpMyAdmin para utilizar o MySQL ou o MariaDB.

http://IP/phpmyadmin.
User: root
Senha: mesma que foi definida no arquivo de variáveis.

phpmyadmin-ansible

>_Ansible – Playbook phpMyAdmin para CentOS e Debian
Tagged on:

Deixe uma resposta

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

%d blogueiros gostam disto: