Sto provando a wget un file da un server web all'interno di un playbook Ansible.Ansible e Wget
Ecco il frammento di Ansible:
---
- hosts: all
sudo: true
tasks:
- name: Prepare Install folder
sudo: true
action: shell sudo mkdir -p /tmp/my_install/mysql/ && cd /tmp/my_install/mysql/
- name: Download MySql
sudo: true
action: shell sudo wget http://{{ repo_host }}/MySQL-5.6.15-1.el6.x86_64.rpm-bundle.tar
Invocare tramite:
ansible-playbook my_3rparties.yml -l vsrv644 --extra-vars "repo_host=vsrv656" -K -f 10
non riesce con il seguente:
Cannot write to `MySQL-5.6.15-1.el6.x86_64.rpm-bundle.tar' (Permission denied).
FATAL: all hosts have already failed -- aborting
PLAY RECAP ********************************************************************
to retry, use: --limit @/usr2/ihazan/vufroria_3rparties.retry
vsrv644 : ok=2 changed=1 unreachable=0 failed=1
Quando si cerca di fare il comando che non riescono via normale ssh remoto per imitare quello che farebbe l'ansible, non funziona come segue:
-bash-4.1$ ssh [email protected] 'cd /tmp/my_install/mysql && sudo wget http://vsrv656/MySQL-5.6.15-1.el6.x86_64.rpm-bundle.tar'
Enter passphrase for key '/usr2/ihazan/.ssh/id_rsa':
sudo: sorry, you must have a tty to run sudo
Ma posso risolverlo usando -t come segue:
-bash-4.1$ ssh -t [email protected] 'cd /tmp/my_install/mysql && sudo wget http://vsrv656/MySQL-5.6.15-1.el6.x86_64.rpm-bundle.tar'
allora funziona.
C'è un modo per impostare l'opzione -t (pseudo tty) su ansible?
P.S: Potrei risolverlo modificando il file sudoers come altri propongono, ma questo è un passaggio manuale che sto cercando di evitare.
Thx, questo è stato utile !!! –