Added Ansible structure and Vagrantfile, not functional yet
This commit is contained in:
parent
1276987cf2
commit
d41466e0d4
|
@ -0,0 +1,33 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# Shelfzilla Vagrantfile with Ansible provision
|
||||
|
||||
VAGRANTFILE_API_VERSION = "2"
|
||||
|
||||
BOX_MEM = ENV['BOX_MEM'] || "1024"
|
||||
BOX_CORE = ENV['BOX_CORE'] || "2"
|
||||
BOX_NAME = ENV['BOX_NAME'] || "CentOS6.5"
|
||||
BOX_URI = ENV['BOX_URI'] || "https://github.com/2creatives/vagrant-centos/releases/download/v6.5.3/centos65-x86_64-20140116.box"
|
||||
|
||||
Vagrant.require_version ">= 1.5"
|
||||
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |shelfzilla|
|
||||
shelfzilla.vm.box = BOX_NAME
|
||||
shelfzilla.vm.box_url = BOX_URI
|
||||
shelfzilla.vm.provider "virtualbox" do |v|
|
||||
v.customize ["modifyvm", :id, "--memory", BOX_MEM]
|
||||
v.customize ["modifyvm", :id, "--ioapic", "on"]
|
||||
v.customize ["modifyvm", :id, "--cpus", BOX_CORE]
|
||||
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
|
||||
v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
|
||||
end
|
||||
shelfzilla.vm.network "forwarded_port", guest: 80, host: 8080
|
||||
shelfzilla.vm.network "private_network", ip: "192.168.33.10"
|
||||
shelfzilla.vm.provision "ansible" do |ansible|
|
||||
ansible.playbook = "site.yml"
|
||||
ansible.limit = "vagrant"
|
||||
ansible.inventory_path = "hosts"
|
||||
#ansible.verbose = "vvv"
|
||||
end
|
||||
end
|
|
@ -0,0 +1 @@
|
|||
ntpserver: 192.168.1.1
|
|
@ -0,0 +1,8 @@
|
|||
shelfzilla ansible_ssh_host=198.211.124.169 ansible_ssh_port=22 ansible_ssh_user=root
|
||||
vagrantServer ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222 ansible_ssh_user=vagrant
|
||||
|
||||
[production]
|
||||
shelfzilla
|
||||
|
||||
[vagrant]
|
||||
vagrantServer
|
|
@ -0,0 +1 @@
|
|||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDk7B0r4at0lUVF5D3pXFyGRklExP640xrvKX2bMFmRH1eCbtx1CReVxi41ZtsEWA9vi2ZIWxlTGK0av1eBSZh5HChViKLqcb6OsvFDTq+txb1flEPs+QlHcOVs7urxAkazkwnngRbYUDYjIyK02brOJTV/Tp/83AtrPZt8t5LZJVj2oyOyOp8nUttlRpJDLLk+YLWa3P3CaqEfZs0K5Z0DjrrhMmJbqF/1+1Mg3oOkiaFuJXTbmQErggV0hIiZEX0WHy3yMGTpAyuYx60DRteT0IC1pqP6lE5m8D2gC9oD9NkH8wmMPlU3eP1kI1VHG52mH6rV+0Y7XeDhFH6f7Tad Juanpa@KerberossMBP.local
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
- name: restart ntpd
|
||||
service: name=ntpd state=restarted
|
||||
sudo: yes
|
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
- name: be sure ntp is installed
|
||||
yum: pkg=ntp state=installed
|
||||
sudo: yes
|
||||
|
||||
- name: Install libselinux python
|
||||
yum: pkg=libselinux-python state=installed
|
||||
sudo: yes
|
||||
|
||||
- name: test to see if selinux is running
|
||||
command: /usr/sbin/getenforce
|
||||
register: sestatus
|
||||
|
||||
- name: Selinux Down
|
||||
command: setenforce 0
|
||||
when: sestatus == 'Enforcing'
|
||||
|
||||
- name: be sure ntp is configured
|
||||
template: src=ntp.conf.j2 dest=/etc/ntp.conf
|
||||
notify:
|
||||
- restart ntpd
|
||||
sudo: yes
|
||||
|
||||
- name: be sure ntpd is running and enabled
|
||||
service: name=ntpd state=running enabled=yes
|
||||
sudo: yes
|
|
@ -0,0 +1,10 @@
|
|||
driftfile /var/lib/ntp/drift
|
||||
|
||||
restrict 127.0.0.1
|
||||
restrict -6 ::1
|
||||
|
||||
server {{ ntpserver }}
|
||||
|
||||
includefile /etc/ntp/crypto/pw
|
||||
|
||||
keys /etc/ntp/keys
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
# Variables here are applicable to all host groups
|
||||
|
||||
ntpserver: 192.168.1.2
|
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
-
|
||||
name: Vagrant Task
|
||||
hosts: vagrant
|
||||
roles:
|
||||
- role: common
|
||||
|
||||
-
|
||||
name: Production Task
|
||||
hosts: production
|
||||
roles:
|
||||
- role: common
|
||||
|
Reference in New Issue