0
respostas

[Bug] erro no Gathering Facts usando ansible "msg": "Failed to connect to the host via ssh: sign_and_send_pubkey: no mutual signature supported

Insira aqui a descrição dessa imagem para ajudar na acessibilidademeu hosts

[database] 192.168.56.42 ansible_user=vagrant ansible_ssh_private_key_file="/home/vinicius/programação/ansible/ansible--com-wordpress/.vagrant/machines/mysql/virtualbox/private_key"

[wordpress] 192.168.56.40 ansible_user=vagrant ansible_ssh_private_key_file="/home/vinicius/programação/ansible/ansible--com-wordpress/.vagrant/machines/wordpress/virtualbox/private_key"

vagrant file

Vagrant.configure("2") do |config|

config.vm.box = "ubuntu/trusty64"

config.vm.provider "virtualbox" do |vb|
    vb.memory = 1024
end

config.vm.define "wordpress" do |m|
    m.vm.network "private_network", ip: "192.168.56.40"

    m.vm.provision "shell",
        inline: "cp /vagrant/configs/id_vagrant.pub ." && \
                "cat /vagrant/configs/id_vagrant.pub > .ssh/authorized_keys"
end

config.vm.define "mysql" do |m|
    m.vm.network "private_network", ip: "192.168.56.42"

    m.vm.provision "shell",
        inline: "cp /vagrant/configs/id_vagrant.pub ." && \
                "cat /vagrant/configs/id_vagrant.pub > .ssh/authorized_keys"
end

end

provisioning.yml


  • hosts: database tasks:

    • name: "Instalando dependencias do sistema operacional" apt: name: "{{ item }}" state: latest become: yes with_items:

      • mysql-server-5.6
      • python-mysqldb
    • name: 'Cria o banco do MySQL' mysql_db: name: wordpress_db login_user: root state: present

    • name: "Criando usuário no mysql" mysql_user: login_user: root name: wordpress_user password: 12345 #nome da database a ser criado o user e possui senha e recebe todos os privilegios priv: 'wordpress_db.*:ALL' state: present

  • hosts: wordpress handlers:

    • name: restart apache service: name: apache2 state: restarted become: yes
tasks:
  - name: "Instalando dependencias do sistema operacional"
    apt:
      name: "{{ item }}"
      state: latest
    become: yes
    with_items:
    - php5
    - apache2
    - libapache2-mod-php5
    - php5-gd
    - libssh2-php
    - php5-mcrypt

    - php5-mysql

  - name: 'Download wordpress'
    get_url:
      url: https://br.wordpress.org/latest-pt_BR.tar.gz
      dest: '/tmp/wordpress.tar.gz'

  - name: 'Descompacta wordpress latest'
    unarchive:
      src: '/tmp/wordpress.tar.gz'
      dest: /var/www/
      remote_src: yes
    become: yes

  - copy:
      src: '/var/www/wordpress/wp-config-sample.php'
      dest: '/var/www/wordpress/wp-config.php'
      remote_src: yes
    become: yes

  - name: 'Configura o wp-config com as entradas do banco de dados'
    replace:
      path: '/var/www/wordpress/wp-config.php'
      regexp: '{{ item.regex }}'
      replace: '{{ item.value }}'
    with_items:
      - { regex: 'username_here', value: 'wordpress_user'}
      - { regex: 'database_name_here', value: 'wordpress_db'}
      - { regex: 'password_here', value: '12345'}
    become: yes

  - name: 'Configura Apache para servir o Wordpress'
    copy:
     src: 'files/000-default.conf'
     dest: '/etc/apache2/sites-available/000-default.conf'
    become: yes
    notify:
      - restart apache

""

#You can set the directives that control become at the play or task level.

#set to yes to activate privilege escalation.

#ele é um booleano

#indica se a task será executada com ou sem privilégios administrativos.

#become: yes