117 lines
4.0 KiB
Raw Normal View History

2018-04-12 22:00:51 +02:00
Vagrant centos7 vm met Ansible als provisioner:
2018-04-12 21:58:54 +02:00
ger@ger-xiaomi:~$ cd centos_vagrant/
ger@ger-xiaomi:~/centos_vagrant$ wget
Saving to: 100%[============================================================================================>] 475,10M 2,87MB/s in 2m 17s
ger@ger-xiaomi:~/centos_vagrant$ vagrant box add --name centos7
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'centos7' (v0) for provider:
box: Unpacking necessary files from: file:///home/ger/centos_vagrant/
==> box: Successfully added box 'centos7' (v0) for 'virtualbox'! = "centos7"
ger@ger-xiaomi:~/centos_vagrant$ vi Vagrantfile = "centos7"
ger@ger-xiaomi:~/centos_vagrant$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'centos7'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: centos_vagrant_default_1523562614992_68521
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address:
default: SSH username: vagrant
default: SSH auth method: private key
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default: Guest Additions Version: 4.3.28
default: VirtualBox Version: 5.1
==> default: Mounting shared folders...
default: /vagrant => /home/ger/centos_vagrant
ger@ger-xiaomi:~/centos_vagrant$ vi Vagrantfile
config.vm.provision "ansible" do | ansible|
ansible.playbook = "playbook.yml"
ansible.sudo = true
ger@ger-xiaomi:~/centos_vagrant$ vi playbook.yml
- hosts: all
- yum: pkg=httpd state=installed
ger@ger-xiaomi:~/centos_vagrant$ vagrant provision
==> default: Running provisioner: ansible...
default: Running ansible-playbook...
< PLAY [all] >
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
< TASK [Gathering Facts] >
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
ok: [default]
< TASK [yum] >
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
changed: [default]
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
default : ok=2 changed=1 unreachable=0 failed=0