Coder Social home page Coder Social logo

Comments (5)

leucos avatar leucos commented on June 4, 2024

This is weird, it looks like multiple apt commands are sent to one host at the same time. I can not reproduce this here (see my output at the end of the comment).
Can you post the output of :

for i in 1 2; do vagrant ssh host$i -c 'ip add'; done

please ?

Also, check the the inventory host file is untouched and is:

[web]
host1.example.org ansible_ssh_host=192.168.33.11 ansible_ssh_user=root
host2.example.org ansible_ssh_host=192.168.33.12 ansible_ssh_user=root

[haproxy]
host0.example.org ansible_ssh_host=192.168.33.10 ansible_ssh_user=root

If it still fails, please send the output of the ansible command with the -vvvv switch. Thanks !

Playbook normal output:

$ ansible-playbook -i step-09/hosts step-09/apache.yml

PLAY [web] ******************************************************************** 

GATHERING FACTS *************************************************************** 
ok: [host2.example.org]
ok: [host1.example.org]

TASK: [Updates apt cache] ***************************************************** 
ok: [host1.example.org]
ok: [host2.example.org]

TASK: [Installs necessary packages] ******************************************* 
changed: [host2.example.org] => (item=apache2,libapache2-mod-php5,git)
changed: [host1.example.org] => (item=apache2,libapache2-mod-php5,git)

TASK: [Push future default virtual host configuration] ************************ 
changed: [host1.example.org]
changed: [host2.example.org]

TASK: [Activates our virtualhost] ********************************************* 
changed: [host1.example.org]
changed: [host2.example.org]

TASK: [Check that our config is valid] **************************************** 
changed: [host2.example.org]
changed: [host1.example.org]

TASK: [Rolling back - Restoring old default virtualhost] ********************** 
skipping: [host1.example.org]
skipping: [host2.example.org]

TASK: [Rolling back - Removing out virtualhost] ******************************* 
skipping: [host1.example.org]
skipping: [host2.example.org]

TASK: [Rolling back - Ending playbook] **************************************** 
skipping: [host1.example.org]
skipping: [host2.example.org]

TASK: [Deploy our awesome application] **************************************** 
changed: [host1.example.org]
changed: [host2.example.org]

TASK: [Deactivates the default virtualhost] *********************************** 
changed: [host2.example.org]
changed: [host1.example.org]

TASK: [Deactivates the default ssl virtualhost] ******************************* 
changed: [host2.example.org]
changed: [host1.example.org]

NOTIFIED: [restart apache] **************************************************** 
changed: [host1.example.org]
changed: [host2.example.org]

PLAY RECAP ******************************************************************** 
host1.example.org          : ok=10   changed=8    unreachable=0    failed=0   
host2.example.org          : ok=10   changed=8    unreachable=0    failed=0   

$

from ansible-tuto.

tyjak avatar tyjak commented on June 4, 2024

Output of for i in 1 2; do vagrant ssh host$i -c 'ip add'; done

bash-3.2$ for i in 1 2; do vagrant ssh host$i -c 'ip add'; done
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:12:96:98 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0
    inet6 fe80::a00:27ff:fe12:9698/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:13:af:d1 brd ff:ff:ff:ff:ff:ff
    inet 192.168.33.11/24 brd 192.168.33.255 scope global eth1
    inet6 fe80::a00:27ff:fe13:afd1/64 scope link 
       valid_lft forever preferred_lft forever
Connection to 127.0.0.1 closed.
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:12:96:98 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0
    inet6 fe80::a00:27ff:fe12:9698/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:5f:f5:9c brd ff:ff:ff:ff:ff:ff
    inet 192.168.33.12/24 brd 192.168.33.255 scope global eth1
    inet6 fe80::a00:27ff:fe5f:f59c/64 scope link 
       valid_lft forever preferred_lft forever
Connection to 127.0.0.1 closed.

The inventory host file is untouched :

bash-3.2$ more step-09/hosts 
[web]
host1.example.org ansible_ssh_host=192.168.33.11 ansible_ssh_user=root
host2.example.org ansible_ssh_host=192.168.33.12 ansible_ssh_user=root

[haproxy]
host0.example.org ansible_ssh_host=192.168.33.10 ansible_ssh_user=root

Playbook debug output:

bash-3.2$ ansible-playbook -vvvv -i step-09/hosts step-09/apache.yml

PLAY [web] ******************************************************************** 

GATHERING FACTS *************************************************************** 
<192.168.33.12> ESTABLISH CONNECTION FOR USER: root
<192.168.33.11> ESTABLISH CONNECTION FOR USER: root
<192.168.33.12> REMOTE_MODULE setup
<192.168.33.11> REMOTE_MODULE setup
<192.168.33.12> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/david/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.33.12 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1424642217.98-194073694873483 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1424642217.98-194073694873483 && echo $HOME/.ansible/tmp/ansible-tmp-1424642217.98-194073694873483'
<192.168.33.11> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/david/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.33.11 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1424642217.98-195594244451591 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1424642217.98-195594244451591 && echo $HOME/.ansible/tmp/ansible-tmp-1424642217.98-195594244451591'
<192.168.33.11> PUT /var/folders/4m/lgpt30sn2c9dsbjndjhtgrdm0000gn/T/tmpTrPSuJ TO /root/.ansible/tmp/ansible-tmp-1424642217.98-195594244451591/setup
<192.168.33.11> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/david/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.33.11 /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1424642217.98-195594244451591/setup; rm -rf /root/.ansible/tmp/ansible-tmp-1424642217.98-195594244451591/ >/dev/null 2>&1'
ok: [host1.example.org]
<192.168.33.12> PUT /var/folders/4m/lgpt30sn2c9dsbjndjhtgrdm0000gn/T/tmpEqzRao TO /root/.ansible/tmp/ansible-tmp-1424642217.98-194073694873483/setup
<192.168.33.12> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/david/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.33.12 /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1424642217.98-194073694873483/setup; rm -rf /root/.ansible/tmp/ansible-tmp-1424642217.98-194073694873483/ >/dev/null 2>&1'
ok: [host2.example.org]

TASK: [Updates apt cache] ***************************************************** 
<192.168.33.11> ESTABLISH CONNECTION FOR USER: root
<192.168.33.12> ESTABLISH CONNECTION FOR USER: root
<192.168.33.11> REMOTE_MODULE apt update_cache=true
<192.168.33.12> REMOTE_MODULE apt update_cache=true
<192.168.33.12> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/david/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.33.12 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1424642220.21-197430226987020 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1424642220.21-197430226987020 && echo $HOME/.ansible/tmp/ansible-tmp-1424642220.21-197430226987020'
<192.168.33.11> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/david/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.33.11 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1424642220.21-3436356557493 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1424642220.21-3436356557493 && echo $HOME/.ansible/tmp/ansible-tmp-1424642220.21-3436356557493'
<192.168.33.12> PUT /var/folders/4m/lgpt30sn2c9dsbjndjhtgrdm0000gn/T/tmpKfYtUV TO /root/.ansible/tmp/ansible-tmp-1424642220.21-197430226987020/apt
<192.168.33.11> PUT /var/folders/4m/lgpt30sn2c9dsbjndjhtgrdm0000gn/T/tmpkF7gli TO /root/.ansible/tmp/ansible-tmp-1424642220.21-3436356557493/apt
<192.168.33.11> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/david/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.33.11 /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1424642220.21-3436356557493/apt; rm -rf /root/.ansible/tmp/ansible-tmp-1424642220.21-3436356557493/ >/dev/null 2>&1'
<192.168.33.12> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/david/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.33.12 /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1424642220.21-197430226987020/apt; rm -rf /root/.ansible/tmp/ansible-tmp-1424642220.21-197430226987020/ >/dev/null 2>&1'
failed: [host2.example.org] => {"failed": true}
msg: Failed to lock apt for exclusive operation
ok: [host1.example.org] => {"changed": false}

TASK: [Installs necessary packages] ******************************************* 
<192.168.33.11> ESTABLISH CONNECTION FOR USER: root
<192.168.33.11> REMOTE_MODULE apt pkg=apache2,libapache2-mod-php5,git state=latest
<192.168.33.11> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/david/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.33.11 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1424642232.43-98501557556574 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1424642232.43-98501557556574 && echo $HOME/.ansible/tmp/ansible-tmp-1424642232.43-98501557556574'
<192.168.33.11> PUT /var/folders/4m/lgpt30sn2c9dsbjndjhtgrdm0000gn/T/tmpQWKU67 TO /root/.ansible/tmp/ansible-tmp-1424642232.43-98501557556574/apt
<192.168.33.11> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/david/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.33.11 /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1424642232.43-98501557556574/apt; rm -rf /root/.ansible/tmp/ansible-tmp-1424642232.43-98501557556574/ >/dev/null 2>&1'
ok: [host1.example.org] => (item=apache2,libapache2-mod-php5,git) => {"changed": false, "item": "apache2,libapache2-mod-php5,git"}

TASK: [Push future default virtual host configuration] ************************ 
<192.168.33.11> ESTABLISH CONNECTION FOR USER: root
<192.168.33.11> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/david/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.33.11 /bin/sh -c 'rc=flag; [ -r "/etc/apache2/sites-available/awesome-app" ] || rc=2; [ -f "/etc/apache2/sites-available/awesome-app" ] || rc=1; [ -d "/etc/apache2/sites-available/awesome-app" ] && rc=3; python -V 2>/dev/null || rc=4; [ x"$rc" != "xflag" ] && echo "${rc} /etc/apache2/sites-available/awesome-app" && exit 0; (python -c '"'"'import hashlib; print(hashlib.sha1(open("/etc/apache2/sites-available/awesome-app", "rb").read()).hexdigest())'"'"' 2>/dev/null) || (python -c '"'"'import sha; print(sha.sha(open("/etc/apache2/sites-available/awesome-app", "rb").read()).hexdigest())'"'"' 2>/dev/null) || (echo "0 /etc/apache2/sites-available/awesome-app")'
<192.168.33.11> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/david/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.33.11 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1424642233.52-216457976355478 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1424642233.52-216457976355478 && echo $HOME/.ansible/tmp/ansible-tmp-1424642233.52-216457976355478'
<192.168.33.11> PUT /var/folders/4m/lgpt30sn2c9dsbjndjhtgrdm0000gn/T/tmp4F6vuY TO /root/.ansible/tmp/ansible-tmp-1424642233.52-216457976355478/file
<192.168.33.11> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/david/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.33.11 /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1424642233.52-216457976355478/file; rm -rf /root/.ansible/tmp/ansible-tmp-1424642233.52-216457976355478/ >/dev/null 2>&1'
ok: [host1.example.org] => {"changed": false, "checksum": "197c00c53cbd6dc14b9210a2d987de798f80b955", "dest": "/etc/apache2/sites-available/awesome-app", "gid": 0, "group": "root", "mode": "0640", "owner": "root", "path": "/etc/apache2/sites-available/awesome-app", "size": 172, "state": "file", "uid": 0}

TASK: [Activates our virtualhost] ********************************************* 
<192.168.33.11> ESTABLISH CONNECTION FOR USER: root
<192.168.33.11> REMOTE_MODULE command a2ensite awesome-app
<192.168.33.11> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/david/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.33.11 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1424642233.69-201046592756361 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1424642233.69-201046592756361 && echo $HOME/.ansible/tmp/ansible-tmp-1424642233.69-201046592756361'
<192.168.33.11> PUT /var/folders/4m/lgpt30sn2c9dsbjndjhtgrdm0000gn/T/tmpvLuO6T TO /root/.ansible/tmp/ansible-tmp-1424642233.69-201046592756361/command
<192.168.33.11> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/david/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.33.11 /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1424642233.69-201046592756361/command; rm -rf /root/.ansible/tmp/ansible-tmp-1424642233.69-201046592756361/ >/dev/null 2>&1'
changed: [host1.example.org] => {"changed": true, "cmd": ["a2ensite", "awesome-app"], "delta": "0:00:00.147015", "end": "2015-02-22 21:57:13.978445", "rc": 0, "start": "2015-02-22 21:57:13.831430", "stderr": "", "stdout": "Site awesome-app already enabled", "warnings": []}

TASK: [Check that our config is valid] **************************************** 
<192.168.33.11> ESTABLISH CONNECTION FOR USER: root
<192.168.33.11> REMOTE_MODULE command apache2ctl configtest
<192.168.33.11> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/david/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.33.11 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1424642234.01-33062625259739 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1424642234.01-33062625259739 && echo $HOME/.ansible/tmp/ansible-tmp-1424642234.01-33062625259739'
<192.168.33.11> PUT /var/folders/4m/lgpt30sn2c9dsbjndjhtgrdm0000gn/T/tmp2ruIPt TO /root/.ansible/tmp/ansible-tmp-1424642234.01-33062625259739/command
<192.168.33.11> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/david/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.33.11 /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1424642234.01-33062625259739/command; rm -rf /root/.ansible/tmp/ansible-tmp-1424642234.01-33062625259739/ >/dev/null 2>&1'
changed: [host1.example.org] => {"changed": true, "cmd": ["apache2ctl", "configtest"], "delta": "0:00:00.120034", "end": "2015-02-22 21:57:14.251982", "rc": 0, "start": "2015-02-22 21:57:14.131948", "stderr": "Syntax OK", "stdout": "", "warnings": []}

TASK: [Rolling back - Restoring old default virtualhost] ********************** 
skipping: [host1.example.org]

TASK: [Rolling back - Removing out virtualhost] ******************************* 
skipping: [host1.example.org]

TASK: [Rolling back - Ending playbook] **************************************** 
skipping: [host1.example.org]

TASK: [Deploy our awesome application] **************************************** 
<192.168.33.11> ESTABLISH CONNECTION FOR USER: root
<192.168.33.11> REMOTE_MODULE git repo=https://github.com/leucos/ansible-tuto-demosite.git dest=/var/www/awesome-app
<192.168.33.11> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/david/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.33.11 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1424642234.34-84764469425999 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1424642234.34-84764469425999 && echo $HOME/.ansible/tmp/ansible-tmp-1424642234.34-84764469425999'
<192.168.33.11> PUT /var/folders/4m/lgpt30sn2c9dsbjndjhtgrdm0000gn/T/tmpAeckHi TO /root/.ansible/tmp/ansible-tmp-1424642234.34-84764469425999/git
<192.168.33.11> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/david/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.33.11 /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1424642234.34-84764469425999/git; rm -rf /root/.ansible/tmp/ansible-tmp-1424642234.34-84764469425999/ >/dev/null 2>&1'
ok: [host1.example.org] => {"after": "5ad93ede38c87a4e49684a4776a7aee73007976a", "before": "5ad93ede38c87a4e49684a4776a7aee73007976a", "changed": false}

TASK: [Deactivates the default virtualhost] *********************************** 
<192.168.33.11> ESTABLISH CONNECTION FOR USER: root
<192.168.33.11> REMOTE_MODULE command a2dissite default
<192.168.33.11> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/david/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.33.11 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1424642236.38-21089251146669 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1424642236.38-21089251146669 && echo $HOME/.ansible/tmp/ansible-tmp-1424642236.38-21089251146669'
<192.168.33.11> PUT /var/folders/4m/lgpt30sn2c9dsbjndjhtgrdm0000gn/T/tmpG9NOAt TO /root/.ansible/tmp/ansible-tmp-1424642236.38-21089251146669/command
<192.168.33.11> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/david/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.33.11 /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1424642236.38-21089251146669/command; rm -rf /root/.ansible/tmp/ansible-tmp-1424642236.38-21089251146669/ >/dev/null 2>&1'
changed: [host1.example.org] => {"changed": true, "cmd": ["a2dissite", "default"], "delta": "0:00:00.031660", "end": "2015-02-22 21:57:16.532117", "rc": 0, "start": "2015-02-22 21:57:16.500457", "stderr": "", "stdout": "Site default already disabled", "warnings": []}

TASK: [Deactivates the default ssl virtualhost] ******************************* 
<192.168.33.11> ESTABLISH CONNECTION FOR USER: root
<192.168.33.11> REMOTE_MODULE command a2dissite default-ssl
<192.168.33.11> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/david/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.33.11 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1424642236.57-50378710680410 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1424642236.57-50378710680410 && echo $HOME/.ansible/tmp/ansible-tmp-1424642236.57-50378710680410'
<192.168.33.11> PUT /var/folders/4m/lgpt30sn2c9dsbjndjhtgrdm0000gn/T/tmpk5nhVA TO /root/.ansible/tmp/ansible-tmp-1424642236.57-50378710680410/command
<192.168.33.11> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/david/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.33.11 /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1424642236.57-50378710680410/command; rm -rf /root/.ansible/tmp/ansible-tmp-1424642236.57-50378710680410/ >/dev/null 2>&1'
changed: [host1.example.org] => {"changed": true, "cmd": ["a2dissite", "default-ssl"], "delta": "0:00:00.031857", "end": "2015-02-22 21:57:16.719693", "rc": 0, "start": "2015-02-22 21:57:16.687836", "stderr": "", "stdout": "Site default-ssl already disabled", "warnings": []}

NOTIFIED: [restart apache] **************************************************** 
<192.168.33.11> ESTABLISH CONNECTION FOR USER: root
<192.168.33.11> REMOTE_MODULE service name=apache2 state=restarted
<192.168.33.11> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/david/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.33.11 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1424642236.76-23547326730213 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1424642236.76-23547326730213 && echo $HOME/.ansible/tmp/ansible-tmp-1424642236.76-23547326730213'
<192.168.33.11> PUT /var/folders/4m/lgpt30sn2c9dsbjndjhtgrdm0000gn/T/tmp5tMZGc TO /root/.ansible/tmp/ansible-tmp-1424642236.76-23547326730213/service
<192.168.33.11> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/david/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 192.168.33.11 /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1424642236.76-23547326730213/service; rm -rf /root/.ansible/tmp/ansible-tmp-1424642236.76-23547326730213/ >/dev/null 2>&1'
changed: [host1.example.org] => {"changed": true, "name": "apache2", "state": "started"}

PLAY RECAP ******************************************************************** 
           to retry, use: --limit @/Users/david/apache.retry

host1.example.org          : ok=10   changed=5    unreachable=0    failed=0   
host2.example.org          : ok=1    changed=0    unreachable=0    failed=1   

Thanks for your help !

from ansible-tuto.

leucos avatar leucos commented on June 4, 2024

Ok. Could you check if you have a lingering apt process running on host2 ?

vagrant ssh host2 -c 'ps auwx | grep apt'

You can also check which process holds the lock if it's still running:

vagrant ssh host2 -c 'sudo lsof /var/lib/dpkg/lock'

If not process holds the lock, just:

vagrant ssh host2 -c 'sudo rm /var/lib/apt/lists/lock /var/cache/apt/archives/lock'

and then try again the playbook.

If it still fails, just wipe out your virtual machines and restart from scratch:

# ensure you are in the top level directory for the tutorial, then
vagrant destroy -f
ansible-playbook -c paramiko -i step-00/hosts step-00/setup.yml --ask-pass --sudo
ansible-playbook -i step-09/hosts step-09/apache.yml

and see how it goes.

Good luck !

from ansible-tuto.

tyjak avatar tyjak commented on June 4, 2024

Ok, I restarted from scratch, and same error... and... shame on me : the pb was in my ~/.ssh/config :

For testing purpose, I wanted to force the use of id_dsa instead of id_rsa (I have the two keys).
But I made a bad copy/paste in my ~/.ssh/config : same ip for all different hostname...
I don't know what really happened with these conf...

Host    192.168.33.10
    Hostname    192.168.33.10
    IdentityFile ~/.ssh/id_dsa
    IdentitiesOnly yes
Host    192.168.33.11
    Hostname    192.168.33.10
    IdentityFile ~/.ssh/id_dsa
    IdentitiesOnly yes
Host    192.168.33.12
    Hostname    192.168.33.10
    IdentityFile ~/.ssh/id_dsa
    IdentitiesOnly yes

ansible-playbook -i step-09/hosts step-09/apache.ymlworks like a charm now !

Thank you for your help !

from ansible-tuto.

leucos avatar leucos commented on June 4, 2024

Glad to hear that ! Good luck with the rest of the tutorial !

from ansible-tuto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.