Solucionado (ver solução)
Solucionado
(ver solução)
3
respostas

Erro ao rodar o ansible-playbook

Criei o arquivo provisioning.yml e copiei o conteudo corretamente, e inclusive corrigi a identação. No entanto ao rodar o comando ansible-playbook pra executar a instalação do php5 tenho o erro demonstrado.

samir@samir-DC2B-S:~/wordpress$ ansible-playbook provisioning.yml -u vagrant -i hosts --private-key .vagrant/machines/wordpress/virtualbox/private_key

PLAY [all] *************************************************************************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************************************************************
ok: [132.255.99.160]

TASK [apt] *************************************************************************************************************************************************************
fatal: [132.255.99.160]: FAILED! => {"cache_update_time": 1553754367, "cache_updated": false, "changed": false, "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\"     install 'php5'' failed: E: There are problems and -y was used without --force-yes\n", "rc": 100, "stderr": "E: There are problems and -y was used without --force-yes\n", "stderr_lines": ["E: There are problems and -y was used without --force-yes"], "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nThe following extra packages will be installed:\n  apache2 apache2-bin apache2-data libapache2-mod-php5 libapr1 libaprutil1\n  libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0 php5-cli php5-common\n  php5-json php5-readline ssl-cert\nSuggested packages:\n  apache2-doc apache2-suexec-pristine apache2-suexec-custom apache2-utils\n  php-pear php5-user-cache openssl-blacklist\nThe following NEW packages will be installed:\n  apache2 apache2-bin apache2-data libapache2-mod-php5 libapr1 libaprutil1\n  libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0 php5 php5-cli\n  php5-common php5-json php5-readline ssl-cert\n0 upgraded, 15 newly installed, 0 to remove and 17 not upgraded.\nNeed to get 6282 kB of archives.\nAfter this operation, 26.5 MB of additional disk space will be used.\nWARNING: The following packages cannot be authenticated!\n  liblua5.1-0 php5-common php5-cli php5-readline apache2-bin apache2-data\n  apache2 libapache2-mod-php5 php5\n", "stdout_lines": ["Reading package lists...", "Building dependency tree...", "Reading state information...", "The following extra packages will be installed:", "  apache2 apache2-bin apache2-data libapache2-mod-php5 libapr1 libaprutil1", "  libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0 php5-cli php5-common", "  php5-json php5-readline ssl-cert", "Suggested packages:", "  apache2-doc apache2-suexec-pristine apache2-suexec-custom apache2-utils", "  php-pear php5-user-cache openssl-blacklist", "The following NEW packages will be installed:", "  apache2 apache2-bin apache2-data libapache2-mod-php5 libapr1 libaprutil1", "  libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0 php5 php5-cli", "  php5-common php5-json php5-readline ssl-cert", "0 upgraded, 15 newly installed, 0 to remove and 17 not upgraded.", "Need to get 6282 kB of archives.", "After this operation, 26.5 MB of additional disk space will be used.", "WARNING: The following packages cannot be authenticated!", "  liblua5.1-0 php5-common php5-cli php5-readline apache2-bin apache2-data", "  apache2 libapache2-mod-php5 php5"]}
        to retry, use: --limit @/home/samir/wordpress/provisioning.retry

PLAY RECAP *************************************************************************************************************************************************************
132.255.99.160             : ok=1    changed=0    unreachable=0    failed=1
3 respostas

O que descobri até agora é que ao tentar instalar o php5 via apt alguns pacotes não são autenticados e o sistema fica aguardando uma resposta se quer continuar ou não. Nesse caso, como contornar com o ansible?

WARNING: The following packages cannot be authenticated!
  liblua5.1-0 php5-common php5-cli php5-readline apache2-bin apache2-data
  apache2 libapache2-mod-php5 php5
Install these packages without verification? [y/N]

Acredito que a resposta esteja na mensagem de erro: "There are problems and -y was used without --force-yes\n"

O "-y" estava presente, porém falta a o parâmetro "--force-yes".

solução!

No arquivo provisioning.yml junto ao modulo apt adicionei o seguinte parâmetro:

force: yes