Commit 86dad880 authored by Carsten Feuls's avatar Carsten Feuls

CentOS umgebung erweitert

parent bdfb7e67
......@@ -5,7 +5,7 @@
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
N = 3
N = 4
Vagrant.configure("2") do |config|
(1..N).each do |i|
......@@ -25,6 +25,11 @@ Vagrant.configure("2") do |config|
os = "centos/7"
gui = false
memory = "512"
when 4
vmname = "server3"
os = "centos/7"
gui = false
memory = "512"
end
# set auto_update to false, if you do NOT want to check the correct
# additions version when booting this machine
......@@ -36,10 +41,8 @@ Vagrant.configure("2") do |config|
config.vm.define "#{vmname}" do |node|
node.vm.hostname = "#{vmname}"
node.vm.box = "#{os}"
node.vm.synced_folder ".", "/vagrant", disabled: true
if vmname == "deploy"
node.vm.synced_folder "./ansible", "/home/vagrant/ansible", type: "virtualbox"
node.vm.synced_folder "./ansible", "/home/vagrant/ansible"
end
node.vm.network :private_network, ip: "192.168.222.10#{i+1}", netmask: '255.255.255.0'
node.vm.provider "virtualbox" do |vb|
......@@ -49,5 +52,11 @@ Vagrant.configure("2") do |config|
vb.customize ["modifyvm", :id, "--groups", "/ansible-schulung-centos"]
end
end
if i == N
config.vm.provision "ansible" do |ansible|
ansible.limit = "all"
ansible.playbook = "setup/playbook.yml"
end
end
end
end
127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
127.0.1.1 {{ inventory_hostname }} {{ inventory_hostname }}
192.168.222.102 deploy
192.168.222.103 server1
192.168.222.104 server2
192.168.222.105 server3
- hosts: all
become: true
tasks:
- name: /etc/hosts Konfigurieren
template:
src: hosts.j2
dest: /etc/hosts
- name: Erstelle SSH-Key auf deploy
become_user: vagrant
openssh_keypair:
path: /home/vagrant/.ssh/id_rsa
delegate_to: deploy
- name: Lese SSH-key vom deploy ein
slurp:
path: /home/vagrant/.ssh/id_rsa.pub
register: ssh_key
delegate_to: deploy
- name: Kopiere SSH-Key
authorized_key:
user: vagrant
state: present
key: "{{ ssh_key['content'] | b64decode }}"
- name: Pakete Installieren
yum:
name:
- vim
state: present
- hosts: deploy
become: true
tasks:
- name: Epel aktivieren
yum:
name: epel-release
state: present
- name: Pakete Installieren
yum:
name:
- ansible
state: present
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment