willmerae@devlaptop06:~/src/foo$ cat playbook.yml
---
- hosts: all
sudo: true
roles:
- base
willmerae@devlaptop06:~/src/foo$ cat roles/base/tasks/main.yml
---
- name: Replace files
template:
src: "{{item}}"
dest: "/etc/{{item}}"
with_items:
- virc
willmerae@devlaptop06:~/src/foo$ cat roles/base/templates/virc
# {{ ansible_managed }}
# {{ ansible_nodename }}
# {{ ansible_hostname }}
willmerae@devlaptop06:~/src/foo$ cat Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
config.vm.provider "virtualbox"
config.vm.synced_folder '.', '/vagrant', disabled: true
config.vm.synced_folder '.', '/home/vagrant/sync', disabled: true
config.vm.define "foo" do |foo|
foo.vm.hostname = "foo"
foo.vm.network "private_network", ip: "192.168.50.2"
foo.vm.provision "ansible" do |ansible|
ansible.playbook = "playbook.yml"
#ansible.verbose = "vvv"
#ansible.raw_arguments = ["--diff"]
end
end
config.vm.define "bar", primary: true do |bar|
bar.vm.hostname = "bar"
bar.vm.network "private_network", ip: "192.168.50.3"
bar.vm.provision "ansible" do |ansible|
ansible.playbook = "playbook.yml"
#ansible.verbose = "vvv"
#ansible.raw_arguments = ["--diff"]
end
end
end
# Running the above
willmerae@devlaptop06:~/src/foo$ vagrant destroy -f && vagrant up
==> bar: Forcing shutdown of VM...
==> bar: Destroying VM and associated drives...
==> foo: Forcing shutdown of VM...
==> foo: Destroying VM and associated drives...
Bringing machine 'foo' up with 'virtualbox' provider...
Bringing machine 'bar' up with 'virtualbox' provider...
==> foo: Importing base box 'centos/7'...
==> foo: Matching MAC address for NAT networking...
==> foo: Checking if box 'centos/7' is up to date...
==> foo: Setting the name of the VM: foo_foo_1463500848729_41807
==> foo: Fixed port collision for 22 => 2222. Now on port 2201.
==> foo: Clearing any previously set network interfaces...
==> foo: Preparing network interfaces based on configuration...
foo: Adapter 1: nat
foo: Adapter 2: hostonly
==> foo: Forwarding ports...
foo: 22 (guest) => 2201 (host) (adapter 1)
==> foo: Booting VM...
==> foo: Waiting for machine to boot. This may take a few minutes...
foo: SSH username: vagrant
foo: SSH auth method: private key
foo: Warning: Remote connection disconnect. Retrying...
foo:
foo: Vagrant insecure key detected. Vagrant will automatically replace
foo: this with a newly generated keypair for better security.
foo:
foo: Inserting generated public key within guest...
foo: Removing insecure key from the guest if it's present...
foo: Key inserted! Disconnecting and reconnecting using new SSH key...
==> foo: Machine booted and ready!
==> foo: Checking for guest additions in VM...
foo: No guest additions were detected on the base box for this VM! Guest
foo: additions are required for forwarded ports, shared folders, host only
foo: networking, and more. If SSH fails on this machine, please install
foo: the guest additions and repackage the box to continue.
foo:
foo: This is not an error message; everything may continue to work properly,
foo: in which case you may ignore this message.
==> foo: Setting hostname...
==> foo: Configuring and enabling network interfaces...
==> foo: Running provisioner: ansible...
foo: Running ansible-playbook...
[DEPRECATION WARNING]: Instead of sudo/sudo_user, use become/become_user and
make sure become_method is 'sudo' (default).
This feature will be removed in a
future release. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.
PLAY [all] *********************************************************************
TASK [setup] *******************************************************************
ok: [foo]
TASK [base : Replace files] ****************************************************
changed: [foo] => (item=virc)
PLAY RECAP *********************************************************************
foo : ok=2 changed=1 unreachable=0 failed=0
==> bar: Importing base box 'centos/7'...
==> bar: Matching MAC address for NAT networking...
==> bar: Checking if box 'centos/7' is up to date...
==> bar: Setting the name of the VM: foo_bar_1463500889039_73257
==> bar: Fixed port collision for 22 => 2222. Now on port 2202.
==> bar: Clearing any previously set network interfaces...
==> bar: Preparing network interfaces based on configuration...
bar: Adapter 1: nat
bar: Adapter 2: hostonly
==> bar: Forwarding ports...
bar: 22 (guest) => 2202 (host) (adapter 1)
==> bar: Booting VM...
==> bar: Waiting for machine to boot. This may take a few minutes...
bar: SSH username: vagrant
bar: SSH auth method: private key
bar: Warning: Remote connection disconnect. Retrying...
bar:
bar: Vagrant insecure key detected. Vagrant will automatically replace
bar: this with a newly generated keypair for better security.
bar:
bar: Inserting generated public key within guest...
bar: Removing insecure key from the guest if it's present...
bar: Key inserted! Disconnecting and reconnecting using new SSH key...
==> bar: Machine booted and ready!
==> bar: Checking for guest additions in VM...
bar: No guest additions were detected on the base box for this VM! Guest
bar: additions are required for forwarded ports, shared folders, host only
bar: networking, and more. If SSH fails on this machine, please install
bar: the guest additions and repackage the box to continue.
bar:
bar: This is not an error message; everything may continue to work properly,
bar: in which case you may ignore this message.
==> bar: Setting hostname...
==> bar: Configuring and enabling network interfaces...
==> bar: Running provisioner: ansible...
bar: Running ansible-playbook...
[DEPRECATION WARNING]: Instead of sudo/sudo_user, use become/become_user and
make sure become_method is 'sudo' (default).
This feature will be removed in a
future release. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.
PLAY [all] *********************************************************************
TASK [setup] *******************************************************************
ok: [bar]
TASK [base : Replace files] ****************************************************
ok: [bar] => (item=virc)
PLAY RECAP *********************************************************************
bar : ok=2 changed=0 unreachable=0 failed=0
# Checking whether the templated file was applied
willmerae@devlaptop06:~/src/foo$ vagrant ssh foo -- head -3 /etc/virc
# Ansible managed: /home/willmerae/src/foo/roles/base/templates/virc modified on 2016-05-17 16:03:00 by willmerae on devlaptop06
# foo
# foo
willmerae@devlaptop06:~/src/foo$ vagrant ssh bar -- head /etc/virc
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
set fileencodings=ucs-bom,utf-8,latin1
endif
# Repeated run with verbose and raw_arguments uncommented
willmerae@devlaptop06:~/src/foo$ vagrant destroy -f && vagrant up
==> bar: Forcing shutdown of VM...
==> bar: Destroying VM and associated drives...
==> foo: Forcing shutdown of VM...
==> foo: Destroying VM and associated drives...
Bringing machine 'foo' up with 'virtualbox' provider...
Bringing machine 'bar' up with 'virtualbox' provider...
==> foo: Importing base box 'centos/7'...
==> foo: Matching MAC address for NAT networking...
==> foo: Checking if box 'centos/7' is up to date...
==> foo: Setting the name of the VM: foo_foo_1463499426694_45504
==> foo: Fixed port collision for 22 => 2222. Now on port 2201.
==> foo: Clearing any previously set network interfaces...
==> foo: Preparing network interfaces based on configuration...
foo: Adapter 1: nat
foo: Adapter 2: hostonly
==> foo: Forwarding ports...
foo: 22 (guest) => 2201 (host) (adapter 1)
==> foo: Booting VM...
==> foo: Waiting for machine to boot. This may take a few minutes...
foo: SSH username: vagrant
foo: SSH auth method: private key
foo: Warning: Remote connection disconnect. Retrying...
foo:
foo: Vagrant insecure key detected. Vagrant will automatically replace
foo: this with a newly generated keypair for better security.
foo:
foo: Inserting generated public key within guest...
foo: Removing insecure key from the guest if it's present...
foo: Key inserted! Disconnecting and reconnecting using new SSH key...
==> foo: Machine booted and ready!
==> foo: Checking for guest additions in VM...
foo: No guest additions were detected on the base box for this VM! Guest
foo: additions are required for forwarded ports, shared folders, host only
foo: networking, and more. If SSH fails on this machine, please install
foo: the guest additions and repackage the box to continue.
foo:
foo: This is not an error message; everything may continue to work properly,
foo: in which case you may ignore this message.
==> foo: Setting hostname...
==> foo: Configuring and enabling network interfaces...
==> foo: Running provisioner: ansible...
foo: Running ansible-playbook...
PYTHONUNBUFFERED=1 ANSIBLE_FORCE_COLOR=true ANSIBLE_HOST_KEY_CHECKING=false ANSIBLE_SSH_ARGS='-o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s' ansible-playbook --connection=ssh --timeout=30 --limit='foo' --inventory-file=/home/willmerae/src/foo/.vagrant/provisioners/ansible/inventory -vvv --diff playbook.yml
Using /etc/ansible/ansible.cfg as config file
[DEPRECATION WARNING]: Instead of sudo/sudo_user, use become/become_user and
make sure become_method is 'sudo' (default).
This feature will be removed in a
future release. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.
PLAYBOOK: playbook.yml *********************************************************
1 plays in playbook.yml
PLAY [all] *********************************************************************
TASK [setup] *******************************************************************
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: vagrant
<127.0.0.1> SSH: EXEC ssh -C -q -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2201 -o 'IdentityFile="/home/willmerae/src/foo/.vagrant/machines/foo/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/willmerae/.ansible/cp/%h-%r 127.0.0.1 '/bin/sh -c '"'"'( umask 22 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1463499455.71-215186261739215 `" && echo "` echo $HOME/.ansible/tmp/ansible-tmp-1463499455.71-215186261739215 `" )'"'"''
<127.0.0.1> PUT /tmp/tmp7YsyHz TO /home/vagrant/.ansible/tmp/ansible-tmp-1463499455.71-215186261739215/setup
<127.0.0.1> SSH: EXEC sftp -b - -C -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2201 -o 'IdentityFile="/home/willmerae/src/foo/.vagrant/machines/foo/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/willmerae/.ansible/cp/%h-%r '[127.0.0.1]'
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: vagrant
<127.0.0.1> SSH: EXEC ssh -C -q -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2201 -o 'IdentityFile="/home/willmerae/src/foo/.vagrant/machines/foo/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/willmerae/.ansible/cp/%h-%r -tt 127.0.0.1 '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-mcyequqlbpbkbaslouxeqxthrenrdlpv; LANG=en_GB.UTF-8 LC_ALL=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1463499455.71-215186261739215/setup; rm -rf "/home/vagrant/.ansible/tmp/ansible-tmp-1463499455.71-215186261739215/" > /dev/null 2>&1'"'"'"'"'"'"'"'"''"'"''
ok: [foo]
TASK [base : Replace files] ****************************************************
task path: /home/willmerae/src/foo/roles/base/tasks/main.yml:2
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: vagrant
<127.0.0.1> SSH: EXEC ssh -C -q -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2201 -o 'IdentityFile="/home/willmerae/src/foo/.vagrant/machines/foo/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/willmerae/.ansible/cp/%h-%r 127.0.0.1 '/bin/sh -c '"'"'( umask 22 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1463499456.31-246529398489191 `" && echo "` echo $HOME/.ansible/tmp/ansible-tmp-1463499456.31-246529398489191 `" )'"'"''
<127.0.0.1> PUT /tmp/tmpOKDRdY TO /home/vagrant/.ansible/tmp/ansible-tmp-1463499456.31-246529398489191/stat
<127.0.0.1> SSH: EXEC sftp -b - -C -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2201 -o 'IdentityFile="/home/willmerae/src/foo/.vagrant/machines/foo/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/willmerae/.ansible/cp/%h-%r '[127.0.0.1]'
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: vagrant
<127.0.0.1> SSH: EXEC ssh -C -q -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2201 -o 'IdentityFile="/home/willmerae/src/foo/.vagrant/machines/foo/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/willmerae/.ansible/cp/%h-%r -tt 127.0.0.1 '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-cldqbpzzcwrtlnazydrrlidfshckzuul; LANG=en_GB.UTF-8 LC_ALL=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1463499456.31-246529398489191/stat'"'"'"'"'"'"'"'"''"'"''
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: vagrant
<127.0.0.1> SSH: EXEC ssh -C -q -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2201 -o 'IdentityFile="/home/willmerae/src/foo/.vagrant/machines/foo/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/willmerae/.ansible/cp/%h-%r 127.0.0.1 '/bin/sh -c '"'"'( umask 22 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1463499456.51-77751625021439 `" && echo "` echo $HOME/.ansible/tmp/ansible-tmp-1463499456.51-77751625021439 `" )'"'"''
<127.0.0.1> PUT /tmp/tmpl0rf7O TO /home/vagrant/.ansible/tmp/ansible-tmp-1463499456.51-77751625021439/file
<127.0.0.1> SSH: EXEC sftp -b - -C -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2201 -o 'IdentityFile="/home/willmerae/src/foo/.vagrant/machines/foo/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/willmerae/.ansible/cp/%h-%r '[127.0.0.1]'
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: vagrant
<127.0.0.1> SSH: EXEC ssh -C -q -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2201 -o 'IdentityFile="/home/willmerae/src/foo/.vagrant/machines/foo/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/willmerae/.ansible/cp/%h-%r -tt 127.0.0.1 '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-pljenxiegzoipfwamxazzlnzxxiwsedt; LANG=en_GB.UTF-8 LC_ALL=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1463499456.51-77751625021439/file'"'"'"'"'"'"'"'"''"'"''
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: vagrant
<127.0.0.1> SSH: EXEC ssh -C -q -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2201 -o 'IdentityFile="/home/willmerae/src/foo/.vagrant/machines/foo/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/willmerae/.ansible/cp/%h-%r 127.0.0.1 '/bin/sh -c '"'"'( umask 22 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1463499456.7-228281382770228 `" && echo "` echo $HOME/.ansible/tmp/ansible-tmp-1463499456.7-228281382770228 `" )'"'"''
<127.0.0.1> PUT /tmp/tmpPFa1Ko TO /home/vagrant/.ansible/tmp/ansible-tmp-1463499456.7-228281382770228/slurp
<127.0.0.1> SSH: EXEC sftp -b - -C -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2201 -o 'IdentityFile="/home/willmerae/src/foo/.vagrant/machines/foo/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/willmerae/.ansible/cp/%h-%r '[127.0.0.1]'
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: vagrant
<127.0.0.1> SSH: EXEC ssh -C -q -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2201 -o 'IdentityFile="/home/willmerae/src/foo/.vagrant/machines/foo/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/willmerae/.ansible/cp/%h-%r -tt 127.0.0.1 '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-xgmcfpzdoulpntksirupspefnqgsakze; LANG=en_GB.UTF-8 LC_ALL=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1463499456.7-228281382770228/slurp'"'"'"'"'"'"'"'"''"'"''
<127.0.0.1> PUT /tmp/tmpGCR1Ky TO /home/vagrant/.ansible/tmp/ansible-tmp-1463499456.31-246529398489191/source
<127.0.0.1> SSH: EXEC sftp -b - -C -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2201 -o 'IdentityFile="/home/willmerae/src/foo/.vagrant/machines/foo/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/willmerae/.ansible/cp/%h-%r '[127.0.0.1]'
<127.0.0.1> PUT /tmp/tmp67UtVy TO /home/vagrant/.ansible/tmp/ansible-tmp-1463499456.31-246529398489191/copy
<127.0.0.1> SSH: EXEC sftp -b - -C -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2201 -o 'IdentityFile="/home/willmerae/src/foo/.vagrant/machines/foo/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/willmerae/.ansible/cp/%h-%r '[127.0.0.1]'
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: vagrant
<127.0.0.1> SSH: EXEC ssh -C -q -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2201 -o 'IdentityFile="/home/willmerae/src/foo/.vagrant/machines/foo/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/willmerae/.ansible/cp/%h-%r -tt 127.0.0.1 '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-opcgdjvdzoiyikiaafviaunpywodrvya; LANG=en_GB.UTF-8 LC_ALL=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1463499456.31-246529398489191/copy'"'"'"'"'"'"'"'"''"'"''
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: vagrant
<127.0.0.1> SSH: EXEC ssh -C -q -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2201 -o 'IdentityFile="/home/willmerae/src/foo/.vagrant/machines/foo/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/willmerae/.ansible/cp/%h-%r 127.0.0.1 '/bin/sh -c '"'"'rm -f -r /home/vagrant/.ansible/tmp/ansible-tmp-1463499456.31-246529398489191/ > /dev/null 2>&1'"'"''
changed: [foo] => (item=virc) => {"changed": true, "checksum": "fd2cbe2008aaaff0c722bc38638dd46333dfda57", "dest": "/etc/virc", "diff": {"after": "# Ansible managed: /home/willmerae/src/foo/roles/base/templates/virc modified on 2016-05-17 16:03:00 by willmerae on devlaptop06\n# foo\n# foo\n", "after_header": "dynamically generated", "before": "if v:lang =~ \"utf8$\" || v:lang =~ \"UTF-8$\"\n set fileencodings=ucs-bom,utf-8,latin1\nendif\n\nset nocompatible\t\" Use Vim defaults (much better!)\nset bs=indent,eol,start\t\t\" allow backspacing over everything in insert mode\n\"set ai\t\t\t\" always set autoindenting on\n\"set backup\t\t\" keep a backup file\nset viminfo='20,\\\"50\t\" read/write a .viminfo file, don't store more\n\t\t\t\" than 50 lines of registers\nset history=50\t\t\" keep 50 lines of command line history\nset ruler\t\t\" show the cursor position all the time\n\n\" Only do this part when compiled with support for autocommands\nif has(\"autocmd\")\n augroup redhat\n autocmd!\n \" In text files, always limit the width of text to 78 characters\n \" autocmd BufRead *.txt set tw=78\n \" When editing a file, always jump to the last cursor position\n autocmd BufReadPost *\n \\ if line(\"'\\\"\") > 0 && line (\"'\\\"\") <= line(\"$\") |\n \\ exe \"normal! g'\\\"\" |\n \\ endif\n \" don't write swapfile on most commonly used directories for NFS mounts or USB sticks\n autocmd BufNewFile,BufReadPre /media/*,/run/media/*,/mnt/* set directory=~/tmp,/var/tmp,/tmp\n \" start with spec file template\n autocmd BufNewFile *.spec 0r /usr/share/vim/vimfiles/template.spec\n augroup END\nendif\n\nif has(\"cscope\") && filereadable(\"/usr/bin/cscope\")\n set csprg=/usr/bin/cscope\n set csto=0\n set cst\n set nocsverb\n \" add any database in current directory\n if filereadable(\"cscope.out\")\n cs add $PWD/cscope.out\n \" else add database pointed to by environment\n elseif $CSCOPE_DB != \"\"\n cs add $CSCOPE_DB\n endif\n set csverb\nendif\n\n\" Switch syntax highlighting on, when the terminal has colors\n\" Also switch on highlighting the last used search pattern.\nif &t_Co > 2 || has(\"gui_running\")\n syntax on\n set hlsearch\nendif\n\nfiletype plugin on\n\nif &term==\"xterm\"\n set t_Co=8\n set t_Sb=\u001b[4%dm\n set t_Sf=\u001b[3%dm\nendif\n\n\" Don't wake up system with blinking cursor:\n\"
http://www.linuxpowertop.org/known.php\nlet &guicursor = &guicursor . \",a:blinkon0\"\n", "before_header": "/etc/virc"}, "gid": 0, "group": "root", "invocation": {"module_args": {"backup": false, "content": null, "delimiter": null, "dest": "/etc/virc", "directory_mode": null, "follow": true, "force": true, "group": null, "mode": null, "original_basename": "virc", "owner": null, "regexp": null, "remote_src": null, "selevel": null, "serole": null, "setype": null, "seuser": null, "src": "/home/vagrant/.ansible/tmp/ansible-tmp-1463499456.31-246529398489191/source", "validate": null}}, "item": "virc", "md5sum": "e71c801185bdc6c70d90b88b1d46d3d6", "mode": "0644", "owner": "root", "secontext": "system_u:object_r:etc_t:s0", "size": 141, "src": "/home/vagrant/.ansible/tmp/ansible-tmp-1463499456.31-246529398489191/source", "state": "file", "uid": 0}
PLAY RECAP *********************************************************************
foo : ok=2 changed=1 unreachable=0 failed=0
==> bar: Importing base box 'centos/7'...
==> bar: Matching MAC address for NAT networking...
==> bar: Checking if box 'centos/7' is up to date...
==> bar: Setting the name of the VM: foo_bar_1463499466554_70110
==> bar: Fixed port collision for 22 => 2222. Now on port 2202.
==> bar: Clearing any previously set network interfaces...
==> bar: Preparing network interfaces based on configuration...
bar: Adapter 1: nat
bar: Adapter 2: hostonly
==> bar: Forwarding ports...
bar: 22 (guest) => 2202 (host) (adapter 1)
==> bar: Booting VM...
==> bar: Waiting for machine to boot. This may take a few minutes...
bar: SSH username: vagrant
bar: SSH auth method: private key
bar: Warning: Remote connection disconnect. Retrying...
bar:
bar: Vagrant insecure key detected. Vagrant will automatically replace
bar: this with a newly generated keypair for better security.
bar:
bar: Inserting generated public key within guest...
bar: Removing insecure key from the guest if it's present...
bar: Key inserted! Disconnecting and reconnecting using new SSH key...
==> bar: Machine booted and ready!
==> bar: Checking for guest additions in VM...
bar: No guest additions were detected on the base box for this VM! Guest
bar: additions are required for forwarded ports, shared folders, host only
bar: networking, and more. If SSH fails on this machine, please install
bar: the guest additions and repackage the box to continue.
bar:
bar: This is not an error message; everything may continue to work properly,
bar: in which case you may ignore this message.
==> bar: Setting hostname...
==> bar: Configuring and enabling network interfaces...
==> bar: Running provisioner: ansible...
bar: Running ansible-playbook...
PYTHONUNBUFFERED=1 ANSIBLE_FORCE_COLOR=true ANSIBLE_HOST_KEY_CHECKING=false ANSIBLE_SSH_ARGS='-o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s' ansible-playbook --connection=ssh --timeout=30 --limit='bar' --inventory-file=/home/willmerae/src/foo/.vagrant/provisioners/ansible/inventory -vvv --diff playbook.yml
Using /etc/ansible/ansible.cfg as config file
[DEPRECATION WARNING]: Instead of sudo/sudo_user, use become/become_user and
make sure become_method is 'sudo' (default).
This feature will be removed in a
future release. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.
PLAYBOOK: playbook.yml *********************************************************
1 plays in playbook.yml
PLAY [all] *********************************************************************
TASK [setup] *******************************************************************
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: vagrant
<127.0.0.1> SSH: EXEC ssh -C -q -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2202 -o 'IdentityFile="/home/willmerae/src/foo/.vagrant/machines/bar/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/willmerae/.ansible/cp/%h-%r 127.0.0.1 '/bin/sh -c '"'"'( umask 22 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1463499508.9-16172679136687 `" && echo "` echo $HOME/.ansible/tmp/ansible-tmp-1463499508.9-16172679136687 `" )'"'"''
<127.0.0.1> PUT /tmp/tmpnz615D TO /home/vagrant/.ansible/tmp/ansible-tmp-1463499508.9-16172679136687/setup
<127.0.0.1> SSH: EXEC sftp -b - -C -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2202 -o 'IdentityFile="/home/willmerae/src/foo/.vagrant/machines/bar/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/willmerae/.ansible/cp/%h-%r '[127.0.0.1]'
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: vagrant
<127.0.0.1> SSH: EXEC ssh -C -q -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2202 -o 'IdentityFile="/home/willmerae/src/foo/.vagrant/machines/bar/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/willmerae/.ansible/cp/%h-%r -tt 127.0.0.1 '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-anujfhlnvvhzmaamqbgpckkuihskdgyf; LANG=en_GB.UTF-8 LC_ALL=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1463499508.9-16172679136687/setup; rm -rf "/home/vagrant/.ansible/tmp/ansible-tmp-1463499508.9-16172679136687/" > /dev/null 2>&1'"'"'"'"'"'"'"'"''"'"''
ok: [bar]
TASK [base : Replace files] ****************************************************
task path: /home/willmerae/src/foo/roles/base/tasks/main.yml:2
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: vagrant
<127.0.0.1> SSH: EXEC ssh -C -q -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2202 -o 'IdentityFile="/home/willmerae/src/foo/.vagrant/machines/bar/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/willmerae/.ansible/cp/%h-%r 127.0.0.1 '/bin/sh -c '"'"'( umask 22 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1463499509.3-184487313987733 `" && echo "` echo $HOME/.ansible/tmp/ansible-tmp-1463499509.3-184487313987733 `" )'"'"''
<127.0.0.1> PUT /tmp/tmpalK5uJ TO /home/vagrant/.ansible/tmp/ansible-tmp-1463499509.3-184487313987733/stat
<127.0.0.1> SSH: EXEC sftp -b - -C -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2202 -o 'IdentityFile="/home/willmerae/src/foo/.vagrant/machines/bar/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/willmerae/.ansible/cp/%h-%r '[127.0.0.1]'
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: vagrant
<127.0.0.1> SSH: EXEC ssh -C -q -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2202 -o 'IdentityFile="/home/willmerae/src/foo/.vagrant/machines/bar/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/willmerae/.ansible/cp/%h-%r -tt 127.0.0.1 '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-mhsshwufetjopobaqrkufludfotnbekr; LANG=en_GB.UTF-8 LC_ALL=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1463499509.3-184487313987733/stat'"'"'"'"'"'"'"'"''"'"''
<127.0.0.1> PUT /tmp/tmp4JLixD TO /home/vagrant/.ansible/tmp/ansible-tmp-1463499509.3-184487313987733/file
<127.0.0.1> SSH: EXEC sftp -b - -C -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2202 -o 'IdentityFile="/home/willmerae/src/foo/.vagrant/machines/bar/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/willmerae/.ansible/cp/%h-%r '[127.0.0.1]'
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: vagrant
<127.0.0.1> SSH: EXEC ssh -C -q -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2202 -o 'IdentityFile="/home/willmerae/src/foo/.vagrant/machines/bar/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/willmerae/.ansible/cp/%h-%r -tt 127.0.0.1 '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-hgjihjfwpgzrlsgbfyisqexkholudirc; LANG=en_GB.UTF-8 LC_ALL=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1463499509.3-184487313987733/file'"'"'"'"'"'"'"'"''"'"''
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: vagrant
<127.0.0.1> SSH: EXEC ssh -C -q -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2202 -o 'IdentityFile="/home/willmerae/src/foo/.vagrant/machines/bar/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/willmerae/.ansible/cp/%h-%r 127.0.0.1 '/bin/sh -c '"'"'rm -f -r /home/vagrant/.ansible/tmp/ansible-tmp-1463499509.3-184487313987733/ > /dev/null 2>&1'"'"''
ok: [bar] => (item=virc) => {"changed": false, "gid": 0, "group": "root", "invocation": {"module_args": {"backup": null, "content": null, "delimiter": null, "dest": "/etc/virc", "diff_peek": null, "directory_mode": null, "follow": true, "force": false, "group": null, "mode": null, "original_basename": "virc", "owner": null, "path": "/etc/virc", "recurse": false, "regexp": null, "remote_src": null, "selevel": null, "serole": null, "setype": null, "seuser": null, "src": null, "state": null, "validate": null}}, "item": "virc", "mode": "0644", "owner": "root", "path": "/etc/virc", "secontext": "system_u:object_r:etc_t:s0", "size": 141, "state": "file", "uid": 0}
PLAY RECAP *********************************************************************
bar : ok=2 changed=0 unreachable=0 failed=0