├── aws-web-demo ├── _config.yml ├── test.yml ├── sample-output-vagrant-destroy ├── static_site.cfg ├── README.md ├── Vagrantfile └── deploy-infraaaaa.yaml ├── virtualbox-ansible-lab └── files │ ├── join-command │ ├── ansible.cfg │ ├── inventory_control │ ├── inventory_nodes │ ├── etc-hosts │ ├── nodes-sshd.sh │ ├── engine-config.sh │ ├── templates │ └── sample-inventory.j2 │ └── sample-inventory ├── gcp-wordpress ├── roles │ └── makarenalabs.wordpress │ │ ├── tests │ │ ├── inventory │ │ └── test.yml │ │ ├── .gitignore │ │ ├── handlers │ │ └── main.yml │ │ ├── molecule │ │ └── default │ │ │ ├── tests │ │ │ ├── __pycache__ │ │ │ │ └── test_default.cpython-37.pyc │ │ │ └── test_default.py │ │ │ ├── playbook.yml │ │ │ ├── molecule.yml │ │ │ ├── INSTALL.rst │ │ │ └── Dockerfile.j2 │ │ ├── tasks │ │ ├── apache.yml │ │ └── nginx.yml │ │ ├── defaults │ │ └── main.yml │ │ ├── meta │ │ └── main.yml │ │ ├── Vagrantfile │ │ ├── templates │ │ ├── apache-vhost.conf.j2 │ │ ├── wp-config.php.j2 │ │ └── nginx-vhost.j2 │ │ ├── .travis.yml │ │ ├── LICENSE │ │ └── README.md ├── var │ └── main.yml ├── sample-output-vagrant-destroy ├── static_site.cfg ├── deploy-wordpress.yaml ├── README.md └── Vagrantfile ├── virtualbox-kubernetes-bible-2E └── files │ ├── join-command │ ├── ansible.cfg │ ├── nodes-sshd.sh │ ├── engine-config.sh │ ├── templates │ └── sample-inventory.j2 │ └── sample-inventory ├── demo-inventory ├── gcp-web-server ├── var │ └── main.yml ├── sample-output-vagrant-destroy ├── static_site.cfg ├── README.md ├── Vagrantfile └── deploy-infra.yaml ├── virtualbox-kubernetes ├── old_ansible.cfg ├── kubernetes-setup │ ├── join-command │ ├── variables.yaml │ ├── 04-disable-swap.yaml │ ├── 01-repo-config.yaml │ ├── 05-install-k8s-tools.yaml │ ├── compute-node-playbook.yml │ ├── 03-configure-packages.yaml │ ├── 02-configure-system.yaml │ └── controlplane-playbook.yml └── Vagrantfile ├── virtualbox-kubespray ├── old_ansible.cfg ├── readme.md ├── node-config.yml ├── Vagrantfile └── Vagrantfile-new ├── playbooks ├── var │ └── main.yml ├── deploy-awx.yml └── deploy-infra.yaml ├── virtualbox-kubernetes-fedora ├── old_ansible.cfg ├── kubernetes-setup │ ├── join-command │ ├── RedHat-prep.yaml │ └── Debian-prep.yaml └── Vagrantfile ├── virtualbox-kubernetes_original ├── old_ansible.cfg ├── kubernetes-setup │ └── join-command └── Vagrantfile ├── virtualbox-wordpress-dev ├── provision │ ├── playbooks │ │ └── templates │ │ │ ├── .gemrc │ │ │ ├── .npmrc │ │ │ ├── .my.cnf │ │ │ ├── composer.json │ │ │ ├── guest-wp-cli-config.yml │ │ │ ├── wp-cli.yml │ │ │ ├── mailcatcher.service │ │ │ ├── .bash_profile │ │ │ ├── extra-wp-config.php │ │ │ ├── multisite-htaccess │ │ │ ├── index.php │ │ │ ├── browse-command.php │ │ │ ├── vccw.sh │ │ │ └── site.conf │ └── playbook.yml ├── ansible.cfg ├── .DS_Store ├── wp-cli.yml ├── README.md ├── wp-cli │ └── browse-command.php ├── LICENSE └── Movefile.yml ├── gcp-awx-server ├── var │ └── main.yml ├── var copy │ └── main.yml ├── README.md └── Vagrantfile ├── gcp-openshift-3 ├── var │ └── main.yml ├── var copy │ └── main.yml ├── README.md ├── Vagrantfile-new ├── Vagrantfile └── deploy-infra.yaml ├── virtualbox-fedora ├── files │ ├── ansible.cfg │ ├── inventory │ └── node-config.sh ├── requirements.yml ├── README.md └── Vagrantfile ├── virtualbox-ubuntu ├── files │ ├── ansible.cfg │ ├── inventory │ └── node-config.sh ├── requirements.yml ├── README.md └── Vagrantfile ├── virtualbox-cp-fedora ├── files │ ├── ansible.cfg │ ├── node-config.sh │ └── inventory ├── README.md └── Vagrantfile ├── virtualbox-cp-ubuntu ├── files │ ├── ansible.cfg │ ├── inventory │ └── node-config.sh ├── requirements.yml ├── README.md └── Vagrantfile ├── virtualbox-pihole-ubuntu ├── files │ ├── ansible.cfg │ ├── inventory │ └── node-config.sh ├── README.md └── Vagrantfile ├── virtualbox-sysadmin-rhel8 ├── files │ ├── ansible.cfg │ ├── engine-config.sh │ ├── inventory │ ├── nodes-sshd.sh │ └── node-config.yaml └── Vagrantfile ├── virtualbox-ansible-lab-special ├── files │ ├── ansible.cfg │ ├── engine-config.sh │ ├── inventory │ └── nodes-sshd.sh ├── requirements.yml └── README.md ├── virtualbox-fedora-workstation ├── files │ ├── ansible.cfg │ ├── inventory │ └── node-config.sh ├── requirements.yml ├── README.md └── Vagrantfile ├── images ├── minikube-vagrant-iac.png └── infrastructureascode_600x300-3.png ├── virtualbox-minikube ├── .gitignore ├── nohup.out ├── start-minikube-proxy.sh ├── test.yaml ├── dashboard-adminuser.yaml ├── Vagrantfile ├── index.html ├── minikube │ └── index.html └── README.md ├── virtualbox-demo ├── nginx-1.15.0.tar.gz ├── Vagrantfile ├── bootstrap.sh └── README.md ├── vb-ee-node ├── files │ ├── nodes-sshd.sh │ ├── sample-inventory │ └── config.yaml ├── readme.md └── Vagrantfile ├── virtualbox-rhel9-aap ├── files │ ├── nodes-sshd.sh │ ├── sample-inventory │ └── config.yaml └── Vagrantfile ├── virtualbox-rhel7-generic ├── files │ ├── nodes-sshd.sh │ ├── sample-inventory │ └── config.yaml └── Vagrantfile ├── virtualbox-rhel8-2024 ├── files │ ├── nodes-sshd.sh │ ├── sample-inventory │ └── config.yaml └── Vagrantfile ├── virtualbox-rhel8-generic ├── files │ ├── nodes-sshd.sh │ ├── sample-inventory │ └── config.yaml └── Vagrantfile ├── virtualbox-rhel8-jboss ├── files │ ├── nodes-sshd.sh │ ├── sample-inventory │ └── config.yaml └── Vagrantfile ├── virtualbox-rhel8-vscode ├── files │ ├── nodes-sshd.sh │ ├── sample-inventory │ └── config.yaml └── Vagrantfile ├── virtualbox-rhel9-aap25 ├── files │ ├── nodes-sshd.sh │ ├── sample-inventory │ └── config.yaml └── Vagrantfile ├── virtualbox-rhel9-generic ├── files │ ├── nodes-sshd.sh │ ├── sample-inventory │ └── config.yaml └── Vagrantfile ├── virtualbox-rhel7-satellite ├── files │ ├── nodes-sshd.sh │ ├── sample-inventory │ └── config.yaml ├── README.md └── Vagrantfile ├── virtualbox-generic-rhel8-for-bau ├── files │ ├── nodes-sshd.sh │ ├── sample-inventory │ └── config.yaml └── Vagrantfile ├── .gitignore ├── gcp-yum-repo-server └── deployment.yml ├── virtualbox-rhel8-kvm ├── README.md ├── Vagrantfile └── files │ └── node-config.yaml ├── virtualbox-rhel8-eap ├── files │ ├── nodes-sshd.sh │ ├── sample-inventory │ └── config.yaml └── Vagrantfile ├── virtualbox-rhel8-aap24 ├── files │ ├── nodes-sshd.sh │ ├── sample-inventory │ └── config.yaml └── Vagrantfile ├── virtualbox-wordpress ├── Vagrantfile └── Vagrantfile copy ├── virtualbox-generic-ubuntu └── Vagrantfile ├── virtualbox-rhel └── Vagrantfile ├── virtualbox-vyos └── Vagrantfile └── virtualbox-windows └── Vagrantfile /aws-web-demo/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /aws-web-demo/test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: test 3 | 4 | -------------------------------------------------------------------------------- /virtualbox-ansible-lab/files/join-command: -------------------------------------------------------------------------------- 1 | Some more details -------------------------------------------------------------------------------- /gcp-wordpress/roles/makarenalabs.wordpress/tests/inventory: -------------------------------------------------------------------------------- 1 | localhost -------------------------------------------------------------------------------- /virtualbox-kubernetes-bible-2E/files/join-command: -------------------------------------------------------------------------------- 1 | Some more details -------------------------------------------------------------------------------- /demo-inventory: -------------------------------------------------------------------------------- 1 | [kubes] 2 | ubuntu-minikube ansible_host=192.168.99.101 3 | -------------------------------------------------------------------------------- /gcp-web-server/var/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ssh_port: 22 3 | http_port: 80 4 | 5 | -------------------------------------------------------------------------------- /gcp-wordpress/var/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ssh_port: 22 3 | http_port: 80 4 | 5 | -------------------------------------------------------------------------------- /virtualbox-kubernetes/old_ansible.cfg: -------------------------------------------------------------------------------- 1 | [ssh_connection] 2 | control_path = /tmp -------------------------------------------------------------------------------- /virtualbox-kubespray/old_ansible.cfg: -------------------------------------------------------------------------------- 1 | [ssh_connection] 2 | control_path = /tmp -------------------------------------------------------------------------------- /playbooks/var/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ssh_port: 22 3 | http_port: 80 4 | https_port: 443 5 | -------------------------------------------------------------------------------- /virtualbox-kubernetes-fedora/old_ansible.cfg: -------------------------------------------------------------------------------- 1 | [ssh_connection] 2 | control_path = /tmp -------------------------------------------------------------------------------- /virtualbox-kubernetes_original/old_ansible.cfg: -------------------------------------------------------------------------------- 1 | [ssh_connection] 2 | control_path = /tmp -------------------------------------------------------------------------------- /virtualbox-wordpress-dev/provision/playbooks/templates/.gemrc: -------------------------------------------------------------------------------- 1 | gem: --user-install 2 | -------------------------------------------------------------------------------- /gcp-awx-server/var/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ssh_port: 22 3 | http_port: 80 4 | https_port: 443 5 | -------------------------------------------------------------------------------- /gcp-openshift-3/var/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ssh_port: 22 3 | http_port: 80 4 | https_port: 443 5 | -------------------------------------------------------------------------------- /gcp-awx-server/var copy/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ssh_port: 22 3 | http_port: 80 4 | https_port: 443 5 | -------------------------------------------------------------------------------- /gcp-openshift-3/var copy/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ssh_port: 22 3 | http_port: 80 4 | https_port: 443 5 | -------------------------------------------------------------------------------- /virtualbox-wordpress-dev/provision/playbooks/templates/.npmrc: -------------------------------------------------------------------------------- 1 | prefix = ${HOME}/.npm-packages 2 | -------------------------------------------------------------------------------- /virtualbox-fedora/files/ansible.cfg: -------------------------------------------------------------------------------- 1 | [defaults] 2 | inventory = ./inventory 3 | host_key_checking = False 4 | -------------------------------------------------------------------------------- /virtualbox-ubuntu/files/ansible.cfg: -------------------------------------------------------------------------------- 1 | [defaults] 2 | inventory = ./inventory 3 | host_key_checking = False 4 | -------------------------------------------------------------------------------- /virtualbox-cp-fedora/files/ansible.cfg: -------------------------------------------------------------------------------- 1 | [defaults] 2 | inventory = ./inventory 3 | host_key_checking = False 4 | -------------------------------------------------------------------------------- /virtualbox-cp-ubuntu/files/ansible.cfg: -------------------------------------------------------------------------------- 1 | [defaults] 2 | inventory = ./inventory 3 | host_key_checking = False 4 | -------------------------------------------------------------------------------- /virtualbox-wordpress-dev/ansible.cfg: -------------------------------------------------------------------------------- 1 | [defaults] 2 | hash_behaviour=merge 3 | remote_tmp=/vagrant/.ansible/tmp 4 | -------------------------------------------------------------------------------- /gcp-wordpress/roles/makarenalabs.wordpress/.gitignore: -------------------------------------------------------------------------------- 1 | .* 2 | *~ 3 | vagrant_* 4 | !.travis.yml 5 | !.gitignore 6 | -------------------------------------------------------------------------------- /virtualbox-pihole-ubuntu/files/ansible.cfg: -------------------------------------------------------------------------------- 1 | [defaults] 2 | inventory = ./inventory 3 | host_key_checking = False 4 | -------------------------------------------------------------------------------- /virtualbox-sysadmin-rhel8/files/ansible.cfg: -------------------------------------------------------------------------------- 1 | [defaults] 2 | inventory = ./inventory 3 | host_key_checking = False 4 | -------------------------------------------------------------------------------- /virtualbox-wordpress-dev/provision/playbooks/templates/.my.cnf: -------------------------------------------------------------------------------- 1 | [client] 2 | user = root 3 | password = wordpress 4 | -------------------------------------------------------------------------------- /virtualbox-ansible-lab-special/files/ansible.cfg: -------------------------------------------------------------------------------- 1 | [defaults] 2 | inventory = ./inventory 3 | host_key_checking = False 4 | -------------------------------------------------------------------------------- /virtualbox-ansible-lab/files/ansible.cfg: -------------------------------------------------------------------------------- 1 | [defaults] 2 | inventory = ./sample-inventory 3 | host_key_checking = False 4 | -------------------------------------------------------------------------------- /virtualbox-fedora-workstation/files/ansible.cfg: -------------------------------------------------------------------------------- 1 | [defaults] 2 | inventory = ./inventory 3 | host_key_checking = False 4 | -------------------------------------------------------------------------------- /images/minikube-vagrant-iac.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamgini/vagrant-iac-usecases/HEAD/images/minikube-vagrant-iac.png -------------------------------------------------------------------------------- /virtualbox-ansible-lab/files/inventory_control: -------------------------------------------------------------------------------- 1 | ansible-lab-control ansible_host=192.168.56.138 ansible_connection=local 2 | -------------------------------------------------------------------------------- /virtualbox-kubernetes-bible-2E/files/ansible.cfg: -------------------------------------------------------------------------------- 1 | [defaults] 2 | inventory = ./sample-inventory 3 | host_key_checking = False 4 | -------------------------------------------------------------------------------- /virtualbox-minikube/.gitignore: -------------------------------------------------------------------------------- 1 | .minikube 2 | .kube 3 | .ansible 4 | .vagrant 5 | bin 6 | .bash_history 7 | .bashrc 8 | .viminfo 9 | -------------------------------------------------------------------------------- /virtualbox-wordpress-dev/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamgini/vagrant-iac-usecases/HEAD/virtualbox-wordpress-dev/.DS_Store -------------------------------------------------------------------------------- /virtualbox-demo/nginx-1.15.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamgini/vagrant-iac-usecases/HEAD/virtualbox-demo/nginx-1.15.0.tar.gz -------------------------------------------------------------------------------- /virtualbox-fedora/requirements.yml: -------------------------------------------------------------------------------- 1 | --- 2 | collections: 3 | # With just the collection name 4 | - community.crypto 5 | - ansible.posix -------------------------------------------------------------------------------- /virtualbox-minikube/nohup.out: -------------------------------------------------------------------------------- 1 | Starting to serve on [::]:8001 2 | Starting to serve on [::]:8001 3 | Starting to serve on [::]:8001 4 | -------------------------------------------------------------------------------- /virtualbox-ubuntu/requirements.yml: -------------------------------------------------------------------------------- 1 | --- 2 | collections: 3 | # With just the collection name 4 | - community.crypto 5 | - ansible.posix -------------------------------------------------------------------------------- /virtualbox-wordpress-dev/provision/playbooks/templates/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "secure-http": false 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /virtualbox-cp-ubuntu/requirements.yml: -------------------------------------------------------------------------------- 1 | --- 2 | collections: 3 | # With just the collection name 4 | - community.crypto 5 | - ansible.posix -------------------------------------------------------------------------------- /virtualbox-wordpress-dev/wp-cli.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - wp-cli/browse-command.php 3 | @vccw.test: 4 | ssh: vagrant:vccw.test:/var/www/html 5 | -------------------------------------------------------------------------------- /images/infrastructureascode_600x300-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamgini/vagrant-iac-usecases/HEAD/images/infrastructureascode_600x300-3.png -------------------------------------------------------------------------------- /virtualbox-ansible-lab/files/inventory_nodes: -------------------------------------------------------------------------------- 1 | ansible-lab-node-1 ansible_host=192.168.56.136 2 | ansible-lab-node-2 ansible_host=192.168.56.137 3 | -------------------------------------------------------------------------------- /virtualbox-minikube/start-minikube-proxy.sh: -------------------------------------------------------------------------------- 1 | sudo kubectl proxy --address='0.0.0.0' –port=8001 --www=/home/vagrant/minikube --www-prefix=/minikube/ -------------------------------------------------------------------------------- /vb-ee-node/files/nodes-sshd.sh: -------------------------------------------------------------------------------- 1 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 2 | sudo systemctl restart sshd -------------------------------------------------------------------------------- /virtualbox-ansible-lab-special/requirements.yml: -------------------------------------------------------------------------------- 1 | --- 2 | collections: 3 | # With just the collection name 4 | - community.crypto 5 | - ansible.posix -------------------------------------------------------------------------------- /virtualbox-ansible-lab/files/etc-hosts: -------------------------------------------------------------------------------- 1 | 192.168.56.136 ansible-lab-node-1 2 | 192.168.56.137 ansible-lab-node-2 3 | 192.168.56.138 ansible-lab-control 4 | -------------------------------------------------------------------------------- /virtualbox-fedora-workstation/requirements.yml: -------------------------------------------------------------------------------- 1 | --- 2 | collections: 3 | # With just the collection name 4 | - community.crypto 5 | - ansible.posix -------------------------------------------------------------------------------- /virtualbox-rhel9-aap/files/nodes-sshd.sh: -------------------------------------------------------------------------------- 1 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 2 | sudo systemctl restart sshd -------------------------------------------------------------------------------- /virtualbox-ansible-lab/files/nodes-sshd.sh: -------------------------------------------------------------------------------- 1 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 2 | sudo systemctl restart sshd -------------------------------------------------------------------------------- /virtualbox-rhel7-generic/files/nodes-sshd.sh: -------------------------------------------------------------------------------- 1 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 2 | sudo systemctl restart sshd -------------------------------------------------------------------------------- /virtualbox-rhel8-2024/files/nodes-sshd.sh: -------------------------------------------------------------------------------- 1 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 2 | sudo systemctl restart sshd -------------------------------------------------------------------------------- /virtualbox-rhel8-generic/files/nodes-sshd.sh: -------------------------------------------------------------------------------- 1 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 2 | sudo systemctl restart sshd -------------------------------------------------------------------------------- /virtualbox-rhel8-jboss/files/nodes-sshd.sh: -------------------------------------------------------------------------------- 1 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 2 | sudo systemctl restart sshd -------------------------------------------------------------------------------- /virtualbox-rhel8-vscode/files/nodes-sshd.sh: -------------------------------------------------------------------------------- 1 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 2 | sudo systemctl restart sshd -------------------------------------------------------------------------------- /virtualbox-rhel9-aap25/files/nodes-sshd.sh: -------------------------------------------------------------------------------- 1 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 2 | sudo systemctl restart sshd -------------------------------------------------------------------------------- /virtualbox-rhel9-generic/files/nodes-sshd.sh: -------------------------------------------------------------------------------- 1 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 2 | sudo systemctl restart sshd -------------------------------------------------------------------------------- /virtualbox-ansible-lab/files/engine-config.sh: -------------------------------------------------------------------------------- 1 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 2 | sudo systemctl restart sshd 3 | -------------------------------------------------------------------------------- /virtualbox-kubernetes-bible-2E/files/nodes-sshd.sh: -------------------------------------------------------------------------------- 1 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 2 | sudo systemctl restart sshd -------------------------------------------------------------------------------- /virtualbox-rhel7-satellite/files/nodes-sshd.sh: -------------------------------------------------------------------------------- 1 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 2 | sudo systemctl restart sshd -------------------------------------------------------------------------------- /virtualbox-generic-rhel8-for-bau/files/nodes-sshd.sh: -------------------------------------------------------------------------------- 1 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 2 | sudo systemctl restart sshd -------------------------------------------------------------------------------- /virtualbox-wordpress-dev/provision/playbooks/templates/guest-wp-cli-config.yml: -------------------------------------------------------------------------------- 1 | path: {{ vccw.document_root }}/{{ vccw.wp_siteurl }} 2 | apache_modules: 3 | - mod_rewrite 4 | -------------------------------------------------------------------------------- /virtualbox-ansible-lab-special/files/engine-config.sh: -------------------------------------------------------------------------------- 1 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 2 | sudo systemctl restart sshd 3 | -------------------------------------------------------------------------------- /virtualbox-kubernetes-bible-2E/files/engine-config.sh: -------------------------------------------------------------------------------- 1 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 2 | sudo systemctl restart sshd 3 | -------------------------------------------------------------------------------- /aws-web-demo/sample-output-vagrant-destroy: -------------------------------------------------------------------------------- 1 | # vagrant destroy 2 | default: Are you sure you want to destroy the 'default' VM? [y/N] y 3 | ==> default: Terminating the instance... 4 | -------------------------------------------------------------------------------- /gcp-web-server/sample-output-vagrant-destroy: -------------------------------------------------------------------------------- 1 | # vagrant destroy 2 | default: Are you sure you want to destroy the 'default' VM? [y/N] y 3 | ==> default: Terminating the instance... 4 | -------------------------------------------------------------------------------- /gcp-wordpress/sample-output-vagrant-destroy: -------------------------------------------------------------------------------- 1 | # vagrant destroy 2 | default: Are you sure you want to destroy the 'default' VM? [y/N] y 3 | ==> default: Terminating the instance... 4 | -------------------------------------------------------------------------------- /virtualbox-wordpress-dev/provision/playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - import_playbook: playbooks/commands.yml 3 | - import_playbook: playbooks/middleware.yml 4 | - import_playbook: playbooks/wordpress.yml 5 | -------------------------------------------------------------------------------- /virtualbox-wordpress-dev/provision/playbooks/templates/wp-cli.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - wp-cli/browse-command.php 3 | @{{ vccw.hostname }}: 4 | ssh: vagrant:{{ vccw.hostname }}:{{ vccw.document_root }} 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #vagrant working directory 2 | */.vagrant 3 | 4 | */.minikube 5 | */.kube 6 | */.ansible 7 | */.vagrant 8 | */bin 9 | */.bash_history 10 | */.bashrc 11 | */.viminfo 12 | 13 | */join-command 14 | -------------------------------------------------------------------------------- /virtualbox-kubernetes/kubernetes-setup/join-command: -------------------------------------------------------------------------------- 1 | kubeadm join 192.168.56.50:6443 --token ar8ufj.7o1cejkk679ez4py --discovery-token-ca-cert-hash sha256:b6cd89bdba67a6c1acb4e28bd3b9dd99502ce0d3f97c14a757266efa1885cad1 -------------------------------------------------------------------------------- /virtualbox-sysadmin-rhel8/files/engine-config.sh: -------------------------------------------------------------------------------- 1 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 2 | sudo systemctl restart sshd 3 | 4 | sudo python3 -m pip install pip --upgrade -------------------------------------------------------------------------------- /virtualbox-kubernetes-fedora/kubernetes-setup/join-command: -------------------------------------------------------------------------------- 1 | kubeadm join 192.168.56.50:6443 --token kekzuw.sedixjv1e91263a1 --discovery-token-ca-cert-hash sha256:28df81351b1d4cfb92031c4a51fe042761fe83c9db21709d347bbf5fa4a566a1 -------------------------------------------------------------------------------- /virtualbox-kubernetes_original/kubernetes-setup/join-command: -------------------------------------------------------------------------------- 1 | kubeadm join 192.168.56.50:6443 --token kekzuw.sedixjv1e91263a1 --discovery-token-ca-cert-hash sha256:28df81351b1d4cfb92031c4a51fe042761fe83c9db21709d347bbf5fa4a566a1 -------------------------------------------------------------------------------- /virtualbox-demo/Vagrantfile: -------------------------------------------------------------------------------- 1 | Vagrant.configure("2") do |config| 2 | config.vm.box = "ubuntu-trusty64" 3 | config.vm.provision :shell, path: "bootstrap.sh" 4 | config.vm.network :forwarded_port, guest: 80, host: 4567 5 | end 6 | -------------------------------------------------------------------------------- /virtualbox-wordpress-dev/provision/playbooks/templates/mailcatcher.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Mailcatcher Service 3 | 4 | [Service] 5 | Type=simple 6 | ExecStart=/usr/local/bin/mailcatcher --foreground --http-ip=0.0.0.0 --no-quit 7 | -------------------------------------------------------------------------------- /gcp-yum-repo-server/deployment.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Yum Repo Server Deployment on CentOS Using Vagrant 3 | hosts: all 4 | tasks: 5 | - name: install and enable epel repo 6 | yum: 7 | name: epel-release 8 | state: installed -------------------------------------------------------------------------------- /virtualbox-pihole-ubuntu/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ```shell 4 | curl -sSL https://install.pi-hole.net | bash 5 | 6 | 7 | # change password 8 | $ pihole -a -p 9 | 10 | # update 11 | pihole -up 12 | 13 | # remove 14 | $ pihole uninstall 15 | ``` -------------------------------------------------------------------------------- /gcp-wordpress/roles/makarenalabs.wordpress/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: restart apache 3 | service: 4 | name: apache2 5 | state: restarted 6 | 7 | - name: restart nginx 8 | service: 9 | name: nginx 10 | state: restarted 11 | -------------------------------------------------------------------------------- /aws-web-demo/static_site.cfg: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80 default_server; 3 | listen [::]:80 default_server; 4 | root /webapp/main-site; 5 | server_name _; 6 | location / { 7 | try_files $uri $uri/ =404; 8 | } 9 | } -------------------------------------------------------------------------------- /gcp-wordpress/static_site.cfg: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80 default_server; 3 | listen [::]:80 default_server; 4 | root /webapp/main-site; 5 | server_name _; 6 | location / { 7 | try_files $uri $uri/ =404; 8 | } 9 | } -------------------------------------------------------------------------------- /gcp-web-server/static_site.cfg: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80 default_server; 3 | listen [::]:80 default_server; 4 | root /webapp/main-site; 5 | server_name _; 6 | location / { 7 | try_files $uri $uri/ =404; 8 | } 9 | } -------------------------------------------------------------------------------- /gcp-wordpress/roles/makarenalabs.wordpress/molecule/default/tests/__pycache__/test_default.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamgini/vagrant-iac-usecases/HEAD/gcp-wordpress/roles/makarenalabs.wordpress/molecule/default/tests/__pycache__/test_default.cpython-37.pyc -------------------------------------------------------------------------------- /virtualbox-kubernetes/kubernetes-setup/variables.yaml: -------------------------------------------------------------------------------- 1 | firewall_ports: 2 | - 6443/tcp 3 | - 2379:2380/tcp 4 | - 10250/tcp 5 | - 10259/tcp 6 | - 10257/tcp 7 | # Opening ports for Calico CNI 8 | - 179/tcp 9 | - 4789/udp 10 | - 4789/tcp 11 | - 2379/tcp -------------------------------------------------------------------------------- /virtualbox-demo/bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cd /vagrant 4 | tar zxvf nginx-1.15.0.tar.gz 5 | cd nginx-1.15.0/ 6 | ll 7 | ./configure --without-http_rewrite_module --without-http_gzip_module 8 | make 9 | sudo make install 10 | sudo /usr/local/nginx/sbin/nginx -------------------------------------------------------------------------------- /virtualbox-kubespray/readme.md: -------------------------------------------------------------------------------- 1 | # kubernetes cluster with Kubespray 2 | Vagrant and Ansible 3 | 4 | # Deploy cluster by execute cluster.yml playbook 5 | 6 | ``` 7 | ansible-playbook -i inventory/mycluster/hosts.yml cluster.yml -b -v \ 8 | --private-key=~/.ssh/private_key 9 | ``` -------------------------------------------------------------------------------- /vb-ee-node/readme.md: -------------------------------------------------------------------------------- 1 | Note: This is a simple Vagrant file to quickly spin-up a RHEL8 virtual machine on Virtualbox. There are no playbook or provisioning done yet but the plan is to add the playbook to automate Ansible Automation Platform deployment. 2 | 3 | See same repoository for other use cases. -------------------------------------------------------------------------------- /virtualbox-kubernetes-fedora/kubernetes-setup/RedHat-prep.yaml: -------------------------------------------------------------------------------- 1 | - name: Install Packages 2 | dnf: 3 | name: 4 | - cri-o 5 | - apt-transport-https 6 | - ca-certificates 7 | - curl 8 | - gnupg-agent 9 | - software-properties-common 10 | state: latest 11 | -------------------------------------------------------------------------------- /virtualbox-rhel8-kvm/README.md: -------------------------------------------------------------------------------- 1 | ```shell 2 | $ sudo dnf install -y cockpit && \ 3 | sudo dnf install -y cockpit-machines && \ 4 | sudo dnf module install -y virt 5 | 6 | $ sudo systemctl start libvirtd 7 | $ sudo systemctl start cockpit 8 | 9 | # now access the cock pit at IP_Address:9090 10 | ``` -------------------------------------------------------------------------------- /virtualbox-rhel8-eap/files/nodes-sshd.sh: -------------------------------------------------------------------------------- 1 | sudo useradd devops 2 | echo -e 'devops\ndevops' | sudo passwd devops 3 | echo 'devops ALL=(ALL) NOPASSWD: ALL' | sudo tee /etc/sudoers.d/devops 4 | 5 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 6 | sudo systemctl restart sshd -------------------------------------------------------------------------------- /virtualbox-rhel7-satellite/README.md: -------------------------------------------------------------------------------- 1 | # Vagrantfile for RHEL7 VM 2 | 3 | Info: This is a very generic RHEL8 VM Vagrantfile and no Satellite related content are stored inside. 4 | 5 | I use this folder for quickly spin-up VM's for deploying Satellite server and hence the configuration will follow the same. 6 | 7 | 8 | -------------------------------------------------------------------------------- /virtualbox-rhel8-aap24/files/nodes-sshd.sh: -------------------------------------------------------------------------------- 1 | sudo useradd devops 2 | echo -e 'devops\ndevops' | sudo passwd devops 3 | echo 'devops ALL=(ALL) NOPASSWD: ALL' | sudo tee /etc/sudoers.d/devops 4 | 5 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 6 | sudo systemctl restart sshd -------------------------------------------------------------------------------- /virtualbox-wordpress-dev/provision/playbooks/templates/.bash_profile: -------------------------------------------------------------------------------- 1 | # 2 | # The .bash_profile for VCCW 3 | # 4 | 5 | export LC_ALL=en_US.UTF-8 6 | export LANG=en_US.UTF-8 7 | 8 | if [ -d "${HOME}/.bash.d" ] ; then 9 | for f in "${HOME}"/.bash.d/*.sh ; do 10 | source "$f" 11 | done 12 | unset f 13 | fi 14 | -------------------------------------------------------------------------------- /virtualbox-wordpress-dev/provision/playbooks/templates/extra-wp-config.php: -------------------------------------------------------------------------------- 1 | define( 'JETPACK_DEV_DEBUG', {{ vccw.wp_debug }} ); 2 | define( 'WP_DEBUG', {{ vccw.wp_debug }} ); 3 | define( 'FORCE_SSL_ADMIN', {{ vccw.force_ssl_admin }} ); 4 | define( 'SAVEQUERIES', {{ vccw.savequeries }} ); 5 | 6 | {{ vccw.extra_wp_config }} 7 | -------------------------------------------------------------------------------- /virtualbox-cp-fedora/files/node-config.sh: -------------------------------------------------------------------------------- 1 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 2 | sudo systemctl restart sshd 3 | 4 | # add devops user 5 | sudo useradd devops 6 | echo -e 'devops\ndevops' | sudo passwd devops 7 | echo 'devops ALL=(ALL) NOPASSWD: ALL' | sudo tee /etc/sudoers.d/devops -------------------------------------------------------------------------------- /virtualbox-minikube/test.yaml: -------------------------------------------------------------------------------- 1 | - hosts: all 2 | become: yes 3 | become_method: sudo 4 | 5 | tasks: 6 | - name: Get Token 7 | shell: "sudo kubectl proxy --address='0.0.0.0' –port=8001 --www=/home/vagrant/minikube --www-prefix=/minikube/" 8 | async: 45 9 | poll: 0 10 | register: get_token 11 | - debug: 12 | msg: "{{ get_token }}" 13 | 14 | -------------------------------------------------------------------------------- /gcp-wordpress/roles/makarenalabs.wordpress/tasks/apache.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Wordpress | Apache | Copy virtual host configuration file 3 | template: 4 | src: apache-vhost.conf.j2 5 | dest: "/etc/apache2/sites-available/{{ wp_sitename }}.conf" 6 | owner: root 7 | group: root 8 | mode: 0644 9 | 10 | - name: WordPress | Apache | Enable site 11 | command: "sudo a2ensite {{ wp_sitename }}.conf" 12 | -------------------------------------------------------------------------------- /virtualbox-fedora/files/inventory: -------------------------------------------------------------------------------- 1 | [ansible] 2 | ansible ansible_host=192.168.100.10 ansible_connection=local 3 | 4 | [nodes] 5 | fedora ansible_host=192.168.100.4 6 | 7 | [all:vars] 8 | ansible_user=devops 9 | #ansible_password=vagrant 10 | ansible_connection=ssh 11 | ansible_ssh_private_key_file= /home/devops/.ssh/id_rsa 12 | ansible_ssh_extra_args= ' -o StrictHostKeyChecking=no -o PreferredAuthentications=password ' 13 | -------------------------------------------------------------------------------- /virtualbox-ubuntu/files/inventory: -------------------------------------------------------------------------------- 1 | [ansible] 2 | ansible ansible_host=192.168.100.10 ansible_connection=local 3 | 4 | [nodes] 5 | node ansible_host=192.168.100.4 6 | 7 | [all:vars] 8 | ansible_user=devops 9 | #ansible_password=vagrant 10 | ansible_connection=ssh 11 | ansible_ssh_private_key_file= /home/devops/.ssh/id_rsa 12 | ansible_ssh_extra_args= ' -o StrictHostKeyChecking=no -o PreferredAuthentications=password ' 13 | -------------------------------------------------------------------------------- /virtualbox-cp-fedora/files/inventory: -------------------------------------------------------------------------------- 1 | [ansible] 2 | ansible ansible_host=192.168.100.10 ansible_connection=local 3 | 4 | [nodes] 5 | fedora ansible_host=192.168.100.4 6 | 7 | [all:vars] 8 | ansible_user=devops 9 | #ansible_password=vagrant 10 | ansible_connection=ssh 11 | ansible_ssh_private_key_file= /home/devops/.ssh/id_rsa 12 | ansible_ssh_extra_args= ' -o StrictHostKeyChecking=no -o PreferredAuthentications=password ' 13 | -------------------------------------------------------------------------------- /virtualbox-cp-ubuntu/files/inventory: -------------------------------------------------------------------------------- 1 | [ansible] 2 | ansible ansible_host=192.168.100.10 ansible_connection=local 3 | 4 | [nodes] 5 | fedora ansible_host=192.168.100.4 6 | 7 | [all:vars] 8 | ansible_user=devops 9 | #ansible_password=vagrant 10 | ansible_connection=ssh 11 | ansible_ssh_private_key_file= /home/devops/.ssh/id_rsa 12 | ansible_ssh_extra_args= ' -o StrictHostKeyChecking=no -o PreferredAuthentications=password ' 13 | -------------------------------------------------------------------------------- /virtualbox-ansible-lab-special/files/inventory: -------------------------------------------------------------------------------- 1 | [ansible] 2 | ansible ansible_host=192.168.100.10 ansible_connection=local 3 | 4 | [nodes] 5 | node ansible_host=192.168.100.4 6 | 7 | [all:vars] 8 | ansible_user=devops 9 | #ansible_password=vagrant 10 | ansible_connection=ssh 11 | ansible_ssh_private_key_file= /home/devops/.ssh/id_rsa 12 | ansible_ssh_extra_args= ' -o StrictHostKeyChecking=no -o PreferredAuthentications=password ' 13 | -------------------------------------------------------------------------------- /virtualbox-pihole-ubuntu/files/inventory: -------------------------------------------------------------------------------- 1 | [ansible] 2 | ansible ansible_host=192.168.100.10 ansible_connection=local 3 | 4 | [nodes] 5 | pihole ansible_host=192.168.100.4 6 | 7 | [all:vars] 8 | ansible_user=devops 9 | #ansible_password=vagrant 10 | ansible_connection=ssh 11 | ansible_ssh_private_key_file= /home/devops/.ssh/id_rsa 12 | ansible_ssh_extra_args= ' -o StrictHostKeyChecking=no -o PreferredAuthentications=password ' 13 | -------------------------------------------------------------------------------- /virtualbox-fedora-workstation/files/inventory: -------------------------------------------------------------------------------- 1 | [ansible] 2 | ansible ansible_host=192.168.100.10 ansible_connection=local 3 | 4 | [nodes] 5 | fedora ansible_host=192.168.100.4 6 | 7 | [all:vars] 8 | ansible_user=devops 9 | #ansible_password=vagrant 10 | ansible_connection=ssh 11 | ansible_ssh_private_key_file= /home/devops/.ssh/id_rsa 12 | ansible_ssh_extra_args= ' -o StrictHostKeyChecking=no -o PreferredAuthentications=password ' 13 | -------------------------------------------------------------------------------- /virtualbox-sysadmin-rhel8/files/inventory: -------------------------------------------------------------------------------- 1 | [ansible] 2 | ansible ansible_host=192.168.100.10 ansible_connection=local 3 | 4 | [nodes] 5 | SYSADMIN-RHEL8 ansible_host=192.168.100.4 6 | 7 | [all:vars] 8 | ansible_user=devops 9 | #ansible_password=vagrant 10 | ansible_connection=ssh 11 | ansible_ssh_private_key_file= /home/devops/.ssh/id_rsa 12 | ansible_ssh_extra_args= ' -o StrictHostKeyChecking=no -o PreferredAuthentications=password ' 13 | -------------------------------------------------------------------------------- /virtualbox-kubernetes/kubernetes-setup/04-disable-swap.yaml: -------------------------------------------------------------------------------- 1 | # Step 2.2: Kubelet will not start if the system has swap enabled, 2 | # so we are disabling swap using the below code. 3 | - name: Remove swapfile from /etc/fstab 4 | mount: 5 | name: "{{ item }}" 6 | fstype: swap 7 | state: absent 8 | with_items: 9 | - swap 10 | - none 11 | - name: Disable swap 12 | command: swapoff -a 13 | when: ansible_swaptotal_mb > 0 -------------------------------------------------------------------------------- /gcp-wordpress/deploy-wordpress.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: all 3 | become: true 4 | vars: 5 | wp_version: 5.0.3 6 | wp_mysql_db: 'wp_database_name' 7 | wp_mysql_user: 'wp_database_user' 8 | wp_mysql_password: 'wp_database_password' 9 | wp_webserver: nginx 10 | wp_sitename: wpexample.com 11 | wp_admin_email: 'your@email.com' 12 | wp_install_dir: "/var/www/{{ wp_sitename }}" 13 | roles: 14 | - makarenalabs.wordpress -------------------------------------------------------------------------------- /gcp-wordpress/roles/makarenalabs.wordpress/tests/test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: all 3 | vars: 4 | wp_version: 5.0.3 5 | wp_mysql_db: 'database_name_here' 6 | wp_mysql_user: 'username_here' 7 | wp_mysql_password: 'password_here' 8 | wp_webserver: nginx 9 | wp_sitename: example.com 10 | wp_admin_email: 'admin@example.com' 11 | wp_install_dir: "/var/www/{{ wp_sitename }}" 12 | roles: 13 | - makarenalabs.wordpress 14 | -------------------------------------------------------------------------------- /gcp-wordpress/roles/makarenalabs.wordpress/molecule/default/playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: all 3 | vars: 4 | wp_version: 5.0.3 5 | wp_mysql_db: 'database_name_here' 6 | wp_mysql_user: 'username_here' 7 | wp_mysql_password: 'password_here' 8 | wp_webserver: nginx 9 | wp_sitename: localhost 10 | wp_admin_email: 'admin@example.com' 11 | wp_install_dir: "/var/www/{{ wp_sitename }}" 12 | roles: 13 | - ansible-role-wordpress 14 | -------------------------------------------------------------------------------- /gcp-wordpress/roles/makarenalabs.wordpress/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | wp_version: 5.0.3 3 | wp_install_dir: '/var/www/html' 4 | wp_db_name: "{{ wp_mysql_db }}" 5 | wp_db_user: "{{ wp_mysql_user }}" 6 | wp_db_password: "{{ wp_mysql_password }}" 7 | wp_db_host: 'localhost' 8 | wp_db_charset: 'utf8' 9 | wp_db_collate: '' 10 | wp_table_prefix: 'wp_' 11 | wp_debug: false 12 | wp_admin_email: 'admin@example.com' 13 | wp_webserver: nginx 14 | site_name: "{{ wp_sitename }}" 15 | -------------------------------------------------------------------------------- /virtualbox-minikube/dashboard-adminuser.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | name: admin-user 5 | namespace: kube-system 6 | 7 | apiVersion: rbac.authorization.k8s.io/v1 8 | kind: ClusterRoleBinding 9 | metadata: 10 | name: admin-user 11 | roleRef: 12 | apiGroup: rbac.authorization.k8s.io 13 | kind: ClusterRole 14 | name: cluster-admin 15 | subjects: 16 | - kind: ServiceAccount 17 | name: admin-user 18 | namespace: kube-system -------------------------------------------------------------------------------- /virtualbox-ansible-lab/files/templates/sample-inventory.j2: -------------------------------------------------------------------------------- 1 | [ansible] 2 | {{hostvars['localhost']['inventory_content_control'] | default('') }} 3 | 4 | [nodes] 5 | {{hostvars['localhost']['inventory_content_nodes'] | default('') }} 6 | 7 | [all:vars] 8 | ansible_user=vagrant 9 | ansible_password=vagrant 10 | ansible_connection=ssh 11 | ansible_ssh_private_key_file= /home/vagrant/.ssh/id_rsa 12 | ansible_ssh_extra_args= ' -o StrictHostKeyChecking=no -o PreferredAuthentications=password ' 13 | -------------------------------------------------------------------------------- /virtualbox-fedora/files/node-config.sh: -------------------------------------------------------------------------------- 1 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 2 | sudo systemctl restart sshd 3 | 4 | sudo python3 -m pip install pip --upgrade 5 | #sudo su - devops && python3 -m pip install ansible --user 6 | 7 | sudo dnf -y install podman vim git 8 | 9 | # add devops user 10 | sudo useradd devops 11 | echo -e 'devops\ndevops' | sudo passwd devops 12 | echo 'devops ALL=(ALL) NOPASSWD: ALL' | sudo tee /etc/sudoers.d/devops -------------------------------------------------------------------------------- /aws-web-demo/README.md: -------------------------------------------------------------------------------- 1 | # Vagrant iac (Infra as a Code) on AWS - Demo 2 | 3 | This is a simple repo to demonstrate how to implement iac using Vagrant on AWS. We have implemented **iac (Infra-As-A-Code)** and CaaC(Configuration-as-code) using Vagrant and Ansible. 4 | 5 | Refer **[READEME](https://github.com/ginigangadharan/vagrant-iac-usecases/blob/master/README.md)** for environment setup 6 | 7 | **See More use cases at [vagrant-iac-use cases](https://github.com/ginigangadharan/vagrant-iac-usecases)** 8 | -------------------------------------------------------------------------------- /virtualbox-cp-ubuntu/files/node-config.sh: -------------------------------------------------------------------------------- 1 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 2 | sudo systemctl restart sshd 3 | 4 | sudo python3 -m pip install pip --upgrade 5 | #sudo su - devops && python3 -m pip install ansible --user 6 | 7 | sudo dnf -y install podman vim git 8 | 9 | # add devops user 10 | sudo useradd devops 11 | echo -e 'devops\ndevops' | sudo passwd devops 12 | echo 'devops ALL=(ALL) NOPASSWD: ALL' | sudo tee /etc/sudoers.d/devops -------------------------------------------------------------------------------- /virtualbox-ubuntu/files/node-config.sh: -------------------------------------------------------------------------------- 1 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 2 | sudo systemctl restart sshd 3 | 4 | sudo python3 -m pip install pip --upgrade 5 | #sudo su - devops && python3 -m pip install ansible --user 6 | 7 | sudo apt -y install runc podman vim git 8 | 9 | # add devops user 10 | sudo useradd devops 11 | echo -e 'devops\ndevops' | sudo passwd devops 12 | echo 'devops ALL=(ALL) NOPASSWD: ALL' | sudo tee /etc/sudoers.d/devops -------------------------------------------------------------------------------- /virtualbox-kubernetes-bible-2E/files/templates/sample-inventory.j2: -------------------------------------------------------------------------------- 1 | [ansible] 2 | {{hostvars['localhost']['inventory_content_control'] | default('') }} 3 | 4 | [nodes] 5 | {{hostvars['localhost']['inventory_content_nodes'] | default('') }} 6 | 7 | [all:vars] 8 | ansible_user=vagrant 9 | ansible_password=vagrant 10 | ansible_connection=ssh 11 | ansible_ssh_private_key_file= /home/vagrant/.ssh/id_rsa 12 | ansible_ssh_extra_args= ' -o StrictHostKeyChecking=no -o PreferredAuthentications=password ' 13 | -------------------------------------------------------------------------------- /virtualbox-fedora-workstation/files/node-config.sh: -------------------------------------------------------------------------------- 1 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 2 | sudo systemctl restart sshd 3 | 4 | sudo python3 -m pip install pip --upgrade 5 | #sudo su - devops && python3 -m pip install ansible --user 6 | 7 | sudo dnf -y install podman vim git 8 | 9 | # add devops user 10 | sudo useradd devops 11 | echo -e 'devops\ndevops' | sudo passwd devops 12 | echo 'devops ALL=(ALL) NOPASSWD: ALL' | sudo tee /etc/sudoers.d/devops -------------------------------------------------------------------------------- /virtualbox-pihole-ubuntu/files/node-config.sh: -------------------------------------------------------------------------------- 1 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 2 | sudo systemctl restart sshd 3 | 4 | sudo python3 -m pip install pip --upgrade 5 | #sudo su - devops && python3 -m pip install ansible --user 6 | 7 | sudo apt -y install runc podman vim git 8 | 9 | # add devops user 10 | sudo useradd devops 11 | echo -e 'devops\ndevops' | sudo passwd devops 12 | echo 'devops ALL=(ALL) NOPASSWD: ALL' | sudo tee /etc/sudoers.d/devops -------------------------------------------------------------------------------- /virtualbox-kubernetes/kubernetes-setup/01-repo-config.yaml: -------------------------------------------------------------------------------- 1 | - name: Add an apt signing key for Docker 2 | apt_key: 3 | url: https://download.docker.com/linux/ubuntu/gpg 4 | state: present 5 | - name: Add apt repository for stable version 6 | apt_repository: 7 | # repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable 8 | repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable 9 | state: present 10 | - name: Update system 11 | shell: sudo apt update -y -------------------------------------------------------------------------------- /virtualbox-wordpress-dev/provision/playbooks/templates/multisite-htaccess: -------------------------------------------------------------------------------- 1 | RewriteEngine On 2 | RewriteBase / 3 | RewriteRule ^index\.php$ - [L] 4 | 5 | # add a trailing slash to /wp-admin 6 | RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] 7 | 8 | RewriteCond %{REQUEST_FILENAME} -f [OR] 9 | RewriteCond %{REQUEST_FILENAME} -d 10 | RewriteRule ^ - [L] 11 | RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] 12 | RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] 13 | RewriteRule . index.php [L] 14 | -------------------------------------------------------------------------------- /gcp-wordpress/roles/makarenalabs.wordpress/molecule/default/molecule.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependency: 3 | name: galaxy 4 | driver: 5 | name: docker 6 | lint: 7 | name: yamllint 8 | platforms: 9 | - name: instance 10 | image: ${MOLECULE_IMAGE-debian:10} 11 | exposed_ports: 12 | - 80/tcp 13 | published_ports: 14 | - 0.0.0.0:8080:80/tcp 15 | provisioner: 16 | name: ansible 17 | lint: 18 | name: ansible-lint 19 | verifier: 20 | name: testinfra 21 | options: 22 | verbose: true 23 | lint: 24 | name: flake8 25 | -------------------------------------------------------------------------------- /virtualbox-wordpress-dev/provision/playbooks/templates/index.php: -------------------------------------------------------------------------------- 1 | = 1.6.5" 3 | 4 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 5 | config.vm.box = "ubuntu/bionic64" 6 | config.vm.hostname = 'test' 7 | 8 | config.vm.network :private_network, ip: "192.168.33.11" 9 | config.vm.network :forwarded_port, guest: 22, host: 2210, id: "ssh" 10 | 11 | config.vm.provision "ansible" do |ansible| 12 | ansible.playbook = "tests/test.yml" 13 | ansible.verbose = 'vv' 14 | ansible.become = true 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /virtualbox-ansible-lab/files/sample-inventory: -------------------------------------------------------------------------------- 1 | [ansible] 2 | ansible-engine ansible_host=192.168.50.11 ansible_connection=local 3 | 4 | [nodes] 5 | node1 ansible_host=192.168.50.21 6 | node2 ansible_host=192.168.50.22 7 | node3 ansible_host=192.168.50.23 8 | node4 ansible_host=192.168.50.24 9 | node5 ansible_host=192.168.50.25 10 | 11 | [all:vars] 12 | ansible_user=vagrant 13 | ansible_password=vagrant 14 | ansible_connection=ssh 15 | ansible_ssh_private_key_file= /home/vagrant/.ssh/id_rsa 16 | ansible_ssh_extra_args= ' -o StrictHostKeyChecking=no -o PreferredAuthentications=password ' -------------------------------------------------------------------------------- /virtualbox-demo/README.md: -------------------------------------------------------------------------------- 1 | # vagrant-virtualbox-iac-demo 2 | Simple vagrant demo with virtualbox 3 | 4 | # Pre-Req 5 | 6 | Refer **[READEME](https://github.com/ginigangadharan/vagrant-iac-usecases/blob/master/README.md)** for environment setup 7 | 8 | **See More use cases at [vagrant-iac-use cases](https://github.com/ginigangadharan/vagrant-iac-usecases)** 9 | 10 | ## Build OpenShift 3.0 Single Node Cluster 11 | - Clone [master repo](https://github.com/ginigangadharan/vagrant-iac-usecases) 12 | - Switch to `gcp-iac-web-server` directory 13 | - Then `vagrant up --provider=google` 14 | -------------------------------------------------------------------------------- /virtualbox-rhel8-2024/files/sample-inventory: -------------------------------------------------------------------------------- 1 | [ansible] 2 | ansible-engine ansible_host=192.168.50.11 ansible_connection=local 3 | 4 | [nodes] 5 | node1 ansible_host=192.168.50.21 6 | node2 ansible_host=192.168.50.22 7 | node3 ansible_host=192.168.50.23 8 | node4 ansible_host=192.168.50.24 9 | node5 ansible_host=192.168.50.25 10 | 11 | [all:vars] 12 | ansible_user=vagrant 13 | ansible_password=vagrant 14 | ansible_connection=ssh 15 | ansible_ssh_private_key_file= /home/vagrant/.ssh/id_rsa 16 | ansible_ssh_extra_args= ' -o StrictHostKeyChecking=no -o PreferredAuthentications=password ' -------------------------------------------------------------------------------- /virtualbox-rhel8-aap24/files/sample-inventory: -------------------------------------------------------------------------------- 1 | [ansible] 2 | ansible-engine ansible_host=192.168.50.11 ansible_connection=local 3 | 4 | [nodes] 5 | node1 ansible_host=192.168.50.21 6 | node2 ansible_host=192.168.50.22 7 | node3 ansible_host=192.168.50.23 8 | node4 ansible_host=192.168.50.24 9 | node5 ansible_host=192.168.50.25 10 | 11 | [all:vars] 12 | ansible_user=vagrant 13 | ansible_password=vagrant 14 | ansible_connection=ssh 15 | ansible_ssh_private_key_file= /home/vagrant/.ssh/id_rsa 16 | ansible_ssh_extra_args= ' -o StrictHostKeyChecking=no -o PreferredAuthentications=password ' -------------------------------------------------------------------------------- /virtualbox-rhel8-eap/files/sample-inventory: -------------------------------------------------------------------------------- 1 | [ansible] 2 | ansible-engine ansible_host=192.168.50.11 ansible_connection=local 3 | 4 | [nodes] 5 | node1 ansible_host=192.168.50.21 6 | node2 ansible_host=192.168.50.22 7 | node3 ansible_host=192.168.50.23 8 | node4 ansible_host=192.168.50.24 9 | node5 ansible_host=192.168.50.25 10 | 11 | [all:vars] 12 | ansible_user=vagrant 13 | ansible_password=vagrant 14 | ansible_connection=ssh 15 | ansible_ssh_private_key_file= /home/vagrant/.ssh/id_rsa 16 | ansible_ssh_extra_args= ' -o StrictHostKeyChecking=no -o PreferredAuthentications=password ' -------------------------------------------------------------------------------- /virtualbox-rhel8-jboss/files/sample-inventory: -------------------------------------------------------------------------------- 1 | [ansible] 2 | ansible-engine ansible_host=192.168.50.11 ansible_connection=local 3 | 4 | [nodes] 5 | node1 ansible_host=192.168.50.21 6 | node2 ansible_host=192.168.50.22 7 | node3 ansible_host=192.168.50.23 8 | node4 ansible_host=192.168.50.24 9 | node5 ansible_host=192.168.50.25 10 | 11 | [all:vars] 12 | ansible_user=vagrant 13 | ansible_password=vagrant 14 | ansible_connection=ssh 15 | ansible_ssh_private_key_file= /home/vagrant/.ssh/id_rsa 16 | ansible_ssh_extra_args= ' -o StrictHostKeyChecking=no -o PreferredAuthentications=password ' -------------------------------------------------------------------------------- /virtualbox-rhel8-vscode/files/sample-inventory: -------------------------------------------------------------------------------- 1 | [ansible] 2 | ansible-engine ansible_host=192.168.50.11 ansible_connection=local 3 | 4 | [nodes] 5 | node1 ansible_host=192.168.50.21 6 | node2 ansible_host=192.168.50.22 7 | node3 ansible_host=192.168.50.23 8 | node4 ansible_host=192.168.50.24 9 | node5 ansible_host=192.168.50.25 10 | 11 | [all:vars] 12 | ansible_user=vagrant 13 | ansible_password=vagrant 14 | ansible_connection=ssh 15 | ansible_ssh_private_key_file= /home/vagrant/.ssh/id_rsa 16 | ansible_ssh_extra_args= ' -o StrictHostKeyChecking=no -o PreferredAuthentications=password ' -------------------------------------------------------------------------------- /virtualbox-rhel9-aap/files/sample-inventory: -------------------------------------------------------------------------------- 1 | [ansible] 2 | ansible-engine ansible_host=192.168.50.11 ansible_connection=local 3 | 4 | [nodes] 5 | node1 ansible_host=192.168.50.21 6 | node2 ansible_host=192.168.50.22 7 | node3 ansible_host=192.168.50.23 8 | node4 ansible_host=192.168.50.24 9 | node5 ansible_host=192.168.50.25 10 | 11 | [all:vars] 12 | ansible_user=vagrant 13 | ansible_password=vagrant 14 | ansible_connection=ssh 15 | ansible_ssh_private_key_file= /home/vagrant/.ssh/id_rsa 16 | ansible_ssh_extra_args= ' -o StrictHostKeyChecking=no -o PreferredAuthentications=password ' -------------------------------------------------------------------------------- /virtualbox-rhel9-aap25/files/sample-inventory: -------------------------------------------------------------------------------- 1 | [ansible] 2 | ansible-engine ansible_host=192.168.50.11 ansible_connection=local 3 | 4 | [nodes] 5 | node1 ansible_host=192.168.50.21 6 | node2 ansible_host=192.168.50.22 7 | node3 ansible_host=192.168.50.23 8 | node4 ansible_host=192.168.50.24 9 | node5 ansible_host=192.168.50.25 10 | 11 | [all:vars] 12 | ansible_user=vagrant 13 | ansible_password=vagrant 14 | ansible_connection=ssh 15 | ansible_ssh_private_key_file= /home/vagrant/.ssh/id_rsa 16 | ansible_ssh_extra_args= ' -o StrictHostKeyChecking=no -o PreferredAuthentications=password ' -------------------------------------------------------------------------------- /virtualbox-rhel7-generic/files/sample-inventory: -------------------------------------------------------------------------------- 1 | [ansible] 2 | ansible-engine ansible_host=192.168.50.11 ansible_connection=local 3 | 4 | [nodes] 5 | node1 ansible_host=192.168.50.21 6 | node2 ansible_host=192.168.50.22 7 | node3 ansible_host=192.168.50.23 8 | node4 ansible_host=192.168.50.24 9 | node5 ansible_host=192.168.50.25 10 | 11 | [all:vars] 12 | ansible_user=vagrant 13 | ansible_password=vagrant 14 | ansible_connection=ssh 15 | ansible_ssh_private_key_file= /home/vagrant/.ssh/id_rsa 16 | ansible_ssh_extra_args= ' -o StrictHostKeyChecking=no -o PreferredAuthentications=password ' -------------------------------------------------------------------------------- /virtualbox-rhel7-satellite/files/sample-inventory: -------------------------------------------------------------------------------- 1 | [ansible] 2 | ansible-engine ansible_host=192.168.50.11 ansible_connection=local 3 | 4 | [nodes] 5 | node1 ansible_host=192.168.50.21 6 | node2 ansible_host=192.168.50.22 7 | node3 ansible_host=192.168.50.23 8 | node4 ansible_host=192.168.50.24 9 | node5 ansible_host=192.168.50.25 10 | 11 | [all:vars] 12 | ansible_user=vagrant 13 | ansible_password=vagrant 14 | ansible_connection=ssh 15 | ansible_ssh_private_key_file= /home/vagrant/.ssh/id_rsa 16 | ansible_ssh_extra_args= ' -o StrictHostKeyChecking=no -o PreferredAuthentications=password ' -------------------------------------------------------------------------------- /virtualbox-rhel8-generic/files/sample-inventory: -------------------------------------------------------------------------------- 1 | [ansible] 2 | ansible-engine ansible_host=192.168.50.11 ansible_connection=local 3 | 4 | [nodes] 5 | node1 ansible_host=192.168.50.21 6 | node2 ansible_host=192.168.50.22 7 | node3 ansible_host=192.168.50.23 8 | node4 ansible_host=192.168.50.24 9 | node5 ansible_host=192.168.50.25 10 | 11 | [all:vars] 12 | ansible_user=vagrant 13 | ansible_password=vagrant 14 | ansible_connection=ssh 15 | ansible_ssh_private_key_file= /home/vagrant/.ssh/id_rsa 16 | ansible_ssh_extra_args= ' -o StrictHostKeyChecking=no -o PreferredAuthentications=password ' -------------------------------------------------------------------------------- /virtualbox-rhel9-generic/files/sample-inventory: -------------------------------------------------------------------------------- 1 | [ansible] 2 | ansible-engine ansible_host=192.168.50.11 ansible_connection=local 3 | 4 | [nodes] 5 | node1 ansible_host=192.168.50.21 6 | node2 ansible_host=192.168.50.22 7 | node3 ansible_host=192.168.50.23 8 | node4 ansible_host=192.168.50.24 9 | node5 ansible_host=192.168.50.25 10 | 11 | [all:vars] 12 | ansible_user=vagrant 13 | ansible_password=vagrant 14 | ansible_connection=ssh 15 | ansible_ssh_private_key_file= /home/vagrant/.ssh/id_rsa 16 | ansible_ssh_extra_args= ' -o StrictHostKeyChecking=no -o PreferredAuthentications=password ' -------------------------------------------------------------------------------- /virtualbox-generic-rhel8-for-bau/files/sample-inventory: -------------------------------------------------------------------------------- 1 | [ansible] 2 | ansible-engine ansible_host=192.168.50.11 ansible_connection=local 3 | 4 | [nodes] 5 | node1 ansible_host=192.168.50.21 6 | node2 ansible_host=192.168.50.22 7 | node3 ansible_host=192.168.50.23 8 | node4 ansible_host=192.168.50.24 9 | node5 ansible_host=192.168.50.25 10 | 11 | [all:vars] 12 | ansible_user=vagrant 13 | ansible_password=vagrant 14 | ansible_connection=ssh 15 | ansible_ssh_private_key_file= /home/vagrant/.ssh/id_rsa 16 | ansible_ssh_extra_args= ' -o StrictHostKeyChecking=no -o PreferredAuthentications=password ' -------------------------------------------------------------------------------- /virtualbox-kubernetes-bible-2E/files/sample-inventory: -------------------------------------------------------------------------------- 1 | [ansible] 2 | ansible-engine ansible_host=192.168.50.11 ansible_connection=local 3 | 4 | [nodes] 5 | node1 ansible_host=192.168.50.21 6 | node2 ansible_host=192.168.50.22 7 | node3 ansible_host=192.168.50.23 8 | node4 ansible_host=192.168.50.24 9 | node5 ansible_host=192.168.50.25 10 | 11 | [all:vars] 12 | ansible_user=vagrant 13 | ansible_password=vagrant 14 | ansible_connection=ssh 15 | ansible_ssh_private_key_file= /home/vagrant/.ssh/id_rsa 16 | ansible_ssh_extra_args= ' -o StrictHostKeyChecking=no -o PreferredAuthentications=password ' -------------------------------------------------------------------------------- /virtualbox-wordpress-dev/README.md: -------------------------------------------------------------------------------- 1 | # VCCW 2 | 3 | [![Build Status](https://travis-ci.org/vccw-team/vccw.svg?branch=master)](https://travis-ci.org/vccw-team/vccw) 4 | 5 | This is a Vagrant configuration designed for development of WordPress plugins, themes, or websites. 6 | 7 | To get started, check out 8 | 9 | ## Configuration 10 | 11 | 1. Copy `provision/default.yml` to `site.yml`. 12 | 1. Edit the `site.yml`. 13 | 1. Run `vagrant up`. 14 | 15 | ### Note 16 | 17 | * The `site.yml` has to be in the same directory with Vagrantfile. 18 | * You can put difference to the `site.yml`. 19 | -------------------------------------------------------------------------------- /vb-ee-node/files/config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # cofigure kubernetes nodes with users and access 3 | 4 | - hosts: all 5 | become: true 6 | 7 | vars: 8 | remote_user_name: vagrant 9 | 10 | tasks: 11 | 12 | - name: Update /etc/hosts with node entries 13 | blockinfile: 14 | path: /etc/hosts 15 | block: | 16 | 192.168.50.11 ansible-engine 17 | 192.168.50.21 ansible-node-1 node1 18 | 192.168.50.22 ansible-node-2 node2 19 | 192.168.50.23 ansible-node-2 node3 20 | 192.168.50.24 ansible-node-2 node4 21 | 192.168.50.25 ansible-node-2 node5 -------------------------------------------------------------------------------- /virtualbox-rhel8-2024/files/config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # cofigure kubernetes nodes with users and access 3 | 4 | - hosts: all 5 | become: true 6 | 7 | vars: 8 | remote_user_name: vagrant 9 | 10 | tasks: 11 | 12 | - name: Update /etc/hosts with node entries 13 | blockinfile: 14 | path: /etc/hosts 15 | block: | 16 | 192.168.50.11 ansible-engine 17 | 192.168.50.21 ansible-node-1 node1 18 | 192.168.50.22 ansible-node-2 node2 19 | 192.168.50.23 ansible-node-2 node3 20 | 192.168.50.24 ansible-node-2 node4 21 | 192.168.50.25 ansible-node-2 node5 -------------------------------------------------------------------------------- /virtualbox-rhel8-eap/files/config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # cofigure kubernetes nodes with users and access 3 | 4 | - hosts: all 5 | become: true 6 | 7 | vars: 8 | remote_user_name: vagrant 9 | 10 | tasks: 11 | 12 | - name: Update /etc/hosts with node entries 13 | blockinfile: 14 | path: /etc/hosts 15 | block: | 16 | 192.168.50.11 ansible-engine 17 | 192.168.50.21 ansible-node-1 node1 18 | 192.168.50.22 ansible-node-2 node2 19 | 192.168.50.23 ansible-node-2 node3 20 | 192.168.50.24 ansible-node-2 node4 21 | 192.168.50.25 ansible-node-2 node5 -------------------------------------------------------------------------------- /virtualbox-rhel9-aap/files/config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # cofigure kubernetes nodes with users and access 3 | 4 | - hosts: all 5 | become: true 6 | 7 | vars: 8 | remote_user_name: vagrant 9 | 10 | tasks: 11 | 12 | - name: Update /etc/hosts with node entries 13 | blockinfile: 14 | path: /etc/hosts 15 | block: | 16 | 192.168.50.11 ansible-engine 17 | 192.168.50.21 ansible-node-1 node1 18 | 192.168.50.22 ansible-node-2 node2 19 | 192.168.50.23 ansible-node-2 node3 20 | 192.168.50.24 ansible-node-2 node4 21 | 192.168.50.25 ansible-node-2 node5 22 | -------------------------------------------------------------------------------- /gcp-openshift-3/README.md: -------------------------------------------------------------------------------- 1 | # WARNING!!! IN PROGRESS ONLY - DO NOT USE 2 | 3 | # OpenShift Node on GCP - Using Vaagrant iac 4 | (Infra as a Code) 5 | 6 | ## Pre-Req 7 | 8 | Refer **[READEME](https://github.com/ginigangadharan/vagrant-iac-usecases/blob/master/README.md)** for environment setup 9 | 10 | See More use cases at **[vagrant-iac-use cases](https://github.com/ginigangadharan/vagrant-iac-usecases)** 11 | 12 | ## Build OpenShift 3.0 Single Node Cluster 13 | - Clone [master repo](https://github.com/ginigangadharan/vagrant-iac-usecases) 14 | - Switch to `gcp-iac-openshift-3` directory 15 | - Then `vagrant up --provider=google` 16 | -------------------------------------------------------------------------------- /virtualbox-rhel7-generic/files/config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # cofigure kubernetes nodes with users and access 3 | 4 | - hosts: all 5 | become: true 6 | 7 | vars: 8 | remote_user_name: vagrant 9 | 10 | tasks: 11 | 12 | - name: Update /etc/hosts with node entries 13 | blockinfile: 14 | path: /etc/hosts 15 | block: | 16 | 192.168.50.11 ansible-engine 17 | 192.168.50.21 ansible-node-1 node1 18 | 192.168.50.22 ansible-node-2 node2 19 | 192.168.50.23 ansible-node-2 node3 20 | 192.168.50.24 ansible-node-2 node4 21 | 192.168.50.25 ansible-node-2 node5 -------------------------------------------------------------------------------- /virtualbox-rhel7-satellite/files/config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # cofigure kubernetes nodes with users and access 3 | 4 | - hosts: all 5 | become: true 6 | 7 | vars: 8 | remote_user_name: vagrant 9 | 10 | tasks: 11 | 12 | - name: Update /etc/hosts with node entries 13 | blockinfile: 14 | path: /etc/hosts 15 | block: | 16 | 192.168.50.11 ansible-engine 17 | 192.168.50.21 ansible-node-1 node1 18 | 192.168.50.22 ansible-node-2 node2 19 | 192.168.50.23 ansible-node-2 node3 20 | 192.168.50.24 ansible-node-2 node4 21 | 192.168.50.25 ansible-node-2 node5 -------------------------------------------------------------------------------- /virtualbox-rhel8-aap24/files/config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # cofigure kubernetes nodes with users and access 3 | 4 | - hosts: all 5 | become: true 6 | 7 | vars: 8 | remote_user_name: vagrant 9 | 10 | tasks: 11 | 12 | - name: Update /etc/hosts with node entries 13 | blockinfile: 14 | path: /etc/hosts 15 | block: | 16 | 192.168.50.11 ansible-engine 17 | 192.168.50.21 ansible-node-1 node1 18 | 192.168.50.22 ansible-node-2 node2 19 | 192.168.50.23 ansible-node-2 node3 20 | 192.168.50.24 ansible-node-2 node4 21 | 192.168.50.25 ansible-node-2 node5 -------------------------------------------------------------------------------- /virtualbox-rhel8-generic/files/config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # cofigure kubernetes nodes with users and access 3 | 4 | - hosts: all 5 | become: true 6 | 7 | vars: 8 | remote_user_name: vagrant 9 | 10 | tasks: 11 | 12 | - name: Update /etc/hosts with node entries 13 | blockinfile: 14 | path: /etc/hosts 15 | block: | 16 | 192.168.50.11 ansible-engine 17 | 192.168.50.21 ansible-node-1 node1 18 | 192.168.50.22 ansible-node-2 node2 19 | 192.168.50.23 ansible-node-2 node3 20 | 192.168.50.24 ansible-node-2 node4 21 | 192.168.50.25 ansible-node-2 node5 -------------------------------------------------------------------------------- /virtualbox-rhel8-jboss/files/config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # cofigure kubernetes nodes with users and access 3 | 4 | - hosts: all 5 | become: true 6 | 7 | vars: 8 | remote_user_name: vagrant 9 | 10 | tasks: 11 | 12 | - name: Update /etc/hosts with node entries 13 | blockinfile: 14 | path: /etc/hosts 15 | block: | 16 | 192.168.50.11 ansible-engine 17 | 192.168.50.21 ansible-node-1 node1 18 | 192.168.50.22 ansible-node-2 node2 19 | 192.168.50.23 ansible-node-2 node3 20 | 192.168.50.24 ansible-node-2 node4 21 | 192.168.50.25 ansible-node-2 node5 -------------------------------------------------------------------------------- /virtualbox-rhel8-vscode/files/config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # cofigure kubernetes nodes with users and access 3 | 4 | - hosts: all 5 | become: true 6 | 7 | vars: 8 | remote_user_name: vagrant 9 | 10 | tasks: 11 | 12 | - name: Update /etc/hosts with node entries 13 | blockinfile: 14 | path: /etc/hosts 15 | block: | 16 | 192.168.50.11 ansible-engine 17 | 192.168.50.21 ansible-node-1 node1 18 | 192.168.50.22 ansible-node-2 node2 19 | 192.168.50.23 ansible-node-2 node3 20 | 192.168.50.24 ansible-node-2 node4 21 | 192.168.50.25 ansible-node-2 node5 -------------------------------------------------------------------------------- /virtualbox-rhel9-generic/files/config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # cofigure kubernetes nodes with users and access 3 | 4 | - hosts: all 5 | become: true 6 | 7 | vars: 8 | remote_user_name: vagrant 9 | 10 | tasks: 11 | 12 | - name: Update /etc/hosts with node entries 13 | blockinfile: 14 | path: /etc/hosts 15 | block: | 16 | 192.168.50.11 ansible-engine 17 | 192.168.50.21 ansible-node-1 node1 18 | 192.168.50.22 ansible-node-2 node2 19 | 192.168.50.23 ansible-node-2 node3 20 | 192.168.50.24 ansible-node-2 node4 21 | 192.168.50.25 ansible-node-2 node5 22 | -------------------------------------------------------------------------------- /gcp-web-server/README.md: -------------------------------------------------------------------------------- 1 | # Vagrant iac (Infra as a Code) on GCP - Demo 2 | 3 | This is a simple repo to demonstrate how to implement iac using Vagrant on GCP. 4 | 5 | ## Pre-Req 6 | 7 | Refer **[READEME](https://github.com/ginigangadharan/vagrant-iac-usecases/blob/master/README.md)** for environment setup 8 | 9 | **See More use cases at [vagrant-iac-use cases](https://github.com/ginigangadharan/vagrant-iac-usecases)** 10 | 11 | ## Build OpenShift 3.0 Single Node Cluster 12 | - Clone [master repo](https://github.com/ginigangadharan/vagrant-iac-usecases) 13 | - Switch to `gcp-iac-web-server` directory 14 | - Then `vagrant up --provider=google` -------------------------------------------------------------------------------- /gcp-wordpress/README.md: -------------------------------------------------------------------------------- 1 | # Vagrant iac (Infra as a Code) on GCP - Demo 2 | 3 | This is a simple repo to demonstrate how to implement iac using Vagrant on GCP. 4 | 5 | ## Pre-Req 6 | 7 | Refer **[READEME](https://github.com/ginigangadharan/vagrant-iac-usecases/blob/master/README.md)** for environment setup 8 | 9 | **See More use cases at [vagrant-iac-use cases](https://github.com/ginigangadharan/vagrant-iac-usecases)** 10 | 11 | ## Build OpenShift 3.0 Single Node Cluster 12 | - Clone [master repo](https://github.com/ginigangadharan/vagrant-iac-usecases) 13 | - Switch to `gcp-iac-web-server` directory 14 | - Then `vagrant up --provider=google` -------------------------------------------------------------------------------- /virtualbox-generic-rhel8-for-bau/files/config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # cofigure kubernetes nodes with users and access 3 | 4 | - hosts: all 5 | become: true 6 | 7 | vars: 8 | remote_user_name: vagrant 9 | 10 | tasks: 11 | 12 | - name: Update /etc/hosts with node entries 13 | blockinfile: 14 | path: /etc/hosts 15 | block: | 16 | 192.168.50.11 ansible-engine 17 | 192.168.50.21 ansible-node-1 node1 18 | 192.168.50.22 ansible-node-2 node2 19 | 192.168.50.23 ansible-node-2 node3 20 | 192.168.50.24 ansible-node-2 node4 21 | 192.168.50.25 ansible-node-2 node5 -------------------------------------------------------------------------------- /virtualbox-fedora/README.md: -------------------------------------------------------------------------------- 1 | # Ansible Lab with RHEL8 machines 2 | 3 | Note: This is a special purpose Ansible Lab with RHEL8 OS and also with RHEL Subscriptions. For quick labs, check [Ansible Lab with Centos]([../virtulabox-ansible-lab](https://github.com/ginigangadharan/vagrant-iac-usecases/tree/master/virtualbox-ansible-lab)) 4 | 5 | ## Prerequisites 6 | 7 | - Vagrant installed on workstation 8 | - Virtualbox installed on workstation 9 | - Ansible installed on workstation (using Ansible for most of the provisioning jobs) 10 | - Install Ansible collections from requirements.yml 11 | 12 | ```shell 13 | $ ansible-galaxy install -r requirements.yml 14 | ``` 15 | 16 | -------------------------------------------------------------------------------- /virtualbox-ubuntu/README.md: -------------------------------------------------------------------------------- 1 | # Ansible Lab with RHEL8 machines 2 | 3 | Note: This is a special purpose Ansible Lab with RHEL8 OS and also with RHEL Subscriptions. For quick labs, check [Ansible Lab with Centos]([../virtulabox-ansible-lab](https://github.com/ginigangadharan/vagrant-iac-usecases/tree/master/virtualbox-ansible-lab)) 4 | 5 | ## Prerequisites 6 | 7 | - Vagrant installed on workstation 8 | - Virtualbox installed on workstation 9 | - Ansible installed on workstation (using Ansible for most of the provisioning jobs) 10 | - Install Ansible collections from requirements.yml 11 | 12 | ```shell 13 | $ ansible-galaxy install -r requirements.yml 14 | ``` 15 | 16 | -------------------------------------------------------------------------------- /virtualbox-cp-fedora/README.md: -------------------------------------------------------------------------------- 1 | # Ansible Lab with RHEL8 machines 2 | 3 | Note: This is a special purpose Ansible Lab with RHEL8 OS and also with RHEL Subscriptions. For quick labs, check [Ansible Lab with Centos]([../virtulabox-ansible-lab](https://github.com/ginigangadharan/vagrant-iac-usecases/tree/master/virtualbox-ansible-lab)) 4 | 5 | ## Prerequisites 6 | 7 | - Vagrant installed on workstation 8 | - Virtualbox installed on workstation 9 | - Ansible installed on workstation (using Ansible for most of the provisioning jobs) 10 | - Install Ansible collections from requirements.yml 11 | 12 | ```shell 13 | $ ansible-galaxy install -r requirements.yml 14 | ``` 15 | 16 | -------------------------------------------------------------------------------- /virtualbox-cp-ubuntu/README.md: -------------------------------------------------------------------------------- 1 | # Ansible Lab with RHEL8 machines 2 | 3 | Note: This is a special purpose Ansible Lab with RHEL8 OS and also with RHEL Subscriptions. For quick labs, check [Ansible Lab with Centos]([../virtulabox-ansible-lab](https://github.com/ginigangadharan/vagrant-iac-usecases/tree/master/virtualbox-ansible-lab)) 4 | 5 | ## Prerequisites 6 | 7 | - Vagrant installed on workstation 8 | - Virtualbox installed on workstation 9 | - Ansible installed on workstation (using Ansible for most of the provisioning jobs) 10 | - Install Ansible collections from requirements.yml 11 | 12 | ```shell 13 | $ ansible-galaxy install -r requirements.yml 14 | ``` 15 | 16 | -------------------------------------------------------------------------------- /virtualbox-ansible-lab-special/README.md: -------------------------------------------------------------------------------- 1 | # Ansible Lab with RHEL8 machines 2 | 3 | Note: This is a special purpose Ansible Lab with RHEL8 OS and also with RHEL Subscriptions. For quick labs, check [Ansible Lab with Centos]([../virtulabox-ansible-lab](https://github.com/ginigangadharan/vagrant-iac-usecases/tree/master/virtualbox-ansible-lab)) 4 | 5 | ## Prerequisites 6 | 7 | - Vagrant installed on workstation 8 | - Virtualbox installed on workstation 9 | - Ansible installed on workstation (using Ansible for most of the provisioning jobs) 10 | - Install Ansible collections from requirements.yml 11 | 12 | ```shell 13 | $ ansible-galaxy install -r requirements.yml 14 | ``` 15 | 16 | -------------------------------------------------------------------------------- /virtualbox-fedora-workstation/README.md: -------------------------------------------------------------------------------- 1 | # Ansible Lab with RHEL8 machines 2 | 3 | Note: This is a special purpose Ansible Lab with RHEL8 OS and also with RHEL Subscriptions. For quick labs, check [Ansible Lab with Centos]([../virtulabox-ansible-lab](https://github.com/ginigangadharan/vagrant-iac-usecases/tree/master/virtualbox-ansible-lab)) 4 | 5 | ## Prerequisites 6 | 7 | - Vagrant installed on workstation 8 | - Virtualbox installed on workstation 9 | - Ansible installed on workstation (using Ansible for most of the provisioning jobs) 10 | - Install Ansible collections from requirements.yml 11 | 12 | ```shell 13 | $ ansible-galaxy install -r requirements.yml 14 | ``` 15 | 16 | -------------------------------------------------------------------------------- /virtualbox-kubernetes/kubernetes-setup/05-install-k8s-tools.yaml: -------------------------------------------------------------------------------- 1 | # Step 2.3: Installing kubelet, kubeadm and kubectl using the below code. 2 | - name: Add an apt signing key for Kubernetes 3 | apt_key: 4 | url: https://packages.cloud.google.com/apt/doc/apt-key.gpg 5 | state: present 6 | - name: Adding apt repository for Kubernetes 7 | apt_repository: 8 | repo: deb https://apt.kubernetes.io/ kubernetes-xenial main 9 | state: present 10 | filename: kubernetes.list 11 | - name: Install Kubernetes binaries 12 | apt: 13 | name: "{{ packages }}" 14 | state: present 15 | update_cache: yes 16 | vars: 17 | packages: 18 | - kubelet 19 | - kubeadm 20 | - kubectl -------------------------------------------------------------------------------- /gcp-wordpress/roles/makarenalabs.wordpress/molecule/default/INSTALL.rst: -------------------------------------------------------------------------------- 1 | ******* 2 | Docker driver installation guide 3 | ******* 4 | 5 | Requirements 6 | ============ 7 | 8 | * Docker Engine 9 | 10 | Install 11 | ======= 12 | 13 | Please refer to the `Virtual environment`_ documentation for installation best 14 | practices. If not using a virtual environment, please consider passing the 15 | widely recommended `'--user' flag`_ when invoking ``pip``. 16 | 17 | .. _Virtual environment: https://virtualenv.pypa.io/en/latest/ 18 | .. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site 19 | 20 | .. code-block:: bash 21 | 22 | $ pip install 'molecule[docker]' 23 | -------------------------------------------------------------------------------- /gcp-awx-server/README.md: -------------------------------------------------------------------------------- 1 | # Ansible AWX Server - Using Vagrant iac 2 | (Infra as a Code) 3 | 4 | AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is the upstream project for Tower, a commercial derivative of AWX. 5 | [Learn More](https://github.com/ansible/awx) 6 | 7 | ## Pre-Req 8 | 9 | Refer **[READEME](https://github.com/ginigangadharan/vagrant-iac-usecases/blob/master/README.md)** for environment setup 10 | 11 | **See More use cases at [vagrant-iac-use cases](https://github.com/ginigangadharan/vagrant-iac-usecases)** 12 | 13 | ## Build AWX Sandbox 14 | - Clone [master repo](https://github.com/ginigangadharan/vagrant-iac-usecases) 15 | - Switch to `gcp-iac-awx-server` directory 16 | - `vagrant up --provider=google` 17 | -------------------------------------------------------------------------------- /virtualbox-kubernetes-fedora/kubernetes-setup/Debian-prep.yaml: -------------------------------------------------------------------------------- 1 | - name: Add an apt signing key for Docker 2 | apt_key: 3 | url: https://download.docker.com/linux/ubuntu/gpg 4 | state: present 5 | 6 | - name: Add apt repository for stable version 7 | apt_repository: 8 | repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable 9 | state: present 10 | 11 | - name: Open firewall ports 12 | shell: 'sudo systemctl disable ufw' 13 | 14 | - name: Install packages that allow apt to be used over HTTPS 15 | apt: 16 | name: "{{ packages }}" 17 | state: present 18 | update_cache: yes 19 | vars: 20 | packages: 21 | - apt-transport-https 22 | - ca-certificates 23 | - curl 24 | - gnupg-agent 25 | - software-properties-common 26 | -------------------------------------------------------------------------------- /virtualbox-wordpress-dev/wp-cli/browse-command.php: -------------------------------------------------------------------------------- 1 | 2 | ServerAdmin {{wp_admin_email}} 3 | ServerName {{wp_sitename}} 4 | ServerAlias www.{{wp_sitename}} 5 | 6 | DocumentRoot "{{wp_install_dir}}" 7 | 8 | 9 | Options FollowSymLinks MultiViews Includes ExecCGI 10 | AllowOverride none 11 | Order allow,deny 12 | allow from all 13 | Require all granted 14 | #RewriteEngine On 15 | #RewriteBase / 16 | #RewriteRule ^index\.php$ - [L] 17 | #RewriteCond %{REQUEST_FILENAME} !-f 18 | #RewriteCond %{REQUEST_FILENAME} !-d 19 | #RewriteRule . /index.php [L] 20 | 21 | 22 | ErrorLog /var/log/apache2/{{wp_sitename}}-error.log 23 | LogLevel warn 24 | CustomLog /var/log/apache2/{{wp_sitename}}-access.log combined 25 | 26 | -------------------------------------------------------------------------------- /virtualbox-wordpress-dev/provision/playbooks/templates/browse-command.php: -------------------------------------------------------------------------------- 1 | > ansible.cfg" 22 | 23 | script: 24 | # Create symlink to role with correct name 25 | - ln -s ansible-role-wordpress ../makarenalabs.wordpress 26 | 27 | # Check the role/playbook's syntax. 28 | - ansible-playbook -i tests/inventory $PLAY --syntax-check 29 | 30 | # Run the role/playbook with ansible-playbook. 31 | - ansible-playbook -i tests/inventory $PLAY --connection=local --become -vvvv 32 | -------------------------------------------------------------------------------- /vb-ee-node/Vagrantfile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME = "generic/rhel8" 2 | VM_EE_NAME = "AnsibleEE" 3 | VM_AAP_HUB_NAME = "AutomationHub22" 4 | VM_AAP_DB_NAME = "PSQL22" 5 | NODES = 1 6 | 7 | Vagrant.configure("2") do |config| 8 | config.ssh.insert_key = false 9 | 10 | (1..NODES).each do |i| 11 | config.vm.define "#{VM_EE_NAME}-#{i}" do |node| 12 | node.vm.box = IMAGE_NAME 13 | #node.vm.network "private_network", ip: "192.168.50.#{i + 20}", virtualbox__intnet: "intnet" 14 | node.vm.hostname = "#{VM_EE_NAME}-#{i}" 15 | 16 | # VM customization 17 | node.vm.provider :virtualbox do |vb| 18 | vb.name = "#{VM_EE_NAME}-#{i}" 19 | vb.memory = 9096 20 | vb.cpus = 4 21 | end 22 | 23 | node.vm.provision "ansible" do |ansible| 24 | ansible.compatibility_mode = "2.0" 25 | ansible.playbook = "files/config.yaml" 26 | end 27 | end 28 | end 29 | 30 | 31 | 32 | end -------------------------------------------------------------------------------- /gcp-wordpress/roles/makarenalabs.wordpress/tasks/nginx.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Wordpress | Nginx | Figure out PHP FPM socket location 3 | shell: dpkg -l | grep php-fpm | awk '{print $3}' | grep -o '[0-9]\.[0-9]' | head -n 1 4 | register: 'php_ver' 5 | 6 | - name: Start service php{{ php_ver.stdout }} 7 | service: 8 | name: "php{{ php_ver.stdout }}-fpm" 9 | state: started 10 | 11 | - name: Start service nginx 12 | service: 13 | name: "nginx" 14 | state: started 15 | 16 | - name: Wordpress | Nginx | Copy virtual host configuration file 17 | template: 18 | src: "nginx-vhost.j2" 19 | dest: "/etc/nginx/sites-available/{{ wp_sitename }}" 20 | owner: root 21 | group: root 22 | mode: 0644 23 | 24 | - name: WordPress | Nginx | Symlink virtual host configuration file from sites-available to sites-enabled 25 | file: 26 | state: link 27 | src: "/etc/nginx/sites-available/{{ wp_sitename }}" 28 | dest: "/etc/nginx/sites-enabled/{{ wp_sitename }}" 29 | owner: root 30 | group: root 31 | mode: 0644 32 | -------------------------------------------------------------------------------- /gcp-openshift-3/Vagrantfile-new: -------------------------------------------------------------------------------- 1 | $ cat Vagrantfile 2 | # -*- mode: ruby -*- 3 | # vi: set ft=ruby : 4 | 5 | $script = <<-SCRIPT 6 | cat > /etc/docker/daemon.json << EOF 7 | { 8 | "insecure-registries": [ 9 | "172.30.0.0/16" 10 | ] 11 | } 12 | EOF 13 | echo Restarting Docker... 14 | systemctl daemon-reload 15 | systemctl restart docker 16 | OPENSHIFT=openshift-origin-client-tools-v3.10.0-dd10d17-linux-64bit 17 | echo Downloading Openshift binaries: $OPENSHIFT 18 | wget -q https://github.com/openshift/origin/releases/download/v3.10.0/$OPENSHIFT.tar.gz 19 | tar xvf $OPENSHIFT.tar.gz 20 | mv $OPENSHIFT openshift 21 | rm $OPENSHIFT.tar.gz 22 | sudo -u vagrant echo "export PATH=$PATH:/home/vagrant/openshift" >> .bash_profile 23 | SCRIPT 24 | 25 | Vagrant.configure("2") do |config| 26 | config.vm.provider "virtualbox" do |v| 27 | v.memory = 16384 28 | v.cpus = 2 29 | end 30 | 31 | config.vm.box = "bento/centos-7.6" 32 | config.vm.network "private_network", type: "dhcp" 33 | config.vm.network "forwarded_port", guest: 8443, host: 8443 34 | config.vm.provision "docker" 35 | config.vm.provision "shell", inline: $script 36 | end -------------------------------------------------------------------------------- /gcp-wordpress/roles/makarenalabs.wordpress/molecule/default/tests/test_default.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import testinfra.utils.ansible_runner 4 | 5 | testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( 6 | os.environ['MOLECULE_INVENTORY_FILE'] 7 | ).get_hosts('all') 8 | 9 | 10 | def test_hosts_file(host): 11 | f = host.file('/etc/hosts') 12 | 13 | assert f.exists 14 | assert f.user == 'root' 15 | assert f.group == 'root' 16 | 17 | def test_nginx_is_installed(host): 18 | nginx = host.package("nginx") 19 | assert nginx.is_installed 20 | 21 | def test_nginx_running_and_enabled(host): 22 | nginx = host.service("nginx") 23 | assert nginx.is_running 24 | assert nginx.is_enabled 25 | 26 | def test_php_is_installed(host): 27 | php = host.package("php7.3-fpm") 28 | assert php.is_installed 29 | 30 | def test_php_running_and_enabled(host): 31 | php = host.service("php7.3-fpm") 32 | assert php.is_running 33 | assert php.is_enabled 34 | 35 | def test_curl_localhost(host): 36 | cmd = host.check_output("curl http://localhost/wp-admin/install.php") 37 | assert 'WordPress' in cmd 38 | 39 | 40 | -------------------------------------------------------------------------------- /virtualbox-wordpress-dev/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Takayuki Miyauchi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /gcp-wordpress/roles/makarenalabs.wordpress/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 MakarenaLabs 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /gcp-wordpress/Vagrantfile: -------------------------------------------------------------------------------- 1 | # Require the GCP provider plugin 2 | require 'vagrant-google' 3 | NODE_NAME = "centos-wordpress" 4 | 5 | # Create and configure the GCP instance(s) 6 | Vagrant.configure('2') do |config| 7 | 8 | # Since we are using GCP Image, below config.vm.box is just for syntax purpose. 9 | config.vm.box = "google/gce" 10 | 11 | config.vm.hostname = NODE_NAME 12 | 13 | # Specify GCP provider configurations 14 | config.vm.provider :google do |google, override| 15 | google.google_project_id = "pemvsg-pe-staging" 16 | google.google_json_key_location = "~/.gcp/PEMVSG-PE-STAGING-a324d3cd4696.json" 17 | google.image_family = 'ubuntu-1604-lts' 18 | machine_type = 'g1-small' #g1-small / n1-standard-1 / n1-standard-2 etc 19 | 20 | # for devops 21 | override.ssh.username = 'devops' 22 | override.ssh.private_key_path = '~/.ssh/id_rsa' 23 | config.ssh.insert_key = false 24 | 25 | end 26 | 27 | # Specify Ansible as provisioner and provide the playbook details. 28 | # Use ansible_local instead of ansible if you are on windows (if ansible not available on host) 29 | config.vm.provision "ansible" do |ansible| 30 | ansible.verbose = "v" 31 | ansible.playbook = "deploy-wordpress.yaml" 32 | end 33 | end -------------------------------------------------------------------------------- /virtualbox-wordpress/Vagrantfile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME = "debian/buster64" 2 | NODE_NAME = "wp-101" 3 | 4 | Vagrant.configure("2") do |config| 5 | #config.ssh.insert_key = false 6 | 7 | config.vm.provider "virtualbox" do |v| 8 | v.memory = 2048 9 | v.cpus = 2 10 | end 11 | 12 | config.ssh.insert_key = true 13 | config.ssh.forward_agent = true 14 | 15 | config.vm.network "forwarded_port", 16 | guest: 80, 17 | host: 8080, 18 | auto_correct: true 19 | 20 | config.vm.network "forwarded_port", 21 | guest: 443, 22 | host: 8443, 23 | auto_correct: true 24 | 25 | config.vm.define NODE_NAME do |wpnode| 26 | 27 | wpnode.vm.box = IMAGE_NAME 28 | # wpnode.vm.network "private_network", ip: "192.168.50.10" 29 | wpnode.vm.hostname = NODE_NAME 30 | 31 | # naming the virtualmachine 32 | wpnode.vm.provider :virtualbox do |vb| 33 | vb.name = NODE_NAME 34 | end 35 | #wpnode.vm.provision "ansible_local" do |ansible| 36 | # ansible.compatibility_mode = "2.0" 37 | # ansible.playbook = "install-minikube.yaml" 38 | # ansible.extra_vars = { 39 | # node_ip: "192.168.50.10", 40 | # } 41 | #end 42 | end 43 | end -------------------------------------------------------------------------------- /gcp-wordpress/roles/makarenalabs.wordpress/molecule/default/Dockerfile.j2: -------------------------------------------------------------------------------- 1 | # Molecule managed 2 | 3 | {% if item.registry is defined %} 4 | FROM {{ item.registry.url }}/{{ item.image }} 5 | {% else %} 6 | FROM {{ item.image }} 7 | {% endif %} 8 | 9 | {% if item.env is defined %} 10 | {% for var, value in item.env.items() %} 11 | {% if value %} 12 | ENV {{ var }} {{ value }} 13 | {% endif %} 14 | {% endfor %} 15 | {% endif %} 16 | 17 | RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates iproute2 && apt-get clean; \ 18 | elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash iproute && dnf clean all; \ 19 | elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash iproute && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ 20 | elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml iproute2 && zypper clean -a; \ 21 | elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ 22 | elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates iproute2 && xbps-remove -O; fi 23 | -------------------------------------------------------------------------------- /virtualbox-wordpress/Vagrantfile copy: -------------------------------------------------------------------------------- 1 | IMAGE_NAME = "centos/7" 2 | NODE_NAME = "centos-wordpress" 3 | 4 | Vagrant.configure("2") do |config| 5 | #config.ssh.insert_key = false 6 | 7 | config.vm.provider "virtualbox" do |v| 8 | v.memory = 2048 9 | v.cpus = 2 10 | end 11 | 12 | config.ssh.insert_key = true 13 | config.ssh.forward_agent = true 14 | 15 | config.vm.network "forwarded_port", 16 | guest: 80, 17 | host: 8080, 18 | auto_correct: true 19 | 20 | config.vm.network "forwarded_port", 21 | guest: 443, 22 | host: 8443, 23 | auto_correct: true 24 | 25 | config.vm.define NODE_NAME do |master| 26 | 27 | master.vm.box = IMAGE_NAME 28 | master.vm.network "private_network", ip: "192.168.50.10" 29 | master.vm.hostname = NODE_NAME 30 | 31 | # naming the virtualmachine 32 | master.vm.provider :virtualbox do |vb| 33 | vb.name = NODE_NAME 34 | end 35 | #master.vm.provision "ansible_local" do |ansible| 36 | # ansible.compatibility_mode = "2.0" 37 | # ansible.playbook = "install-minikube.yaml" 38 | # ansible.extra_vars = { 39 | # node_ip: "192.168.50.10", 40 | # } 41 | #end 42 | end 43 | end -------------------------------------------------------------------------------- /virtualbox-rhel9-aap25/Vagrantfile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME = "generic/rhel9" 2 | VM_NAME = "aap25-rhel92" 3 | NODES = 1 4 | 5 | Vagrant.configure("2") do |config| 6 | config.ssh.insert_key = false 7 | 8 | (1..NODES).each do |i| 9 | config.vm.define "#{VM_NAME}-#{i}" do |node| 10 | node.vm.box = IMAGE_NAME 11 | node.vm.network "private_network", ip: "192.168.57.122" 12 | 13 | # set hostname 14 | node.vm.hostname = "#{VM_NAME}-#{i}" 15 | 16 | # VM customization 17 | node.vm.provider :virtualbox do |vb| 18 | vb.name = "#{VM_NAME}-#{i}" 19 | vb.memory = 512 20 | vb.cpus = 1 21 | end 22 | 23 | # provisioning 24 | # adding host ssh key for direct ssh login 25 | node.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "host_ssh_public_key" 26 | node.vm.provision "shell", inline: <<-SHELL 27 | cat host_ssh_public_key >> /home/vagrant/.ssh/authorized_keys 28 | SHELL 29 | node.vm.provision "ansible" do |ansible| 30 | ansible.compatibility_mode = "2.0" 31 | ansible.playbook = "files/config.yaml" 32 | end 33 | end 34 | end 35 | 36 | end -------------------------------------------------------------------------------- /gcp-web-server/Vagrantfile: -------------------------------------------------------------------------------- 1 | # Require the GCP provider plugin 2 | require 'vagrant-google' 3 | 4 | # Create and configure the GCP instance(s) 5 | Vagrant.configure('2') do |config| 6 | 7 | # Since we are using GCP Image, below config.vm.box is just for syntax purpose. 8 | config.vm.box = "google/gce" 9 | 10 | # config.vm.hostname = "webserver101" 11 | 12 | # Specify GCP provider configurations 13 | config.vm.provider :google do |google, override| 14 | google.google_project_id = "devops-vinmel" 15 | # google.google_json_key_location = "~/DevOps-VinMel-a1d7290c059e.json" # for my Mac 16 | google.google_json_key_location = "~/.gcp/DevOps-VinMel-ef65f08aefc1.json" 17 | google.image_family = 'ubuntu-1604-lts' 18 | machine_type = 'g1-small' #g1-small / n1-standard-1 / n1-standard-2 etc 19 | # From my Mac 20 | #override.ssh.username = 'gini' 21 | #override.ssh.private_key_path = "~/.ssh/id_gce" 22 | 23 | # for devops 24 | override.ssh.username = 'devops' 25 | override.ssh.private_key_path = '~/.ssh/id_rsa' 26 | 27 | config.ssh.insert_key = false 28 | 29 | end 30 | 31 | # Specify Ansible as provisioner and provide the playbook details. 32 | config.vm.provision "ansible_local" do |ansible| 33 | ansible.verbose = "v" 34 | ansible.playbook = "deploy-infra.yaml" 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /virtualbox-kubernetes/kubernetes-setup/compute-node-playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: all 3 | become: true 4 | vars_files: 5 | - variables.yaml 6 | tasks: 7 | 8 | - name: Configure repo and update system 9 | include_tasks: 10 | file: 01-repo-config.yaml 11 | 12 | - name: Configure repo and update system 13 | include_tasks: 14 | file: 02-configure-system.yaml 15 | 16 | - name: Install packages 17 | include_tasks: 18 | file: 03-configure-packages.yaml 19 | 20 | - name: Install packages 21 | include_tasks: 22 | file: 04-disable-swap.yaml 23 | 24 | - name: Install k8s tools 25 | include_tasks: 26 | file: 05-install-k8s-tools.yaml 27 | 28 | - name: Configure node ip 29 | lineinfile: 30 | #changedthis 31 | create: yes 32 | path: /etc/default/kubelet 33 | line: KUBELET_EXTRA_ARGS=--node-ip={{ node_ip }} 34 | 35 | - name: Restart kubelet 36 | service: 37 | name: kubelet 38 | daemon_reload: yes 39 | state: restarted 40 | 41 | # Step 3.2: Join the nodes to the Kubernetes cluster using below code. 42 | - name: Copy the join command to server location 43 | copy: 44 | src: join-command 45 | dest: /tmp/join-command.sh 46 | mode: '0777' 47 | 48 | - name: Join the node to cluster 49 | command: sh /tmp/join-command.sh 50 | -------------------------------------------------------------------------------- /virtualbox-generic-ubuntu/Vagrantfile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME = "generic/ubuntu2104" 2 | VM_NAME = "Generic-Ubuntu21" 3 | NODES = 1 4 | 5 | Vagrant.configure("2") do |config| 6 | config.ssh.insert_key = false 7 | 8 | (1..NODES).each do |i| 9 | config.vm.define "#{VM_NAME}-#{i}" do |node| 10 | node.vm.box = IMAGE_NAME 11 | #node.vm.network "private_network", ip: "192.168.50.#{i + 20}", virtualbox__intnet: "intnet" 12 | 13 | ## add a host-only adaptor. 14 | ## Change this line as needed if your host-only network name is different :name => 'vboxnet0', , adapter : 2 15 | node.vm.network "private_network", type: "dhcp" 16 | node.vm.hostname = "#{VM_NAME}-#{i}" 17 | 18 | # VM customization 19 | node.vm.provider :virtualbox do |vb| 20 | vb.name = "#{VM_NAME}-#{i}" 21 | vb.memory = 1024 22 | vb.cpus = 1 23 | end 24 | 25 | # provisioning 26 | # adding host ssh key for direct ssh login 27 | node.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "host_ssh_public_key" 28 | node.vm.provision "shell", inline: <<-SHELL 29 | cat host_ssh_public_key >> /home/vagrant/.ssh/authorized_keys 30 | SHELL 31 | end 32 | end 33 | 34 | end -------------------------------------------------------------------------------- /virtualbox-kubernetes/kubernetes-setup/03-configure-packages.yaml: -------------------------------------------------------------------------------- 1 | - name: Install packages 2 | apt: 3 | name: "{{ packages }}" 4 | state: present 5 | update_cache: true 6 | vars: 7 | packages: 8 | - apt-transport-https 9 | - ca-certificates 10 | - curl 11 | - gnupg-agent 12 | - software-properties-common 13 | - curl 14 | - containerd.io 15 | 16 | - name: Configure containerd 17 | shell: "{{ item }}" 18 | with_items: 19 | - 'mkdir -p /etc/containerd' 20 | - 'containerd config default>/etc/containerd/config.toml' 21 | # - 'sudo systemctl restart containerd' 22 | 23 | - name: Ensure SystemdCgroup is set to true 24 | lineinfile: 25 | path: /etc/containerd/config.toml 26 | regexp: ^SystemdCgroup =* 27 | line: 'SystemdCgroup = true' 28 | 29 | - name: Restart containerd service 30 | ansible.builtin.service: 31 | name: containerd 32 | state: restarted 33 | 34 | # - name: Install docker and its dependecies 35 | # apt: 36 | # name: "{{ packages }}" 37 | # state: present 38 | # update_cache: yes 39 | # vars: 40 | # packages: 41 | # # - docker-ce 42 | # # - docker-ce-cli 43 | # - containerd.io 44 | # notify: 45 | # - docker status 46 | 47 | # - name: Add vagrant user to docker group 48 | # user: 49 | # name: vagrant 50 | # group: docker 51 | -------------------------------------------------------------------------------- /virtualbox-rhel/Vagrantfile: -------------------------------------------------------------------------------- 1 | ## RHEL7 - Use below 2 | IMAGE_NAME = "generic/rhel7" 3 | 4 | ## RHEL8 - Use below 5 | ## IMAGE_NAME = "generic/rhel8" 6 | 7 | NODE_NAME = "rhel-vm" 8 | 9 | Vagrant.configure("2") do |config| 10 | #config.ssh.insert_key = false 11 | 12 | config.vm.provider "virtualbox" do |v| 13 | v.memory = 2048 14 | v.cpus = 2 15 | end 16 | 17 | config.ssh.insert_key = true 18 | config.ssh.forward_agent = true 19 | 20 | config.vm.network "forwarded_port", 21 | guest: 80, 22 | host: 8080, 23 | auto_correct: true 24 | 25 | config.vm.network "forwarded_port", 26 | guest: 443, 27 | host: 8443, 28 | auto_correct: true 29 | 30 | config.vm.define NODE_NAME do |master| 31 | 32 | master.vm.box = IMAGE_NAME 33 | master.vm.network "private_network", ip: "192.168.50.100" 34 | master.vm.hostname = NODE_NAME 35 | 36 | # naming the virtualmachine 37 | master.vm.provider :virtualbox do |vb| 38 | vb.name = NODE_NAME 39 | end 40 | #master.vm.provision "ansible_local" do |ansible| 41 | # ansible.compatibility_mode = "2.0" 42 | # ansible.playbook = "install-minikube.yaml" 43 | # ansible.extra_vars = { 44 | # node_ip: "192.168.50.10", 45 | # } 46 | #end 47 | end 48 | end -------------------------------------------------------------------------------- /gcp-openshift-3/Vagrantfile: -------------------------------------------------------------------------------- 1 | # Require the GCP provider plugin 2 | require 'vagrant-google' 3 | 4 | # Create and configure the GCP instance(s) 5 | Vagrant.configure('2') do |config| 6 | 7 | # Since we are using GCP Image, below config.vm.box is just for syntax purpose. 8 | config.vm.box = "google/gce" 9 | 10 | # config.vm.hostname = "webserver101" 11 | 12 | # Specify GCP provider configurations 13 | config.vm.provider :google do |google, override| 14 | google.google_project_id = "devops-vinmel" 15 | # google.google_json_key_location = "~/DevOps-VinMel-a1d7290c059e.json" # for my Mac 16 | google.google_json_key_location = "~/.gcp/DevOps-VinMel-ef65f08aefc1.json" 17 | google.image_family = 'centos-7' #'ubuntu-1604-lts' 18 | machine_type = 'n1-standard-1' #g1-small / n1-standard-1 / n1-standard-2 etc 19 | disk_size = 20 20 | # From my Mac 21 | #override.ssh.username = 'gini' 22 | #override.ssh.private_key_path = "~/.ssh/id_gce" 23 | 24 | # for devops 25 | override.ssh.username = 'devops' 26 | override.ssh.private_key_path = '~/.ssh/id_rsa' 27 | 28 | config.ssh.insert_key = false 29 | 30 | end 31 | 32 | # Specify Ansible as provisioner and provide the playbook details. 33 | config.vm.provision "ansible_local" do |ansible| 34 | ansible.verbose = "v" 35 | ansible.playbook = "deploy-awx.yml" 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /gcp-awx-server/Vagrantfile: -------------------------------------------------------------------------------- 1 | # Require the GCP provider plugin 2 | require 'vagrant-google' 3 | 4 | # Create and configure the GCP instance(s) 5 | Vagrant.configure('2') do |config| 6 | 7 | # Since we are using GCP Image, below config.vm.box is just for syntax purpose. 8 | config.vm.box = "google/gce" 9 | 10 | # config.vm.hostname = "webserver101" 11 | 12 | # Specify GCP provider configurations 13 | config.vm.provider :google do |google, override| 14 | google.google_project_id = "vd-devops-271814" 15 | # google.google_json_key_location = "~/DevOps-VinMel-a1d7290c059e.json" # for my Mac 16 | google.google_json_key_location = "~/.gcp/vd-devops-271814-0320d6111b57.json" 17 | google.image_family = 'centos-7' #'ubuntu-1604-lts' 18 | machine_type = 'n1-standard-1' #g1-small / n1-standard-1 / n1-standard-2 etc 19 | disk_size = 20 20 | # From my Mac 21 | #override.ssh.username = 'gini' 22 | #override.ssh.private_key_path = "~/.ssh/id_gce" 23 | 24 | # for devops 25 | override.ssh.username = 'devops' 26 | override.ssh.private_key_path = '~/.ssh/id_rsa' 27 | 28 | config.ssh.insert_key = false 29 | 30 | end 31 | 32 | # Specify Ansible as provisioner and provide the playbook details. 33 | config.vm.provision "ansible_local" do |ansible| 34 | ansible.verbose = "v" 35 | ansible.playbook = "deploy-awx.yml" 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /virtualbox-wordpress-dev/Movefile.yml: -------------------------------------------------------------------------------- 1 | global: 2 | sql_adapter: default 3 | 4 | local: 5 | vhost: "http://vccw.test" 6 | wordpress_path: "/var/www/html" # use an absolute path here 7 | 8 | database: 9 | name: "wordpress" 10 | user: "wordpress" 11 | password: "wordpress" 12 | host: "localhost" 13 | charset: "utf8" 14 | 15 | # paths: # you can customize wordpress internal paths 16 | # wp_config: "wp-config-custom.php" 17 | # wp_content: "wp-content" 18 | # uploads: "wp-content/uploads" 19 | # plugins: "wp-content/plugins" 20 | # mu_plugins: "wp-content/mu-plugins" 21 | # themes: "wp-content/themes" 22 | # languages: "wp-content/languages" 23 | 24 | production: 25 | vhost: "http://example.com" 26 | wordpress_path: "/var/www/your_site" # use an absolute path here 27 | 28 | database: 29 | name: "database_name" 30 | user: "user" 31 | password: "password" 32 | host: "host" 33 | port: "3308" # Use just in case you have exotic server config 34 | mysqldump_options: "--max_allowed_packet=50MB" # Only available if using SSH 35 | 36 | exclude: 37 | - ".git/" 38 | - ".gitignore" 39 | - ".sass-cache/" 40 | - "bin/" 41 | - "tmp/*" 42 | - "Gemfile*" 43 | - "movefile.yml" 44 | - "wp-config.php" 45 | - "wp-content/*.sql" 46 | 47 | ssh: 48 | host: "host" 49 | user: "user" 50 | port: 22 51 | rsync_options: --verbose 52 | -------------------------------------------------------------------------------- /virtualbox-kubernetes/kubernetes-setup/02-configure-system.yaml: -------------------------------------------------------------------------------- 1 | - name: Configure systemctl 2 | copy: 3 | content: | 4 | net.bridge.bridge-nf-call-iptables = 1 5 | net.ipv4.ip_forward = 1 6 | net.bridge.bridge-nf-call-ip6tables = 1 7 | dest: /etc/sysctl.d/99-kubernetes-cri.conf 8 | 9 | - name: Load the br_netfilter & overlay module 10 | shell: | 11 | sudo modprobe overlay 12 | sudo modprobe br_netfilter 13 | 14 | - name: Configure /etc/modules-load.d/containerd.conf 15 | copy: 16 | content: | 17 | overlay 18 | br_netfilter 19 | dest: /etc/modules-load.d/containerd.conf 20 | mode: '0644' 21 | 22 | - name: Reload sysctl config 23 | shell: 'sudo sysctl --system' 24 | 25 | 26 | # - name: Open firewall ports 27 | # firewalld: 28 | # port: "{{ item }}" 29 | # permanent: true 30 | # state: enabled 31 | # immediate: true 32 | # with_items: "{{ firewall_ports }}" 33 | 34 | - name: Open firewall ports 35 | # shell: 'sudo systemctl disable ufw' 36 | shell: | 37 | # Opening ports for Control Plane 38 | sudo ufw allow 6443/tcp 39 | sudo ufw allow 2379:2380/tcp 40 | sudo ufw allow 10250/tcp 41 | sudo ufw allow 10259/tcp 42 | sudo ufw allow 10257/tcp 43 | # Opening ports for Calico CNI 44 | sudo ufw allow 179/tcp 45 | sudo ufw allow 4789/udp 46 | sudo ufw allow 4789/tcp 47 | sudo ufw allow 2379/tcp -------------------------------------------------------------------------------- /virtualbox-kubespray/node-config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # cofigure kubernetes nodes with users and access 3 | 4 | - hosts: all 5 | become: true 6 | vars_files: 7 | vars: 8 | remote_user_name: devops 9 | # remote_user_public_key_file: '~/.ssh/id_rsa.pub' 10 | # #remote_user_public_key: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDPCgWXeSm2t9XJrvCMPMpr0TmhOvnS0e0kax05EeSLXTc98dv4ewP+9Mvc2Vl+2LifAK/FXZlpzexQugnHJ8oUbfjxiD0ZEQQhpV1pLkHp4zDyl4p+fneMtahCYhqkI0YPpN/RCGTxrWxppc65NXaHOGvt9O7bKJCQyR0LvUHbXUw4dqgd5OB2FxL6h0hbe4XxFgJ3Cl7GlSDe3ly14Tdh4ZdvqDxAbtGly1q9HHInWhBxFOpIFrKmN7d6+NhiJK0i5/a8MMmAaGvI0x5pSmM5Ehg+sns11gnt8tvt8MLdHI2SuTiBDLepkgF5CPc2lScH/lkiUbmvqIVKYlddhuKR devops@vm-towernode-10.lab.local' 11 | # remote_user_public_key: "{{lookup('file', remote_user_public_key_file )}}" 12 | 13 | tasks: 14 | - name: Create new user on managed node 15 | user: 16 | name: "{{ remote_user_name }}" 17 | groups: wheel 18 | append: yes 19 | 20 | # - name: Add key to managed node 21 | # authorized_key: 22 | # user: "{{ remote_user_name }}" 23 | # key: "{{ remote_user_public_key }}" 24 | # manage_dir: yes 25 | 26 | - name: Add sudo entries for new user 27 | copy: 28 | content: "{{ remote_user_name }} ALL=(ALL) NOPASSWD: ALL" 29 | dest: "/etc/sudoers.d/{{ remote_user_name }}" 30 | 31 | - name: Configure Hostname 32 | hostname: 33 | name: "{{ inventory_hostname }}" -------------------------------------------------------------------------------- /virtualbox-wordpress-dev/provision/playbooks/templates/vccw.sh: -------------------------------------------------------------------------------- 1 | # 2 | # Environments settings for the VCCW 3 | # 4 | 5 | # For WP-CLI package tests 6 | export WP_CLI_BIN_DIR=/tmp/wp-cli-phar 7 | 8 | # For wp plugin's unit testing 9 | export WP_TESTS_DIR=/tmp/wordpress-tests-lib 10 | export WP_CORE_DIR=/tmp/wordpress/ 11 | 12 | export COMPOSER_HOME=$HOME/.composer 13 | export PATH=$HOME/.composer/vendor/bin:$PATH 14 | export PATH=$HOME/.npm-packages/bin:$PATH 15 | 16 | if which ruby >/dev/null && which gem >/dev/null; then 17 | PATH="$(ruby -rubygems -e 'puts Gem.user_dir')/bin:$PATH" 18 | fi 19 | 20 | if which phpcs >/dev/null; then 21 | alias wpcs="phpcs --standard=WordPress" 22 | fi 23 | 24 | if [ -e $HOME/.wp-i18n/makepot.php ]; then 25 | alias makepot="/usr/bin/env php $HOME/.wp-i18n/makepot.php" 26 | fi 27 | 28 | # For wp plugin's unit testing 29 | function install-wp-tests { 30 | set -ex; 31 | 32 | echo 'DROP DATABASE IF EXISTS wordpress_test;' | mysql -u root 33 | 34 | if [ -e /tmp/wordpress ]; then 35 | rm -fr /tmp/wordpress 36 | fi 37 | 38 | if [ -e /tmp/wordpress-tests-lib ]; then 39 | rm -fr /tmp/wordpress-tests-lib 40 | fi 41 | 42 | bash bin/install-wp-tests.sh wordpress_test root 'wordpress' localhost latest; 43 | } 44 | 45 | # For WP-CLI package tests 46 | function install-package-tests { 47 | echo 'GRANT ALL PRIVILEGES ON wp_cli_test.* TO "wp_cli_test"@"localhost" IDENTIFIED BY "password1";' | mysql -u root 48 | } 49 | -------------------------------------------------------------------------------- /virtualbox-minikube/Vagrantfile: -------------------------------------------------------------------------------- 1 | #IMAGE_NAME = "centos/7" 2 | #NODE_NAME = "centos-minikube" 3 | IMAGE_NAME = "fedora/38-cloud-base" 4 | NODE_NAME = "fedora-minikube" 5 | 6 | 7 | Vagrant.configure("2") do |config| 8 | #config.ssh.insert_key = false 9 | 10 | config.vm.provider "virtualbox" do |v| 11 | v.memory = 4096 12 | v.cpus = 2 13 | end 14 | config.vm.synced_folder "./", "/home/vagrant" 15 | config.ssh.insert_key = true 16 | config.ssh.forward_agent = true 17 | 18 | config.vm.network "forwarded_port", 19 | guest: 8001, 20 | host: 8001, 21 | auto_correct: true 22 | 23 | config.vm.network "forwarded_port", 24 | guest: 30000, 25 | host: 30000, 26 | auto_correct: true 27 | 28 | config.vm.network "forwarded_port", 29 | guest: 8443, 30 | host: 8443, 31 | auto_correct: true 32 | 33 | config.vm.define NODE_NAME do |master| 34 | 35 | master.vm.box = IMAGE_NAME 36 | #master.vm.network "private_network", ip: "192.168.50.10" 37 | master.vm.network "private_network", ip: "192.168.100.10", virtualbox__intnet: "intnet" 38 | master.vm.hostname = NODE_NAME 39 | master.vm.provision "ansible_local" do |ansible| 40 | ansible.compatibility_mode = "2.0" 41 | ansible.playbook = "install-minikube.yaml" 42 | ansible.extra_vars = { 43 | node_ip: "192.168.50.10", 44 | } 45 | end 46 | end 47 | end -------------------------------------------------------------------------------- /virtualbox-sysadmin-rhel8/Vagrantfile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME = "generic/rhel8" 2 | VM_NAME = "SYSADMIN-RHEL8" 3 | NODES = 1 4 | 5 | Vagrant.configure("2") do |config| 6 | config.ssh.insert_key = false 7 | 8 | (1..NODES).each do |i| 9 | config.vm.define "#{VM_NAME}-#{i}" do |node| 10 | node.vm.box = IMAGE_NAME 11 | #node.vm.network "private_network", ip: "192.168.50.#{i + 20}", virtualbox__intnet: "intnet" 12 | 13 | ## add a host-only adaptor. 14 | ## Change this line as needed if your host-only network name is different :name => 'vboxnet0', , adapter : 2 15 | node.vm.network "private_network", type: "dhcp" 16 | node.vm.hostname = "#{VM_NAME}-#{i}" 17 | 18 | # VM customization 19 | node.vm.provider :virtualbox do |vb| 20 | vb.name = "#{VM_NAME}-#{i}" 21 | vb.memory = 1024 22 | vb.cpus = 2 23 | #vb.gui = true 24 | end 25 | 26 | # provisioning 27 | # adding host ssh key for direct ssh login 28 | node.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "host_ssh_public_key" 29 | node.vm.provision "shell", inline: <<-SHELL 30 | cat host_ssh_public_key >> /home/vagrant/.ssh/authorized_keys 31 | SHELL 32 | node.vm.provision "ansible" do |ansible| 33 | ansible.playbook = "files/node-config.yaml" 34 | end 35 | end 36 | end 37 | 38 | end -------------------------------------------------------------------------------- /virtualbox-pihole-ubuntu/Vagrantfile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME = "ubuntu/focal64" 2 | VM_NAME = "pihole" 3 | 4 | Vagrant.configure("2") do |config| 5 | config.ssh.insert_key = false 6 | 7 | #(1..NODES).each do |i| 8 | config.vm.define VM_NAME do |node| 9 | node.vm.box = IMAGE_NAME 10 | #node.vm.network "private_network", ip: "192.168.50.#{i + 20}", virtualbox__intnet: "intnet" 11 | 12 | # add WiFi interface as bridge 13 | node.vm.network "public_network", ip: "192.168.1.150", bridge: [ 14 | "en0: Wi-Fi (AirPort)", 15 | ] 16 | ## add a host-only adaptor. 17 | ## Change this line as needed if your host-only network name is different :name => 'vboxnet0', , adapter : 2 18 | node.vm.network "private_network", type: "dhcp" 19 | node.vm.hostname = VM_NAME 20 | 21 | # VM customization 22 | node.vm.provider :virtualbox do |vb| 23 | vb.name = VM_NAME 24 | vb.memory = 512 25 | vb.cpus = 1 26 | #vb.gui = true 27 | end 28 | 29 | # provisioning 30 | # adding host ssh key for direct ssh login 31 | node.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "host_ssh_public_key" 32 | node.vm.provision "shell", inline: <<-SHELL 33 | cat host_ssh_public_key >> /home/vagrant/.ssh/authorized_keys 34 | SHELL 35 | end 36 | # end 37 | 38 | end -------------------------------------------------------------------------------- /virtualbox-generic-rhel8-for-bau/Vagrantfile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME = "generic/rhel8" 2 | VM_NAME = "RHEL8-bau" 3 | NODES = 1 4 | 5 | Vagrant.configure("2") do |config| 6 | config.ssh.insert_key = false 7 | 8 | (1..NODES).each do |i| 9 | config.vm.define "#{VM_NAME}-#{i}" do |node| 10 | node.vm.box = IMAGE_NAME 11 | #node.vm.network "private_network", ip: "192.168.50.#{i + 20}", virtualbox__intnet: "intnet" 12 | 13 | ## add a host-only adaptor. 14 | ## Change this line as needed if your host-only network name is different :name => 'vboxnet0', , adapter : 2 15 | node.vm.network "private_network", type: "dhcp", 16 | name: 'vboxnet12', adapter: 2 17 | node.vm.hostname = "#{VM_NAME}-#{i}" 18 | 19 | # VM customization 20 | node.vm.provider :virtualbox do |vb| 21 | vb.name = "#{VM_NAME}-#{i}" 22 | vb.memory = 512 23 | vb.cpus = 1 24 | #vb.gui = true 25 | end 26 | 27 | # provisioning 28 | # adding host ssh key for direct ssh login 29 | node.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "host_ssh_public_key" 30 | node.vm.provision "shell", inline: <<-SHELL 31 | cat host_ssh_public_key >> /home/vagrant/.ssh/authorized_keys 32 | SHELL 33 | node.vm.provision "ansible" do |ansible| 34 | ansible.compatibility_mode = "2.0" 35 | ansible.playbook = "files/config.yaml" 36 | end 37 | end 38 | end 39 | 40 | end -------------------------------------------------------------------------------- /virtualbox-wordpress-dev/provision/playbooks/templates/site.conf: -------------------------------------------------------------------------------- 1 | 2 | ServerName {{ vccw.hostname }} 3 | ServerAlias *.{{ vccw.hostname }} 4 | 5 | DocumentRoot {{ vccw.document_root }} 6 | 7 | EnableSendfile off 8 | 9 | 10 | Options FollowSymLinks 11 | AllowOverride FileInfo Options Limit 12 | Order allow,deny 13 | Allow from all 14 | 15 | 16 | 17 | Options FollowSymLinks 18 | AllowOverride None 19 | 20 | 21 | LogLevel info 22 | ErrorLog /var/log/apache2/{{ vccw.hostname }}-error.log 23 | CustomLog /var/log/apache2/{{ vccw.hostname }}-access.log combined 24 | 25 | RewriteEngine On 26 | 27 | 28 | 29 | 30 | 31 | ServerName {{ vccw.hostname }} 32 | ServerAlias *.{{ vccw.hostname }} 33 | 34 | DocumentRoot {{ vccw.document_root }} 35 | 36 | EnableSendfile off 37 | 38 | 39 | Options FollowSymLinks 40 | AllowOverride FileInfo Options Limit 41 | Order allow,deny 42 | Allow from all 43 | 44 | 45 | 46 | Options FollowSymLinks 47 | AllowOverride None 48 | 49 | 50 | LogLevel info 51 | ErrorLog /var/log/apache2/{{ vccw.hostname }}-error.log 52 | CustomLog /var/log/apache2/{{ vccw.hostname }}-access.log combined 53 | 54 | RewriteEngine On 55 | SSLEngine On 56 | SSLCertificateFile /etc/apache2/ssl/{{ vccw.hostname }}.crt 57 | SSLCertificateKeyFile /etc/apache2/ssl/{{ vccw.hostname }}.key 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /virtualbox-rhel9-aap25/files/config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Configure nodes 3 | hosts: all 4 | become: true 5 | vars: 6 | remote_user_name: vagrant 7 | tasks: 8 | - name: Modify PasswordAuthentication setting in sshd_config 9 | ansible.builtin.replace: 10 | path: /etc/ssh/sshd_config 11 | regexp: '^PasswordAuthentication no' 12 | replace: 'PasswordAuthentication yes' 13 | 14 | - name: Restart SSH service 15 | ansible.builtin.systemd: 16 | name: sshd 17 | state: restarted 18 | 19 | - name: Create 'devops' user with password 20 | ansible.builtin.user: 21 | name: devops 22 | state: present 23 | password: "{{ 'devops' | password_hash('sha512') }}" 24 | 25 | - name: Allow 'devops' user to execute sudo without a password 26 | ansible.builtin.lineinfile: 27 | path: /etc/sudoers.d/devops 28 | line: "devops ALL=(ALL) NOPASSWD: ALL" 29 | create: true 30 | 31 | - name: Create the .ssh directory for devops user 32 | ansible.builtin.file: 33 | path: "/home/devops/.ssh" 34 | state: directory 35 | mode: '0700' 36 | owner: devops 37 | group: devops 38 | 39 | - name: Copy the id_rsa.pub key to authorized_keys for devops user 40 | ansible.builtin.copy: 41 | src: "~/.ssh/id_rsa.pub" 42 | dest: "/home/devops/.ssh/authorized_keys" 43 | owner: devops 44 | group: devops 45 | mode: '0600' 46 | append: yes 47 | 48 | - name: Update /etc/hosts with node entries 49 | ansible.builtin.blockinfile: 50 | path: /etc/hosts 51 | block: | 52 | # Test Block 53 | -------------------------------------------------------------------------------- /virtualbox-ansible-lab-special/files/nodes-sshd.sh: -------------------------------------------------------------------------------- 1 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 2 | sudo systemctl restart sshd 3 | 4 | sudo python3 -m pip install pip --upgrade 5 | #sudo su - devops && python3 -m pip install ansible --user 6 | 7 | # install git and vim 8 | sudo yum install -y vim git 9 | 10 | # add devops user 11 | sudo useradd devops 12 | echo -e 'devops\ndevops' | sudo passwd devops 13 | echo 'devops ALL=(ALL) NOPASSWD: ALL' | sudo tee /etc/sudoers.d/devops 14 | 15 | #echo '[ansible]' > /home/devops/inventory 16 | #echo 'ansible-engine ansible_host=${aws_instance.ansible-engine.private_dns} ansible_connection=local' >> /home/devops/inventory 17 | #echo '[nodes]' >> /home/devops/inventory 18 | #echo 'node ansible_host=182.168.100.4' >> /home/devops/inventory 19 | #echo 'node2 ansible_host=${aws_instance.ansible-nodes[1].private_dns}' >> /home/devops/inventory 20 | #echo '' >> /home/devops/inventory 21 | #echo '[all:vars]' >> /home/devops/inventory 22 | #echo 'ansible_user=devops' >> /home/devops/inventory 23 | #echo 'ansible_password=devops' >> /home/devops/inventory 24 | #echo 'ansible_connection=ssh' >> /home/devops/inventory 25 | #echo '#ansible_python_interpreter=/usr/bin/python3' >> /home/devops/inventory 26 | #echo 'ansible_ssh_private_key_file=/home/devops/.ssh/id_rsa' >> /home/devops/inventory 27 | #echo \"ansible_ssh_extra_args=' -o StrictHostKeyChecking=no -o PreferredAuthentications=password '\" >> /home/devops/inventory 28 | #echo '[defaults]' >> /home/devops/ansible.cfg 29 | #echo 'inventory = ./inventory' >> /home/devops/ansible.cfg 30 | #echo 'host_key_checking = False' >> /home/devops/ansible.cfg 31 | #echo 'remote_user = devops' >> /home/devops/ansible.cfg -------------------------------------------------------------------------------- /virtualbox-sysadmin-rhel8/files/nodes-sshd.sh: -------------------------------------------------------------------------------- 1 | sudo sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config 2 | sudo systemctl restart sshd 3 | 4 | sudo python3 -m pip install pip --upgrade 5 | #sudo su - devops && python3 -m pip install ansible --user 6 | 7 | # install git and vim 8 | sudo yum install -y vim git 9 | 10 | # add devops user 11 | sudo useradd devops 12 | echo -e 'devops\ndevops' | sudo passwd devops 13 | echo 'devops ALL=(ALL) NOPASSWD: ALL' | sudo tee /etc/sudoers.d/devops 14 | 15 | #echo '[ansible]' > /home/devops/inventory 16 | #echo 'ansible-engine ansible_host=${aws_instance.ansible-engine.private_dns} ansible_connection=local' >> /home/devops/inventory 17 | #echo '[nodes]' >> /home/devops/inventory 18 | #echo 'SYSADMIN-RHEL8 ansible_host=182.168.100.4' >> /home/devops/inventory 19 | #echo 'node2 ansible_host=${aws_instance.ansible-nodes[1].private_dns}' >> /home/devops/inventory 20 | #echo '' >> /home/devops/inventory 21 | #echo '[all:vars]' >> /home/devops/inventory 22 | #echo 'ansible_user=devops' >> /home/devops/inventory 23 | #echo 'ansible_password=devops' >> /home/devops/inventory 24 | #echo 'ansible_connection=ssh' >> /home/devops/inventory 25 | #echo '#ansible_python_interpreter=/usr/bin/python3' >> /home/devops/inventory 26 | #echo 'ansible_ssh_private_key_file=/home/devops/.ssh/id_rsa' >> /home/devops/inventory 27 | #echo \"ansible_ssh_extra_args=' -o StrictHostKeyChecking=no -o PreferredAuthentications=password '\" >> /home/devops/inventory 28 | #echo '[defaults]' >> /home/devops/ansible.cfg 29 | #echo 'inventory = ./inventory' >> /home/devops/ansible.cfg 30 | #echo 'host_key_checking = False' >> /home/devops/ansible.cfg 31 | #echo 'remote_user = devops' >> /home/devops/ansible.cfg -------------------------------------------------------------------------------- /virtualbox-minikube/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Welcome to <strong>minikube</strong> Start Page 7 | 8 | 9 |
10 |

minikube

11 | 12 |

Configured using Vagrant and Ansible on top of VirtuakBox

13 | 14 |

15 | Access dashboard : Kubernetes Dashboard WebUI 16 |

17 | 18 |

19 | Take Token from vagrant up output and login with token. 20 |

21 |

22 | Please note, token is a single line text and no line break should be included. 23 |

24 | 25 | 26 |

Sample output for reference

27 | 28 | TASK [Use below token to authenticate in kubernetes dashboard"] ************
29 | ok: [centos-minikube] => {
30 | "msg":
"eyJhbGciOiJSUzßI1NiIsImtpZCI6IklyLTdpd0UzZzRCZ2s3U1cxOTlOUG
31 | tGcVlGQ21wMkYzZGtWdWk4T0dNSm8ifQeyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2Nv
32 | .
33 | .[truncated output]
34 | .
35 | Vw6IML2NCdtCe2dGIEv2lC654ji5GRGhk1-fvytTSgTFzGW20gMhOAaZYHAdGYghytuzAEvB
HhMIKSIxqojPacr3Mr2xLx0ipwI_c5JUIqPgdN77pBvbjXVuzJ0kRxW1Fw"
36 | }
37 |
38 |

39 | 40 |

41 | iamgini.com | YouTube 42 | 43 |
44 | 45 | 46 | -------------------------------------------------------------------------------- /virtualbox-minikube/minikube/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Welcome to <strong>minikube</strong> Start Page 7 | 8 | 9 |
10 |

minikube

11 | 12 |

Configured using Vagrant and Ansible on top of VirtuakBox

13 | 14 |

15 | Access dashboard : Kubernetes Dashboard WebUI 16 |

17 | 18 |

19 | Take Token from vagrant up output and login with token. 20 |

21 |

22 | Please note, token is a single line text and no line break should be included. 23 |

24 | 25 | 26 |

Sample output for reference

27 | 28 | TASK [Use below token to authenticate in kubernetes dashboard"] ************
29 | ok: [centos-minikube] => {
30 | "msg":
"eyJhbGciOiJSUzßI1NiIsImtpZCI6IklyLTdpd0UzZzRCZ2s3U1cxOTlOUG
31 | tGcVlGQ21wMkYzZGtWdWk4T0dNSm8ifQeyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2Nv
32 | .
33 | .[truncated output]
34 | .
35 | Vw6IML2NCdtCe2dGIEv2lC654ji5GRGhk1-fvytTSgTFzGW20gMhOAaZYHAdGYghytuzAEvB
HhMIKSIxqojPacr3Mr2xLx0ipwI_c5JUIqPgdN77pBvbjXVuzJ0kRxW1Fw"
36 | }
37 |
38 |

39 | 40 |

41 | iamgini.com | YouTube 42 | 43 |
44 | 45 | 46 | -------------------------------------------------------------------------------- /virtualbox-rhel7-satellite/Vagrantfile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME = "generic/rhel8" 2 | VM_NAME = "RHEL7-Satellite" 3 | NODES = 1 4 | 5 | Vagrant.configure("2") do |config| 6 | config.ssh.insert_key = false 7 | 8 | (1..NODES).each do |i| 9 | config.vm.define "#{VM_NAME}-#{i}" do |node| 10 | node.vm.box = IMAGE_NAME 11 | #node.vm.network "private_network", ip: "192.168.50.#{i + 20}", virtualbox__intnet: "intnet" 12 | 13 | ## add a host-only adaptor. 14 | ## Change this line as needed if your host-only network name is different :name => 'vboxnet0', , adapter : 2 15 | #node.vm.network "private_network", type: "dhcp", 16 | # name: 'vboxnet12', adapter: 2 17 | 18 | #type: "dhcp", 19 | node.vm.network "private_network", 20 | name: 'vboxnet0', 21 | adapter: 2, 22 | ip: "192.168.56.110" 23 | 24 | node.vm.hostname = "#{VM_NAME}-#{i}" 25 | 26 | # VM customization 27 | node.vm.provider :virtualbox do |vb| 28 | vb.name = "#{VM_NAME}-#{i}" 29 | vb.memory = 8096 30 | vb.cpus = 4 31 | #vb.gui = true 32 | end 33 | 34 | # provisioning 35 | # adding host ssh key for direct ssh login 36 | node.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "host_ssh_public_key" 37 | node.vm.provision "shell", inline: <<-SHELL 38 | cat host_ssh_public_key >> /home/vagrant/.ssh/authorized_keys 39 | SHELL 40 | node.vm.provision "ansible" do |ansible| 41 | ansible.compatibility_mode = "2.0" 42 | ansible.playbook = "files/config.yaml" 43 | end 44 | end 45 | end 46 | 47 | end -------------------------------------------------------------------------------- /aws-web-demo/Vagrantfile: -------------------------------------------------------------------------------- 1 | # Require the AWS provider plugin 2 | require 'vagrant-aws' 3 | 4 | # Create and configure the AWS instance(s) 5 | Vagrant.configure('2') do |config| 6 | 7 | # Since we are using AWS AMI, below config.vm.box is just for syntax purpose. 8 | config.vm.box = 'perconajayj/centos-x86_64' 9 | 10 | # config.vm.hostname is not mandatory as AWS will handle the same. 11 | # config.vm.hostname = "webserver101" 12 | 13 | # Specify AWS provider configurations 14 | config.vm.provider 'aws' do |aws, override| 15 | 16 | # vagrant-aws plugin will read AWS authentication information 17 | # 1) from environment variables or 18 | # 2) from AWS credentials under $HOME/.aws/ 19 | # We have configured option 2 here, so just need to mention which profile to use. 20 | 21 | # aws.access_key_id = ENV['AWS_ACCESS_KEY_ID'] 22 | # aws.secret_access_key = ENV['AWS_SECRET_ACCESS_KEY'] 23 | aws.aws_profile = "devops" 24 | 25 | # Specify AWS SSH keypair to use 26 | aws.keypair_name = 'pe-20181226-us-west-2' 27 | 28 | # Specify AWS instance type to use 29 | aws.instance_type = 't2.micro' 30 | 31 | # Specify AWS region 32 | aws.region = 'us-west-2' 33 | 34 | # Specify AWS AMI ID 35 | aws.ami = 'ami-0bbe6b35405ecebdb' # Ubuntu Server 18.04 LTS (HVM) 36 | 37 | # Specify AWS security group(s). Make sure you have ssh, http, https enabled for the same. 38 | aws.security_groups = ['secgrp-for-web'] 39 | 40 | # Specify username and private key path 41 | override.ssh.username = 'ubuntu' 42 | override.ssh.private_key_path = '~/.ssh/pe-20181226-us-west-2.pem' 43 | end 44 | 45 | # Specify Ansible as provisioner and provide the playbook details. 46 | config.vm.provision "ansible_local" do |ansible| 47 | ansible.verbose = "v" 48 | ansible.playbook = "../playbooks/deploy-infra.yaml" 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /virtualbox-rhel8-kvm/Vagrantfile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME = "generic/rhel8" 2 | VM_NAME = "ovirt-engine" 3 | NODES = 1 4 | 5 | Vagrant.configure("2") do |config| 6 | config.ssh.insert_key = false 7 | 8 | (1..NODES).each do |i| 9 | config.vm.define "#{VM_NAME}-#{i}" do |node| 10 | node.vm.box = IMAGE_NAME 11 | #node.vm.network "private_network", ip: "192.168.50.#{i + 20}", virtualbox__intnet: "intnet" 12 | 13 | ## add a host-only adaptor. 14 | ## Change this line as needed if your host-only network name is different :name => 'vboxnet0', , adapter : 2 15 | node.vm.network "private_network", type: "dhcp" 16 | node.vm.hostname = "#{VM_NAME}-#{i}" 17 | 18 | # VM customization 19 | node.vm.provider :virtualbox do |vb| 20 | vb.name = "#{VM_NAME}-#{i}" 21 | vb.memory = 4096 22 | vb.cpus = 1 23 | #vb.gui = true 24 | 25 | ## enable nested virtualization for KVM VM 26 | ## https://github.com/hashicorp/vagrant/issues/11726 27 | vb.customize ["modifyvm", :id, "--nested-hw-virt", "on"] 28 | end 29 | 30 | # provisioning 31 | # adding host ssh key for direct ssh login 32 | node.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "host_ssh_public_key" 33 | node.vm.provision "shell", inline: <<-SHELL 34 | cat host_ssh_public_key >> /home/vagrant/.ssh/authorized_keys 35 | SHELL 36 | node.vm.provision "ansible" do |ansible| 37 | ansible.compatibility_mode = "2.0" 38 | ansible.playbook = "files/node-config.yaml" 39 | ansible.extra_vars = { 40 | node_ip: "192.168.100.10", 41 | } 42 | end 43 | end 44 | end 45 | 46 | end -------------------------------------------------------------------------------- /virtualbox-rhel8-vscode/Vagrantfile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME = "generic/rhel8" 2 | VM_NAME = "RHEL8-VSCode" 3 | NODES = 1 4 | 5 | Vagrant.configure("2") do |config| 6 | config.ssh.insert_key = false 7 | 8 | # (1..NODES).each do |i| 9 | config.vm.define "#{VM_NAME}" do |node| 10 | node.vm.box = IMAGE_NAME 11 | #node.vm.network "private_network", ip: "192.168.50.#{i + 20}", virtualbox__intnet: "intnet" 12 | 13 | ## add a host-only adaptor. 14 | ## Change this line as needed if your host-only network name is different :name => 'vboxnet0', , adapter : 2 15 | #node.vm.network "private_network", type: "dhcp", 16 | # name: 'vboxnet12', adapter: 2 17 | 18 | #type: "dhcp", 19 | node.vm.network "private_network", ip: "192.168.57.180" 20 | 21 | #name: 'vboxnet0', 22 | #type: "dhcp" 23 | #adapter: 2 24 | 25 | #ip: "192.168.56.102" 26 | 27 | # set hostname 28 | node.vm.hostname = "#{VM_NAME}" 29 | 30 | # VM customization 31 | node.vm.provider :virtualbox do |vb| 32 | #vb.name = "#{VM_NAME}-#{i}" 33 | vb.memory = 512 34 | vb.cpus = 1 35 | #vb.gui = true 36 | end 37 | 38 | # provisioning 39 | # adding host ssh key for direct ssh login 40 | node.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "host_ssh_public_key" 41 | node.vm.provision "shell", inline: <<-SHELL 42 | cat host_ssh_public_key >> /home/vagrant/.ssh/authorized_keys 43 | SHELL 44 | node.vm.provision "ansible" do |ansible| 45 | ansible.compatibility_mode = "2.0" 46 | ansible.playbook = "files/config.yaml" 47 | end 48 | end 49 | # end 50 | 51 | end -------------------------------------------------------------------------------- /virtualbox-sysadmin-rhel8/files/node-config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # cofigure kubernetes nodes with users and access 3 | 4 | - hosts: all 5 | become: true 6 | 7 | vars: 8 | local_user_name: ansible 9 | local_user_password: ansible 10 | key_pair_path: /tmp/id_ssh_rsa 11 | remote_user_name: devops 12 | remote_user_password: devops 13 | 14 | tasks: 15 | - name: Create {{ local_user_name }} user on ansible node 16 | user: 17 | name: "{{ local_user_name }}" 18 | password: "{{ local_user_password }}" 19 | #password: "{{ local_user_password | password_hash('sha512') }}" 20 | groups: wheel 21 | append: yes 22 | when: inventory_hostname == 'ansible' 23 | 24 | - name: Add sudo entries for {{ local_user_name }} 25 | copy: 26 | content: "{{ local_user_name }} ALL=(ALL) NOPASSWD: ALL" 27 | dest: "/etc/sudoers.d/{{ local_user_name }}" 28 | when: inventory_hostname == 'ansible' 29 | 30 | - name: Add .ssh directories 31 | file: 32 | path: /home/{{ local_user_name }}/.ssh 33 | state: directory 34 | mode: 0700 35 | owner: "{{ local_user_name }}" 36 | group: "{{ local_user_name }}" 37 | when: inventory_hostname == 'ansible' 38 | 39 | - name: Generate an OpenSSH keypair 40 | community.crypto.openssh_keypair: 41 | path: "{{ key_pair_path }}" 42 | size: 4096 43 | type: rsa 44 | comment: "ansible@ansible" 45 | delegate_to: localhost 46 | become: false 47 | when: inventory_hostname == 'ansible' 48 | 49 | - name: Copy key-pair to {{ local_user_name }} home 50 | copy: 51 | src: "{{ item }}" 52 | dest: "/home/{{ local_user_name }}/.ssh/{{ item | basename }}" 53 | mode: '0600' 54 | force: yes 55 | with_items: 56 | - "{{ key_pair_path }}" 57 | - "{{ key_pair_path }}.pub" 58 | when: inventory_hostname == 'ansible' -------------------------------------------------------------------------------- /virtualbox-rhel7-generic/Vagrantfile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME = "generic/rhel7" 2 | VM_NAME = "RHEL7-Generic" 3 | NODES = 1 4 | 5 | Vagrant.configure("2") do |config| 6 | config.ssh.insert_key = false 7 | 8 | (1..NODES).each do |i| 9 | config.vm.define "#{VM_NAME}-#{i}" do |node| 10 | node.vm.box = IMAGE_NAME 11 | #node.vm.network "private_network", ip: "192.168.50.#{i + 20}", virtualbox__intnet: "intnet" 12 | 13 | ## add a host-only adaptor. 14 | ## Change this line as needed if your host-only network name is different :name => 'vboxnet0', , adapter : 2 15 | #node.vm.network "private_network", type: "dhcp", 16 | # name: 'vboxnet12', adapter: 2 17 | 18 | #type: "dhcp", 19 | node.vm.network "private_network", ip: "192.168.57.92" 20 | #node.vm.network "private_network", 21 | # name: 'vboxnet0', 22 | # adapter: 2, 23 | # ip: "192.168.56.103" 24 | 25 | node.vm.hostname = "#{VM_NAME}-#{i}" 26 | 27 | # VM customization 28 | node.vm.provider :virtualbox do |vb| 29 | vb.name = "#{VM_NAME}-#{i}" 30 | vb.memory = 512 31 | vb.cpus = 1 32 | #vb.gui = true 33 | end 34 | 35 | # provisioning 36 | # adding host ssh key for direct ssh login 37 | node.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "host_ssh_public_key" 38 | node.vm.provision "shell", inline: <<-SHELL 39 | cat host_ssh_public_key >> /home/vagrant/.ssh/authorized_keys 40 | SHELL 41 | node.vm.provision "ansible" do |ansible| 42 | ansible.compatibility_mode = "2.0" 43 | ansible.playbook = "files/config.yaml" 44 | end 45 | end 46 | end 47 | 48 | end -------------------------------------------------------------------------------- /virtualbox-rhel8-kvm/files/node-config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # cofigure kubernetes nodes with users and access 3 | 4 | - hosts: all 5 | become: true 6 | 7 | vars: 8 | local_user_name: ansible 9 | local_user_password: ansible 10 | key_pair_path: /tmp/id_ssh_rsa 11 | remote_user_name: devops 12 | remote_user_password: devops 13 | 14 | tasks: 15 | - name: Create {{ local_user_name }} user on ansible node 16 | user: 17 | name: "{{ local_user_name }}" 18 | password: "{{ local_user_password }}" 19 | #password: "{{ local_user_password | password_hash('sha512') }}" 20 | groups: wheel 21 | append: yes 22 | when: inventory_hostname == 'ansible' 23 | 24 | #- name: Add sudo entries for {{ local_user_name }} 25 | # copy: 26 | # content: "{{ local_user_name }} ALL=(ALL) NOPASSWD: ALL" 27 | # dest: "/etc/sudoers.d/{{ local_user_name }}" 28 | # when: inventory_hostname == 'ansible' 29 | # 30 | #- name: Add .ssh directories 31 | # file: 32 | # path: /home/{{ local_user_name }}/.ssh 33 | # state: directory 34 | # mode: 0700 35 | # owner: "{{ local_user_name }}" 36 | # group: "{{ local_user_name }}" 37 | # when: inventory_hostname == 'ansible' 38 | # 39 | #- name: Generate an OpenSSH keypair 40 | # community.crypto.openssh_keypair: 41 | # path: "{{ key_pair_path }}" 42 | # size: 4096 43 | # type: rsa 44 | # comment: "ansible@ansible" 45 | # delegate_to: localhost 46 | # become: false 47 | # when: inventory_hostname == 'ansible' 48 | # 49 | #- name: Copy key-pair to {{ local_user_name }} home 50 | # copy: 51 | # src: "{{ item }}" 52 | # dest: "/home/{{ local_user_name }}/.ssh/{{ item | basename }}" 53 | # mode: '0600' 54 | # force: yes 55 | # with_items: 56 | # - "{{ key_pair_path }}" 57 | # - "{{ key_pair_path }}.pub" 58 | # when: inventory_hostname == 'ansible' -------------------------------------------------------------------------------- /virtualbox-rhel8-2024/Vagrantfile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME = "generic/rhel8" 2 | VM_NAME = "RHEL8-202407" 3 | NODES = 1 4 | 5 | Vagrant.configure("2") do |config| 6 | config.ssh.insert_key = false 7 | 8 | (1..NODES).each do |i| 9 | config.vm.define "#{VM_NAME}-#{i}" do |node| 10 | node.vm.box = IMAGE_NAME 11 | #node.vm.network "private_network", ip: "192.168.50.#{i + 20}", virtualbox__intnet: "intnet" 12 | 13 | ## add a host-only adaptor. 14 | ## Change this line as needed if your host-only network name is different :name => 'vboxnet0', , adapter : 2 15 | #node.vm.network "private_network", type: "dhcp", 16 | # name: 'vboxnet12', adapter: 2 17 | 18 | #type: "dhcp", 19 | node.vm.network "private_network", ip: "192.168.57.91" 20 | #type: "dhcp", 21 | #name: 'vboxnet0' 22 | 23 | #name: 'vboxnet0', 24 | #type: "dhcp" 25 | #adapter: 2 26 | 27 | #ip: "192.168.56.102" 28 | 29 | # set hostname 30 | node.vm.hostname = "#{VM_NAME}-#{i}" 31 | 32 | # VM customization 33 | node.vm.provider :virtualbox do |vb| 34 | #vb.name = "#{VM_NAME}-#{i}" 35 | vb.memory = 512 36 | vb.cpus = 1 37 | #vb.gui = true 38 | end 39 | 40 | # provisioning 41 | # adding host ssh key for direct ssh login 42 | node.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "host_ssh_public_key" 43 | node.vm.provision "shell", inline: <<-SHELL 44 | cat host_ssh_public_key >> /home/vagrant/.ssh/authorized_keys 45 | SHELL 46 | node.vm.provision "ansible" do |ansible| 47 | ansible.compatibility_mode = "2.0" 48 | ansible.playbook = "files/config.yaml" 49 | end 50 | end 51 | end 52 | 53 | end -------------------------------------------------------------------------------- /virtualbox-rhel8-generic/Vagrantfile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME = "generic/rhel8" 2 | VM_NAME = "RHEL8-Sub" 3 | NODES = 1 4 | 5 | Vagrant.configure("2") do |config| 6 | config.ssh.insert_key = false 7 | 8 | (1..NODES).each do |i| 9 | config.vm.define "#{VM_NAME}-#{i}" do |node| 10 | node.vm.box = IMAGE_NAME 11 | #node.vm.network "private_network", ip: "192.168.50.#{i + 20}", virtualbox__intnet: "intnet" 12 | 13 | ## add a host-only adaptor. 14 | ## Change this line as needed if your host-only network name is different :name => 'vboxnet0', , adapter : 2 15 | #node.vm.network "private_network", type: "dhcp", 16 | # name: 'vboxnet12', adapter: 2 17 | 18 | #type: "dhcp", 19 | node.vm.network "private_network", ip: "192.168.57.91" 20 | #type: "dhcp", 21 | #name: 'vboxnet0' 22 | 23 | #name: 'vboxnet0', 24 | #type: "dhcp" 25 | #adapter: 2 26 | 27 | #ip: "192.168.56.102" 28 | 29 | # set hostname 30 | node.vm.hostname = "#{VM_NAME}-#{i}" 31 | 32 | # VM customization 33 | node.vm.provider :virtualbox do |vb| 34 | #vb.name = "#{VM_NAME}-#{i}" 35 | vb.memory = 512 36 | vb.cpus = 1 37 | #vb.gui = true 38 | end 39 | 40 | # provisioning 41 | # adding host ssh key for direct ssh login 42 | node.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "host_ssh_public_key" 43 | node.vm.provision "shell", inline: <<-SHELL 44 | cat host_ssh_public_key >> /home/vagrant/.ssh/authorized_keys 45 | SHELL 46 | node.vm.provision "ansible" do |ansible| 47 | ansible.compatibility_mode = "2.0" 48 | ansible.playbook = "files/config.yaml" 49 | end 50 | end 51 | end 52 | 53 | end -------------------------------------------------------------------------------- /virtualbox-rhel8-jboss/Vagrantfile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME = "generic/rhel8" 2 | VM_NAME = "RHEL8-Generic" 3 | NODES = 1 4 | 5 | Vagrant.configure("2") do |config| 6 | config.ssh.insert_key = false 7 | 8 | (1..NODES).each do |i| 9 | config.vm.define "#{VM_NAME}-#{i}" do |node| 10 | node.vm.box = IMAGE_NAME 11 | #node.vm.network "private_network", ip: "192.168.50.#{i + 20}", virtualbox__intnet: "intnet" 12 | 13 | ## add a host-only adaptor. 14 | ## Change this line as needed if your host-only network name is different :name => 'vboxnet0', , adapter : 2 15 | #node.vm.network "private_network", type: "dhcp", 16 | # name: 'vboxnet12', adapter: 2 17 | 18 | #type: "dhcp", 19 | node.vm.network "private_network", ip: "192.168.57.91" 20 | #type: "dhcp", 21 | #name: 'vboxnet0' 22 | 23 | #name: 'vboxnet0', 24 | #type: "dhcp" 25 | #adapter: 2 26 | 27 | #ip: "192.168.56.102" 28 | 29 | # set hostname 30 | node.vm.hostname = "#{VM_NAME}-#{i}" 31 | 32 | # VM customization 33 | node.vm.provider :virtualbox do |vb| 34 | #vb.name = "#{VM_NAME}-#{i}" 35 | vb.memory = 512 36 | vb.cpus = 1 37 | #vb.gui = true 38 | end 39 | 40 | # provisioning 41 | # adding host ssh key for direct ssh login 42 | node.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "host_ssh_public_key" 43 | node.vm.provision "shell", inline: <<-SHELL 44 | cat host_ssh_public_key >> /home/vagrant/.ssh/authorized_keys 45 | SHELL 46 | node.vm.provision "ansible" do |ansible| 47 | ansible.compatibility_mode = "2.0" 48 | ansible.playbook = "files/config.yaml" 49 | end 50 | end 51 | end 52 | 53 | end -------------------------------------------------------------------------------- /virtualbox-rhel8-eap/Vagrantfile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME = "generic/rhel8" 2 | VM_NAME = "RHEL8-EAP" 3 | NODES = 1 4 | 5 | Vagrant.configure("2") do |config| 6 | config.ssh.insert_key = false 7 | 8 | (1..NODES).each do |i| 9 | config.vm.define "#{VM_NAME}-#{i}" do |node| 10 | node.vm.box = IMAGE_NAME 11 | #node.vm.network "private_network", ip: "192.168.50.#{i + 20}", virtualbox__intnet: "intnet" 12 | 13 | ## add a host-only adaptor. 14 | ## Change this line as needed if your host-only network name is different :name => 'vboxnet0', , adapter : 2 15 | #node.vm.network "private_network", type: "dhcp", 16 | # name: 'vboxnet12', adapter: 2 17 | 18 | #type: "dhcp", 19 | node.vm.network "private_network", ip: "192.168.57.121" 20 | #type: "dhcp", 21 | #name: 'vboxnet0' 22 | 23 | #name: 'vboxnet0', 24 | #type: "dhcp" 25 | #adapter: 2 26 | 27 | #ip: "192.168.56.102" 28 | 29 | # set hostname 30 | node.vm.network "forwarded_port", guest: 22, host: 2021 31 | 32 | node.vm.hostname = "#{VM_NAME}-#{i}" 33 | 34 | # VM customization 35 | node.vm.provider :virtualbox do |vb| 36 | #vb.name = "#{VM_NAME}-#{i}" 37 | vb.memory = 512 38 | vb.cpus = 1 39 | #vb.gui = true 40 | end 41 | 42 | # provisioning 43 | node.vm.provision "shell", path: "files/nodes-sshd.sh" 44 | # adding host ssh key for direct ssh login 45 | node.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "host_ssh_public_key" 46 | node.vm.provision "shell", inline: <<-SHELL 47 | cat host_ssh_public_key >> /home/vagrant/.ssh/authorized_keys 48 | SHELL 49 | node.vm.provision "ansible" do |ansible| 50 | ansible.compatibility_mode = "2.0" 51 | ansible.playbook = "files/config.yaml" 52 | end 53 | end 54 | end 55 | 56 | end -------------------------------------------------------------------------------- /virtualbox-rhel8-aap24/Vagrantfile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME = "generic/rhel8" 2 | VM_NAME = "RHEL8-AAP24" 3 | NODES = 1 4 | 5 | Vagrant.configure("2") do |config| 6 | config.ssh.insert_key = false 7 | 8 | (1..NODES).each do |i| 9 | config.vm.define "#{VM_NAME}-#{i}" do |node| 10 | node.vm.box = IMAGE_NAME 11 | #node.vm.network "private_network", ip: "192.168.50.#{i + 20}", virtualbox__intnet: "intnet" 12 | 13 | ## add a host-only adaptor. 14 | ## Change this line as needed if your host-only network name is different :name => 'vboxnet0', , adapter : 2 15 | #node.vm.network "private_network", type: "dhcp", 16 | # name: 'vboxnet12', adapter: 2 17 | 18 | #type: "dhcp", 19 | node.vm.network "private_network", ip: "192.168.57.123" 20 | #type: "dhcp", 21 | #name: 'vboxnet0' 22 | 23 | #name: 'vboxnet0', 24 | #type: "dhcp" 25 | #adapter: 2 26 | 27 | #ip: "192.168.56.102" 28 | 29 | # set hostname 30 | node.vm.network "forwarded_port", guest: 22, host: 2021 31 | 32 | node.vm.hostname = "#{VM_NAME}-#{i}" 33 | 34 | # VM customization 35 | node.vm.provider :virtualbox do |vb| 36 | #vb.name = "#{VM_NAME}-#{i}" 37 | vb.memory = 512 38 | vb.cpus = 1 39 | #vb.gui = true 40 | end 41 | 42 | # provisioning 43 | node.vm.provision "shell", path: "files/nodes-sshd.sh" 44 | # adding host ssh key for direct ssh login 45 | node.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "host_ssh_public_key" 46 | node.vm.provision "shell", inline: <<-SHELL 47 | cat host_ssh_public_key >> /home/vagrant/.ssh/authorized_keys 48 | SHELL 49 | node.vm.provision "ansible" do |ansible| 50 | ansible.compatibility_mode = "2.0" 51 | ansible.playbook = "files/config.yaml" 52 | end 53 | end 54 | end 55 | 56 | end -------------------------------------------------------------------------------- /virtualbox-kubespray/Vagrantfile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME = "centos/7" 2 | MASTERS = 1 3 | NODES = 3 4 | 5 | Vagrant.configure("2") do |config| 6 | config.ssh.insert_key = false 7 | 8 | config.vm.provider "virtualbox" do |v| 9 | v.memory = 2048 10 | v.cpus = 1 11 | end 12 | 13 | (1..MASTERS).each do |i| 14 | config.vm.define "master-#{i}" do |master| 15 | master.vm.box = IMAGE_NAME 16 | master.vm.network "private_network", ip: "192.168.57.#{i + 100}" 17 | master.vm.hostname = "master-#{i}" 18 | 19 | # naming the virtualmachine 20 | master.vm.provider :virtualbox do |vb| 21 | vb.name = "master-#{i}" 22 | end 23 | # change ansible to ansible_local if you are running from windows, 24 | # so that vagrant will install ansible inside VM and run ansible playbooks 25 | # eg: master.vm.provision "ansible_local" do |ansible| 26 | master.vm.provision "ansible_local" do |ansible| 27 | ansible.compatibility_mode = "2.0" 28 | ansible.playbook = "node-config.yml" 29 | ansible.extra_vars = { 30 | node_ip: "192.168.50.#{i + 10}", 31 | } 32 | end 33 | end 34 | end 35 | 36 | (1..NODES).each do |i| 37 | config.vm.define "node-#{i}" do |node| 38 | node.vm.box = IMAGE_NAME 39 | node.vm.network "private_network", ip: "192.168.57.#{i + 110}" 40 | node.vm.hostname = "node-#{i}" 41 | 42 | # naming the virtualmachine 43 | node.vm.provider :virtualbox do |vb| 44 | vb.name = "node-#{i}" 45 | end 46 | 47 | # change ansible to ansible_local if you are running from windows, 48 | # so that vagrant will install ansible inside VM and run ansible playbooks 49 | # eg: node.vm.provision "ansible_local" do |ansible| 50 | node.vm.provision "ansible_local" do |ansible| 51 | ansible.compatibility_mode = "2.0" 52 | ansible.playbook = "node-config.yml" 53 | ansible.extra_vars = { 54 | node_ip: "192.168.50.#{i + 20}", 55 | } 56 | end 57 | end 58 | end 59 | end 60 | -------------------------------------------------------------------------------- /virtualbox-rhel9-generic/Vagrantfile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME = "generic/rhel9" 2 | VM_NAME = "rhel-9" 3 | NODES = 1 4 | 5 | Vagrant.configure("2") do |config| 6 | config.ssh.insert_key = false 7 | 8 | (1..NODES).each do |i| 9 | config.vm.define "#{VM_NAME}-#{i}" do |node| 10 | node.vm.box = IMAGE_NAME 11 | #node.vm.network "private_network", ip: "192.168.50.#{i + 20}", virtualbox__intnet: "intnet" 12 | 13 | ## add a host-only adaptor. 14 | ## Change this line as needed if your host-only network name is different :name => 'vboxnet0', , adapter : 2 15 | #node.vm.network "private_network", type: "dhcp", 16 | # name: 'vboxnet12', adapter: 2 17 | # adding hostonly network 18 | # node.vm.network "private_network", type: "dhcp", netmask: "255.255.255.0", dhcp_ip:"192.168.57.2", dhcp_lower: "192.168.57.100", :dhcp_upper=>"192.168.57.254" 19 | 20 | #type: "dhcp", 21 | # adding hostonly network 22 | # node.vm.network "private_network", type: "dhcp", netmask: "255.255.255.0", dhcp_ip:"192.168.57.2", dhcp_lower: "192.168.57.100", :dhcp_upper=>"192.168.57.254" 23 | # node.vm.network "private_network", type: "dhcp" 24 | # ip: "192.168.57.91" 25 | # type: "dhcp", 26 | #name: 'vboxnet0' 27 | 28 | #name: 'vboxnet0', 29 | #type: "dhcp" 30 | #adapter: 2 31 | 32 | #ip: "192.168.56.102" 33 | 34 | # set hostname 35 | node.vm.hostname = "#{VM_NAME}-#{i}" 36 | 37 | # VM customization 38 | node.vm.provider :virtualbox do |vb| 39 | vb.name = "#{VM_NAME}-#{i}" 40 | vb.memory = 512 41 | vb.cpus = 1 42 | #vb.gui = true 43 | end 44 | 45 | # provisioning 46 | # adding host ssh key for direct ssh login 47 | node.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "host_ssh_public_key" 48 | node.vm.provision "shell", inline: <<-SHELL 49 | cat host_ssh_public_key >> /home/vagrant/.ssh/authorized_keys 50 | SHELL 51 | node.vm.provision "ansible" do |ansible| 52 | # ansible.compatibility_mode = "2.0" 53 | ansible.playbook = "files/config.yaml" 54 | end 55 | end 56 | end 57 | 58 | end -------------------------------------------------------------------------------- /virtualbox-rhel9-aap/Vagrantfile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME = "generic/rhel9" 2 | VM_NAME = "aap-rhel-92" 3 | NODES = 1 4 | 5 | Vagrant.configure("2") do |config| 6 | config.ssh.insert_key = false 7 | 8 | (1..NODES).each do |i| 9 | config.vm.define "#{VM_NAME}-#{i}" do |node| 10 | node.vm.box = IMAGE_NAME 11 | #node.vm.network "private_network", ip: "192.168.50.#{i + 20}", virtualbox__intnet: "intnet" 12 | 13 | ## add a host-only adaptor. 14 | ## Change this line as needed if your host-only network name is different :name => 'vboxnet0', , adapter : 2 15 | #node.vm.network "private_network", type: "dhcp", 16 | # name: 'vboxnet12', adapter: 2 17 | # adding hostonly network 18 | # node.vm.network "private_network", type: "dhcp", netmask: "255.255.255.0", dhcp_ip:"192.168.57.2", dhcp_lower: "192.168.57.100", :dhcp_upper=>"192.168.57.254" 19 | 20 | #type: "dhcp", 21 | # adding hostonly network 22 | # node.vm.network "private_network", type: "dhcp", netmask: "255.255.255.0", dhcp_ip:"192.168.57.2", dhcp_lower: "192.168.57.100", :dhcp_upper=>"192.168.57.254" 23 | # node.vm.network "private_network", type: "dhcp" 24 | # ip: "192.168.57.91" 25 | # type: "dhcp", 26 | #name: 'vboxnet0' 27 | 28 | #name: 'vboxnet0', 29 | #type: "dhcp" 30 | #adapter: 2 31 | 32 | #ip: "192.168.56.102" 33 | 34 | # set hostname 35 | node.vm.hostname = "#{VM_NAME}-#{i}" 36 | 37 | # VM customization 38 | node.vm.provider :virtualbox do |vb| 39 | vb.name = "#{VM_NAME}-#{i}" 40 | vb.memory = 512 41 | vb.cpus = 1 42 | #vb.gui = true 43 | end 44 | 45 | # provisioning 46 | # adding host ssh key for direct ssh login 47 | node.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "host_ssh_public_key" 48 | node.vm.provision "shell", inline: <<-SHELL 49 | cat host_ssh_public_key >> /home/vagrant/.ssh/authorized_keys 50 | SHELL 51 | node.vm.provision "ansible" do |ansible| 52 | # ansible.compatibility_mode = "2.0" 53 | ansible.playbook = "files/config.yaml" 54 | end 55 | end 56 | end 57 | 58 | end -------------------------------------------------------------------------------- /gcp-wordpress/roles/makarenalabs.wordpress/templates/wp-config.php.j2: -------------------------------------------------------------------------------- 1 | > /home/vagrant/.ssh/authorized_keys 38 | SHELL 39 | 40 | # execute nodes-sshd.sh for configuring ssh. 41 | node.vm.provision :shell, path: "files/node-config.sh" 42 | 43 | # 1. Expecting the project directory conte available at /vagrant. 44 | # 2. Using ansible_local to avoid any additional ansible requirement on 45 | # host machine (eg: Windows). Vagrant will install ansible on target machine 46 | # and complete the initial configuration. 47 | #node.vm.provision "ansible" do |ansible| 48 | # ansible.compatibility_mode = "2.0" 49 | # ansible.playbook = "files/engine-config.yaml" 50 | # ansible.extra_vars = { 51 | # node_ip: "192.168.100.10", 52 | # } 53 | #end 54 | 55 | # execute nodes-init.yaml for configuring other ansible nodes. 56 | ## disabled for engine only setup 57 | ## node.vm.provision :shell, path: "files/nodes-init-playbook.sh" 58 | end 59 | 60 | end 61 | -------------------------------------------------------------------------------- /virtualbox-fedora-workstation/Vagrantfile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME = "fedora/38-cloud-base" 2 | VM_NAME = "fedora-ws" 3 | 4 | ## only needed if you are using ansible engine vm with bridged network 5 | #ANSILBE_ENGINE_IP = "192.168.1.185" 6 | 7 | Vagrant.configure("2") do |config| 8 | config.ssh.insert_key = false 9 | 10 | 11 | # create ansible controlnode 12 | config.vm.define "node" do |node| 13 | node.vm.box = IMAGE_NAME 14 | #node.vm.network "private_network", ip: "192.168.100.10", virtualbox__intnet: "intnet" 15 | # node.vm.network "private_network", type: "dhcp", 16 | # name: 'vboxnet12', adapter: 2 17 | ## Below interface has been disables as different machines will have different bridge interface. 18 | ## You can enable this back and use for additional bridged interface on ansible engine node. 19 | ## Choose options 1, 2 or 3 when it prompts, depends on the actual network interface on your laptop/workstation. 20 | #node.vm.network "public_network", ip: ANSILBE_ENGINE_IP 21 | 22 | node.vm.hostname = VM_NAME 23 | 24 | # naming the virtualmachine 25 | node.vm.provider :virtualbox do |vb| 26 | vb.name = VM_NAME 27 | vb.memory = 1024 28 | vb.cpus = 1 29 | # enable gui as MacOS Monterey got issue with headless vm 30 | # https://github.com/hashicorp/vagrant/issues/12557 31 | #vb.gui = true 32 | end 33 | 34 | # provisioning 35 | # adding host ssh key for direct ssh login 36 | node.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "host_ssh_public_key" 37 | node.vm.provision "shell", inline: <<-SHELL 38 | cat host_ssh_public_key >> /home/vagrant/.ssh/authorized_keys 39 | SHELL 40 | 41 | # execute nodes-sshd.sh for configuring ssh. 42 | node.vm.provision :shell, path: "files/node-config.sh" 43 | 44 | # 1. Expecting the project directory conte available at /vagrant. 45 | # 2. Using ansible_local to avoid any additional ansible requirement on 46 | # host machine (eg: Windows). Vagrant will install ansible on target machine 47 | # and complete the initial configuration. 48 | #node.vm.provision "ansible" do |ansible| 49 | # ansible.compatibility_mode = "2.0" 50 | # ansible.playbook = "files/engine-config.yaml" 51 | # ansible.extra_vars = { 52 | # node_ip: "192.168.100.10", 53 | # } 54 | #end 55 | 56 | # execute nodes-init.yaml for configuring other ansible nodes. 57 | ## disabled for engine only setup 58 | ## node.vm.provision :shell, path: "files/nodes-init-playbook.sh" 59 | end 60 | 61 | end 62 | -------------------------------------------------------------------------------- /virtualbox-cp-ubuntu/Vagrantfile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME = "bento/ubuntu-20.04" 2 | VM_NAME = "Ubuntu-20-CP" 3 | 4 | ## only needed if you are using ansible engine vm with bridged network 5 | #ANSILBE_ENGINE_IP = "192.168.1.185" 6 | 7 | Vagrant.configure("2") do |config| 8 | config.ssh.insert_key = false 9 | 10 | # create ansible controlnode 11 | config.vm.define "node" do |node| 12 | node.vm.box = IMAGE_NAME 13 | #node.vm.network "private_network", ip: "192.168.100.10", virtualbox__intnet: "intnet" 14 | node.vm.network "private_network", type: "dhcp", 15 | name: 'vboxnet12', adapter: 2 16 | ## Below interface has been disables as different machines will have different bridge interface. 17 | ## You can enable this back and use for additional bridged interface on ansible engine node. 18 | ## Choose options 1, 2 or 3 when it prompts, depends on the actual network interface on your laptop/workstation. 19 | #node.vm.network "public_network", ip: ANSILBE_ENGINE_IP 20 | 21 | node.vm.hostname = VM_NAME 22 | 23 | # naming the virtualmachine 24 | node.vm.provider :virtualbox do |vb| 25 | vb.name = VM_NAME 26 | vb.memory = 512 27 | vb.cpus = 1 28 | # enable gui as MacOS Monterey got issue with headless vm 29 | # https://github.com/hashicorp/vagrant/issues/12557 30 | #vb.gui = true 31 | end 32 | 33 | # provisioning 34 | # adding host ssh key for direct ssh login 35 | node.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "host_ssh_public_key" 36 | node.vm.provision "shell", inline: <<-SHELL 37 | cat host_ssh_public_key >> /home/vagrant/.ssh/authorized_keys 38 | SHELL 39 | 40 | # execute nodes-sshd.sh for configuring ssh. 41 | node.vm.provision :shell, path: "files/node-config.sh" 42 | 43 | # 1. Expecting the project directory conte available at /vagrant. 44 | # 2. Using ansible_local to avoid any additional ansible requirement on 45 | # host machine (eg: Windows). Vagrant will install ansible on target machine 46 | # and complete the initial configuration. 47 | #node.vm.provision "ansible" do |ansible| 48 | # ansible.compatibility_mode = "2.0" 49 | # ansible.playbook = "files/engine-config.yaml" 50 | # ansible.extra_vars = { 51 | # node_ip: "192.168.100.10", 52 | # } 53 | #end 54 | 55 | # execute nodes-init.yaml for configuring other ansible nodes. 56 | ## disabled for engine only setup 57 | ## node.vm.provision :shell, path: "files/nodes-init-playbook.sh" 58 | end 59 | 60 | end 61 | -------------------------------------------------------------------------------- /virtualbox-cp-fedora/Vagrantfile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME = "fedora/35-cloud-base" 2 | VM_NAME = "Fedora-35-CP" 3 | 4 | ## only needed if you are using ansible engine vm with bridged network 5 | #ANSILBE_ENGINE_IP = "192.168.1.185" 6 | 7 | Vagrant.configure("2") do |config| 8 | config.ssh.insert_key = false 9 | 10 | # create ansible controlnode 11 | config.vm.define "node" do |node| 12 | node.vm.box = IMAGE_NAME 13 | #node.vm.network "private_network", ip: "192.168.100.10", virtualbox__intnet: "intnet" 14 | node.vm.network "private_network", type: "dhcp", 15 | name: 'vboxnet12', adapter: 2 16 | ## Below interface has been disables as different machines will have different bridge interface. 17 | ## You can enable this back and use for additional bridged interface on ansible engine node. 18 | ## Choose options 1, 2 or 3 when it prompts, depends on the actual network interface on your laptop/workstation. 19 | #node.vm.network "public_network", ip: ANSILBE_ENGINE_IP 20 | 21 | node.vm.hostname = VM_NAME 22 | 23 | # naming the virtualmachine 24 | node.vm.provider :virtualbox do |vb| 25 | vb.name = VM_NAME 26 | vb.memory = 512 27 | vb.cpus = 1 28 | # enable gui as MacOS Monterey got issue with headless vm 29 | # https://github.com/hashicorp/vagrant/issues/12557 30 | #vb.gui = true 31 | end 32 | 33 | # provisioning 34 | # adding host ssh key for direct ssh login 35 | node.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "host_ssh_public_key" 36 | node.vm.provision "shell", inline: <<-SHELL 37 | cat host_ssh_public_key >> /home/vagrant/.ssh/authorized_keys 38 | SHELL 39 | 40 | # execute nodes-sshd.sh for configuring ssh. 41 | node.vm.provision :shell, path: "files/node-config.sh" 42 | 43 | # 1. Expecting the project directory conte available at /vagrant. 44 | # 2. Using ansible_local to avoid any additional ansible requirement on 45 | # host machine (eg: Windows). Vagrant will install ansible on target machine 46 | # and complete the initial configuration. 47 | #node.vm.provision "ansible" do |ansible| 48 | # ansible.compatibility_mode = "2.0" 49 | # ansible.playbook = "files/engine-config.yaml" 50 | # ansible.extra_vars = { 51 | # node_ip: "192.168.100.10", 52 | # } 53 | #end 54 | 55 | # execute nodes-init.yaml for configuring other ansible nodes. 56 | ## disabled for engine only setup 57 | ## node.vm.provision :shell, path: "files/nodes-init-playbook.sh" 58 | end 59 | 60 | end 61 | -------------------------------------------------------------------------------- /virtualbox-fedora/Vagrantfile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME = "fedora/34-cloud-base" 2 | VM_NAME = "fedora-34" 3 | 4 | ## only needed if you are using ansible engine vm with bridged network 5 | #ANSILBE_ENGINE_IP = "192.168.1.185" 6 | 7 | Vagrant.configure("2") do |config| 8 | config.ssh.insert_key = false 9 | 10 | 11 | # create ansible controlnode 12 | config.vm.define "node" do |node| 13 | node.vm.box = IMAGE_NAME 14 | #node.vm.network "private_network", ip: "192.168.100.10", virtualbox__intnet: "intnet" 15 | node.vm.network "private_network", type: "dhcp", 16 | name: 'vboxnet12', adapter: 2 17 | ## Below interface has been disables as different machines will have different bridge interface. 18 | ## You can enable this back and use for additional bridged interface on ansible engine node. 19 | ## Choose options 1, 2 or 3 when it prompts, depends on the actual network interface on your laptop/workstation. 20 | #node.vm.network "public_network", ip: ANSILBE_ENGINE_IP 21 | 22 | node.vm.hostname = VM_NAME 23 | 24 | # naming the virtualmachine 25 | node.vm.provider :virtualbox do |vb| 26 | vb.name = VM_NAME 27 | vb.memory = 1024 28 | vb.cpus = 1 29 | # enable gui as MacOS Monterey got issue with headless vm 30 | # https://github.com/hashicorp/vagrant/issues/12557 31 | #vb.gui = true 32 | end 33 | 34 | # provisioning 35 | # adding host ssh key for direct ssh login 36 | node.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "host_ssh_public_key" 37 | node.vm.provision "shell", inline: <<-SHELL 38 | cat host_ssh_public_key >> /home/vagrant/.ssh/authorized_keys 39 | SHELL 40 | 41 | # execute nodes-sshd.sh for configuring ssh. 42 | node.vm.provision :shell, path: "files/node-config.sh" 43 | 44 | # 1. Expecting the project directory conte available at /vagrant. 45 | # 2. Using ansible_local to avoid any additional ansible requirement on 46 | # host machine (eg: Windows). Vagrant will install ansible on target machine 47 | # and complete the initial configuration. 48 | #node.vm.provision "ansible" do |ansible| 49 | # ansible.compatibility_mode = "2.0" 50 | # ansible.playbook = "files/engine-config.yaml" 51 | # ansible.extra_vars = { 52 | # node_ip: "192.168.100.10", 53 | # } 54 | #end 55 | 56 | # execute nodes-init.yaml for configuring other ansible nodes. 57 | ## disabled for engine only setup 58 | ## node.vm.provision :shell, path: "files/nodes-init-playbook.sh" 59 | end 60 | 61 | end 62 | -------------------------------------------------------------------------------- /virtualbox-kubespray/Vagrantfile-new: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # # vi: set ft=ruby : 3 | 4 | Vagrant.require_version ">= 2.0.0" 5 | 6 | IMAGE_NAME = "centos/7" 7 | MASTERS = 1 8 | NODES = 2 9 | 10 | Vagrant.configure("2") do |config| 11 | config.ssh.insert_key = false 12 | 13 | config.vm.provider "virtualbox" do |v| 14 | v.memory = 2048 15 | v.cpus = 1 16 | end 17 | 18 | # ansible node 19 | config.vm.define "ansible-node" do |ans| 20 | ans.vm.box = IMAGE_NAME 21 | ans.vm.network "private_network", ip: "192.168.50.10" 22 | ans.vm.hostname = "ansible-node" 23 | ans.vm.provider "virtualbox" do |ansconfig| 24 | ansconfig.memory = 512 25 | ansconfig.cpus = 1 26 | end 27 | # naming the virtualmachine 28 | ans.vm.provider :virtualbox do |vb| 29 | vb.name = "ansible-node" 30 | end 31 | 32 | 33 | #master.vm.provision "ansible_local" do |ansible| 34 | # ansible.compatibility_mode = "2.0" 35 | # ansible.playbook = "kubernetes-setup/master-playbook.yml" 36 | # ansible.extra_vars = { 37 | # node_ip: "192.168.50.10", 38 | # } 39 | #end 40 | end 41 | 42 | 43 | (1..MASTERS).each do |i| 44 | config.vm.define "master-#{i}" do |master| 45 | master.vm.box = IMAGE_NAME 46 | master.vm.network "private_network", ip: "192.168.50.#{i + 10}" 47 | master.vm.hostname = "master-#{i}" 48 | 49 | # naming the virtualmachine 50 | master.vm.provider :virtualbox do |vb| 51 | vb.name = "master-#{i}" 52 | end 53 | #master.vm.provision "ansible_local" do |ansible| 54 | # ansible.compatibility_mode = "2.0" 55 | # ansible.playbook = "kubernetes-setup/master-playbook.yml" 56 | # ansible.extra_vars = { 57 | # node_ip: "192.168.50.10", 58 | # } 59 | #end 60 | end 61 | end 62 | 63 | (1..NODES).each do |i| 64 | config.vm.define "node-#{i}" do |node| 65 | node.vm.box = IMAGE_NAME 66 | node.vm.network "private_network", ip: "192.168.50.#{i + 20}" 67 | node.vm.hostname = "node-#{i}" 68 | 69 | # naming the virtualmachine 70 | node.vm.provider :virtualbox do |vb| 71 | vb.name = "node-#{i}" 72 | end 73 | 74 | #node.vm.provision "ansible_local" do |ansible| 75 | # ansible.playbook = "kubernetes-setup/node-playbook.yml" 76 | # ansible.extra_vars = { 77 | # node_ip: "192.168.50.#{i + 10}", 78 | # } 79 | #end 80 | end 81 | end 82 | end -------------------------------------------------------------------------------- /virtualbox-kubernetes/kubernetes-setup/controlplane-playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: all 3 | become: true 4 | vars_files: 5 | - variables.yaml 6 | tasks: 7 | 8 | - name: Configure repo and update system 9 | include_tasks: 10 | file: 01-repo-config.yaml 11 | 12 | - name: Configure system 13 | include_tasks: 14 | file: 02-configure-system.yaml 15 | 16 | - name: Install packages 17 | include_tasks: 18 | file: 03-configure-packages.yaml 19 | 20 | - name: Disable swap 21 | include_tasks: 22 | file: 04-disable-swap.yaml 23 | 24 | - name: Install k8s tools 25 | include_tasks: 26 | file: 05-install-k8s-tools.yaml 27 | 28 | - name: Configure node ip 29 | lineinfile: 30 | #changedthis 31 | create: yes 32 | path: /etc/default/kubelet 33 | line: KUBELET_EXTRA_ARGS=--node-ip={{ node_ip }} 34 | 35 | - name: Restart kubelet 36 | service: 37 | name: kubelet 38 | daemon_reload: yes 39 | state: restarted 40 | 41 | # Step 2.3: Initialize the Kubernetes cluster with kubeadm using the below code (applicable only on controlplane node). 42 | - name: Initialize the Kubernetes cluster using kubeadm 43 | command: sudo kubeadm init --apiserver-advertise-address={{ apiserver_advertise_address }} --apiserver-cert-extra-sans={{ apiserver_advertise_address }} --node-name=demo-k8s-controlplane --pod-network-cidr=192.168.0.0/16 44 | 45 | # Step 2.4: Setup the kube config file for the vagrant user to access the Kubernetes cluster using the below code. 46 | - name: Setup kubeconfig for vagrant user 47 | command: "{{ item }}" 48 | with_items: 49 | - mkdir -p /home/vagrant/.kube 50 | - cp -i /etc/kubernetes/admin.conf /home/vagrant/.kube/config 51 | - chown vagrant:vagrant /home/vagrant/.kube/config 52 | 53 | # Step 2.5: Setup the container networking provider and the network policy engine using the below code. 54 | - name: Install calico pod network 55 | become: false 56 | command: kubectl create -f https://docs.projectcalico.org/v3.4/getting-started/kubernetes/installation/hosted/calico.yaml 57 | #changedthis 58 | when: installcalico is defined 59 | 60 | # Step 2.6: Generate kube join command for joining the node to the Kubernetes cluster and store the command in the file named join-command. 61 | - name: Generate join command 62 | command: kubeadm token create --print-join-command 63 | register: join_command 64 | 65 | - debug: 66 | msg: "{{ join_command }}" 67 | 68 | - name: Copy join command to local file 69 | #changedthis 70 | become: no 71 | local_action: copy content="{{ join_command.stdout_lines[0] }}" dest="./join-command" 72 | 73 | # Step 2.7: Setup a handler for checking Docker daemon using the below code. 74 | # handlers: 75 | # - name: docker status 76 | # service: name=docker state=started 77 | -------------------------------------------------------------------------------- /gcp-wordpress/roles/makarenalabs.wordpress/templates/nginx-vhost.j2: -------------------------------------------------------------------------------- 1 | ## 2 | # You should look at the following URL's in order to grasp a solid understanding 3 | # of Nginx configuration files in order to fully unleash the power of Nginx. 4 | # http://wiki.nginx.org/Pitfalls 5 | # http://wiki.nginx.org/QuickStart 6 | # http://wiki.nginx.org/Configuration 7 | # 8 | # Generally, you will want to move this file somewhere, and start with a clean 9 | # file but keep this around for reference. Or just disable in sites-enabled. 10 | # 11 | # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. 12 | ## 13 | 14 | # Default server configuration 15 | # 16 | server { 17 | 18 | # SSL configuration 19 | # 20 | # listen 443 ssl default_server; 21 | # listen [::]:443 ssl default_server; 22 | # 23 | # Note: You should disable gzip for SSL traffic. 24 | # See: https://bugs.debian.org/773332 25 | # 26 | # Read up on ssl_ciphers to ensure a secure configuration. 27 | # See: https://bugs.debian.org/765782 28 | # 29 | # Self signed certs generated by the ssl-cert package 30 | # Don't use them in a production server! 31 | # 32 | # include snippets/snakeoil.conf; 33 | 34 | root {{ wp_install_dir }}; 35 | 36 | # Add index.php to the list if you are using PHP 37 | index index.html index.htm index.nginx-debian.html index.php; 38 | 39 | server_name {{ site_name }} www.{{ site_name }}; 40 | 41 | location / { 42 | # First attempt to serve request as file, then 43 | # as directory, then fall back to displaying a 404. 44 | #try_files $uri $uri/ =404; 45 | try_files $uri $uri/ /index.php$is_args$args; 46 | } 47 | 48 | location = /favicon.ico { log_not_found off; access_log off; } 49 | location = /robots.txt { log_not_found off; access_log off; allow all; } 50 | location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ { 51 | expires max; 52 | log_not_found off; 53 | } 54 | 55 | # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 56 | location ~ \.php$ { 57 | try_files $uri =404; 58 | include /etc/nginx/fastcgi_params; 59 | fastcgi_read_timeout 3600s; 60 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 61 | fastcgi_pass unix:/run/php/php{{ php_ver.stdout }}-fpm.sock; 62 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 63 | fastcgi_index index.php; 64 | } 65 | 66 | # deny access to .htaccess files, if Apache's document root 67 | # concurs with nginx's one 68 | # 69 | #location ~ /\.ht { 70 | # deny all; 71 | #} 72 | 73 | } 74 | 75 | 76 | # Virtual Host configuration for example.com 77 | # 78 | # You can move that to a different file under sites-available/ and symlink that 79 | # to sites-enabled/ to enable it. 80 | # 81 | #server { 82 | # listen 80; 83 | # listen [::]:80; 84 | # 85 | # server_name example.com; 86 | # 87 | # root /var/www/example.com; 88 | # index index.html; 89 | # 90 | # location / { 91 | # try_files $uri $uri/ =404; 92 | # } 93 | #} -------------------------------------------------------------------------------- /aws-web-demo/deploy-infraaaaa.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: all 3 | become: yes 4 | tasks: 5 | - name: Create directory for storing our website (/webapp/main-site) 6 | become: yes 7 | file: 8 | path: /webapp/main-site 9 | state: directory 10 | 11 | - name: Install nginx server 12 | apt: 13 | name: nginx 14 | state: latest 15 | 16 | - name: Start nginx service 17 | service: 18 | name: nginx 19 | state: started 20 | enabled: true 21 | 22 | - name: Copy nginx configuration 23 | copy: 24 | src: static_site.cfg 25 | dest: /etc/nginx/sites-available/static_site.cfg 26 | mode: 755 27 | become: yes 28 | 29 | - name: Create symlink to activate the site. 30 | file: 31 | src: /etc/nginx/sites-available/static_site.cfg 32 | dest: /etc/nginx/sites-enabled/default 33 | state: link 34 | become: yes 35 | 36 | - name: Clone website from github 37 | git: 38 | repo: 'https://github.com/ginigangadharan/vagrant-aws-iaas-demo-site.git' 39 | dest: /webapp/main-site 40 | 41 | - name: restart nginx to load configuratioins 42 | service: 43 | name: nginx 44 | state: restarted 45 | become: yes 46 | 47 | - name: Install ufw (firewall) 48 | apt: 49 | name: ufw 50 | state: latest 51 | 52 | - name: Start Firewall service 53 | service: 54 | name: ufw 55 | state: started 56 | enabled: true 57 | 58 | - name: Setup ufw and enable for reboot 59 | ufw: 60 | state: enabled 61 | policy: deny 62 | 63 | - name: Enable ssh and http ports 64 | ufw: 65 | rule: allow 66 | port: "{{ item }}" 67 | proto: tcp 68 | with_items: 69 | - 22 70 | - 80 71 | 72 | # Lockdown ssh access 73 | - name: Disallow password authentication 74 | lineinfile: 75 | dest: /etc/ssh/sshd_config 76 | regexp: "^PasswordAuthentication" 77 | line: "PasswordAuthentication no" 78 | state: present 79 | notify: restart ssh 80 | 81 | - name: Disallow root SSH access 82 | lineinfile: 83 | dest: /etc/ssh/sshd_config 84 | regexp: "^PermitRootLogin" 85 | line: "PermitRootLogin no" 86 | state: present 87 | notify: restart ssh 88 | 89 | - name: Collect Public Hostname/Url to access 90 | uri: 91 | url: http://169.254.169.254/latest/meta-data/public-hostname 92 | dest: /tmp/abc 93 | return_content: yes 94 | register: aws_meta 95 | notify: show public url 96 | 97 | - name: Verify website access 98 | uri: 99 | url: "http://{{ aws_meta.content }}" 100 | status_code: 200 101 | 102 | handlers: 103 | - name: restart ssh 104 | service: 105 | name: sshd 106 | state: restarted 107 | 108 | # Show Public Hostname/Url to access website 109 | - name: show public url 110 | debug: 111 | msg: "Your website can be accessed using url : {{ aws_meta.content }}" 112 | -------------------------------------------------------------------------------- /virtualbox-vyos/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # All Vagrant configuration is done below. The "2" in Vagrant.configure 5 | # configures the configuration version (we support older styles for 6 | # backwards compatibility). Please don't change it unless you know what 7 | # you're doing. 8 | Vagrant.configure("2") do |config| 9 | # The most common configuration options are documented and commented below. 10 | # For a complete reference, please see the online documentation at 11 | # https://docs.vagrantup.com. 12 | 13 | # Every Vagrant development environment requires a box. You can search for 14 | # boxes at https://vagrantcloud.com/search. 15 | config.vm.box = "letenkov/vyos" 16 | # Disable automatic box update checking. If you disable this, then 17 | # boxes will only be checked for updates when the user runs 18 | # `vagrant box outdated`. This is not recommended. 19 | # config.vm.box_check_update = false 20 | 21 | # Create a forwarded port mapping which allows access to a specific port 22 | # within the machine from a port on the host machine. In the example below, 23 | # accessing "localhost:8080" will access port 80 on the guest machine. 24 | # NOTE: This will enable public access to the opened port 25 | # config.vm.network "forwarded_port", guest: 80, host: 8080 26 | 27 | # Create a forwarded port mapping which allows access to a specific port 28 | # within the machine from a port on the host machine and only allow access 29 | # via 127.0.0.1 to disable public access 30 | # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" 31 | 32 | # Create a private network, which allows host-only access to the machine 33 | # using a specific IP. 34 | # config.vm.network "private_network", ip: "192.168.33.10" 35 | 36 | # Create a public network, which generally matched to bridged network. 37 | # Bridged networks make the machine appear as another physical device on 38 | # your network. 39 | # config.vm.network "public_network" 40 | 41 | # Share an additional folder to the guest VM. The first argument is 42 | # the path on the host to the actual folder. The second argument is 43 | # the path on the guest to mount the folder. And the optional third 44 | # argument is a set of non-required options. 45 | # config.vm.synced_folder "../data", "/vagrant_data" 46 | 47 | # Provider-specific configuration so you can fine-tune various 48 | # backing providers for Vagrant. These expose provider-specific options. 49 | # Example for VirtualBox: 50 | # 51 | # config.vm.provider "virtualbox" do |vb| 52 | # # Display the VirtualBox GUI when booting the machine 53 | # vb.gui = true 54 | # 55 | # # Customize the amount of memory on the VM: 56 | # vb.memory = "1024" 57 | # end 58 | # 59 | # View the documentation for the provider you are using for more 60 | # information on available options. 61 | 62 | # Enable provisioning with a shell script. Additional provisioners such as 63 | # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the 64 | # documentation for more information about their specific syntax and use. 65 | # config.vm.provision "shell", inline: <<-SHELL 66 | # apt-get update 67 | # apt-get install -y apache2 68 | # SHELL 69 | end 70 | -------------------------------------------------------------------------------- /virtualbox-windows/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # All Vagrant configuration is done below. The "2" in Vagrant.configure 5 | # configures the configuration version (we support older styles for 6 | # backwards compatibility). Please don't change it unless you know what 7 | # you're doing. 8 | Vagrant.configure("2") do |config| 9 | # The most common configuration options are documented and commented below. 10 | # For a complete reference, please see the online documentation at 11 | # https://docs.vagrantup.com. 12 | 13 | # Every Vagrant development environment requires a box. You can search for 14 | # boxes at https://vagrantcloud.com/search. 15 | config.vm.box = "gusztavvargadr/windows-10" 16 | 17 | # Disable automatic box update checking. If you disable this, then 18 | # boxes will only be checked for updates when the user runs 19 | # `vagrant box outdated`. This is not recommended. 20 | # config.vm.box_check_update = false 21 | 22 | # Create a forwarded port mapping which allows access to a specific port 23 | # within the machine from a port on the host machine. In the example below, 24 | # accessing "localhost:8080" will access port 80 on the guest machine. 25 | # NOTE: This will enable public access to the opened port 26 | # config.vm.network "forwarded_port", guest: 80, host: 8080 27 | 28 | # Create a forwarded port mapping which allows access to a specific port 29 | # within the machine from a port on the host machine and only allow access 30 | # via 127.0.0.1 to disable public access 31 | # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" 32 | 33 | # Create a private network, which allows host-only access to the machine 34 | # using a specific IP. 35 | # config.vm.network "private_network", ip: "192.168.33.10" 36 | 37 | # Create a public network, which generally matched to bridged network. 38 | # Bridged networks make the machine appear as another physical device on 39 | # your network. 40 | # config.vm.network "public_network" 41 | 42 | # Share an additional folder to the guest VM. The first argument is 43 | # the path on the host to the actual folder. The second argument is 44 | # the path on the guest to mount the folder. And the optional third 45 | # argument is a set of non-required options. 46 | # config.vm.synced_folder "../data", "/vagrant_data" 47 | 48 | # Provider-specific configuration so you can fine-tune various 49 | # backing providers for Vagrant. These expose provider-specific options. 50 | # Example for VirtualBox: 51 | # 52 | # config.vm.provider "virtualbox" do |vb| 53 | # # Display the VirtualBox GUI when booting the machine 54 | # vb.gui = true 55 | # 56 | # # Customize the amount of memory on the VM: 57 | # vb.memory = "1024" 58 | # end 59 | # 60 | # View the documentation for the provider you are using for more 61 | # information on available options. 62 | 63 | # Enable provisioning with a shell script. Additional provisioners such as 64 | # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the 65 | # documentation for more information about their specific syntax and use. 66 | # config.vm.provision "shell", inline: <<-SHELL 67 | # apt-get update 68 | # apt-get install -y apache2 69 | # SHELL 70 | end 71 | -------------------------------------------------------------------------------- /gcp-wordpress/roles/makarenalabs.wordpress/README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | 5 | # Ansible Role: WordPress 6 | [![Build Status](https://travis-ci.org/MakarenaLabs/ansible-role-wordpress.svg?branch=master)](https://travis-ci.org/MakarenaLabs/ansible-role-wordpress) 7 | [![License](https://img.shields.io/github/license/MakarenaLabs/ansible-role-wordpress.svg)](https://opensource.org/licenses/MIT) 8 | [![Ansible Version](https://img.shields.io/badge/ansible-%3E%3D_1.4-8892BF.svg)](https://www.ansible.com/) 9 | [![Ansible Role](https://img.shields.io/ansible/role/36472.svg)](https://galaxy.ansible.com/MakarenaLabs/wordpress/) 10 | [![Ansible Quality](https://img.shields.io/ansible/quality/36472.svg)](https://galaxy.ansible.com/MakarenaLabs/wordpress/) 11 | [![Ansible Downloads](https://img.shields.io/ansible/role/d/36472.svg)](https://galaxy.ansible.com/MakarenaLabs/wordpress/) 12 | 13 | Ansible role that installs and configures WordPress with Nginx or Apache2. 14 | 15 | Features include: 16 | - Installation of any WordPress version to specified directory 17 | - Configuration of `wp-config.php` 18 | - Fetch random salts for wp-config.php (https://api.wordpress.org/secret-key/1.1/salt/) 19 | 20 | ## Installation 21 | 22 | Using `ansible-galaxy`: 23 | ```shell 24 | $ ansible-galaxy install makarenalabs.wordpress 25 | ``` 26 | 27 | Using `arm` ([Ansible Role Manager](https://github.com/mirskytech/ansible-role-manager/)): 28 | ```shell 29 | $ arm install makarenalabs.wordpress 30 | ``` 31 | 32 | Using `git`: 33 | ```shell 34 | $ git clone https://github.com/MakarenaLabs/ansible-role-wordpress.git 35 | ``` 36 | 37 | ## Requirements & Dependencies 38 | - Ansible 1.4 or higher 39 | - Curl 40 | 41 | ## Variables 42 | Here is a list of all the default variables for this role, which are also available in `defaults/main.yml`. 43 | 44 | ```yaml 45 | wp_version: 5.0.3 46 | wp_install_dir: '/var/www/html' 47 | wp_db_name: "{{ wp_mysql_db }}" 48 | wp_db_user: "{{ wp_mysql_user }}" 49 | wp_db_password: "{{ wp_mysql_password }}" 50 | wp_db_host: 'localhost' 51 | wp_db_charset: 'utf8' 52 | wp_db_collate: '' 53 | wp_table_prefix: 'wp_' 54 | wp_debug: false 55 | wp_admin_email: 'admin@example.com' 56 | wp_webserver: nginx 57 | site_name: "{{ wp_sitename }}" 58 | ``` 59 | - ```wp_mysql_db``` 60 | - ```wp_mysql_user``` 61 | - ```wp_mysql_password``` 62 | - ```wp_sitename``` 63 | 64 | These variables are required! 65 | 66 | Default webserver selected is ```nginx```. If you want to use ```apache2``` you have to set ```wp_webserver``` variable as follow: 67 | ```yaml 68 | wp_webserver: apache 69 | ``` 70 | 71 | ## Example playbook 72 | ```yaml 73 | --- 74 | - hosts: all 75 | vars: 76 | wp_version: 5.0.3 77 | wp_mysql_db: 'database_name_here' 78 | wp_mysql_user: 'username_here' 79 | wp_mysql_password: 'password_here' 80 | wp_webserver: nginx 81 | wp_sitename: example.com 82 | wp_admin_email: 'your@email.com' 83 | wp_install_dir: "/var/www/{{ wp_sitename }}" 84 | roles: 85 | - makarenalabs.wordpress 86 | ``` 87 | 88 | ## Testing 89 | ```shell 90 | $ git clone https://github.com/MakarenaLabs/ansible-role-wordpress.git 91 | $ cd ansible-role-wordpress 92 | $ vagrant up 93 | ``` 94 | 95 | ## License 96 | 97 | Licensed under the MIT License. See the LICENSE file for details. 98 | 99 | Copyright © 2019 [MakarenaLabs](https://www.makarenalabs.com) 100 | -------------------------------------------------------------------------------- /playbooks/deploy-awx.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Configure Ansible AWX Server 3 | hosts: all 4 | become: yes 5 | vars_files: 6 | - var/main.yml 7 | tasks: 8 | - name: Install epel repo 9 | yum: 10 | name: epel-release 11 | state: latest 12 | 13 | - name: Install jq, yum-utils, lvm2, device-mapper-persistent-data 14 | yum: 15 | name: "{{ item }}" 16 | state: latest 17 | with_items: 18 | - jq 19 | - yum-utils 20 | - device-mapper-persistent-data 21 | - lvm2 22 | 23 | - name: Add and enable docker-ce repo 24 | get_url: 25 | url: https://download.docker.com/linux/centos/docker-ce.repo 26 | dest: /etc/yum.repos.d/docer-ce.repo 27 | become: yes 28 | 29 | - name: Enable Docker Edge repo 30 | ini_file: 31 | dest: /etc/yum.repos.d/docer-ce.repo 32 | section: 'docker-ce-edge' 33 | option: enabled 34 | value: 0 35 | become: yes 36 | 37 | - name: Enable Docker Test repo 38 | ini_file: 39 | dest: /etc/yum.repos.d/docer-ce.repo 40 | section: 'docker-ce-test' 41 | option: enabled 42 | value: 0 43 | become: yes 44 | 45 | - name: Install Docker-CE 46 | package: 47 | name: docker-ce 48 | state: latest 49 | become: yes 50 | 51 | - name: Start and Enable Docker service 52 | service: 53 | name: docker 54 | state: started 55 | enabled: yes 56 | become: yes 57 | 58 | - name: Start Firewall service 59 | service: 60 | name: firewalld 61 | state: started 62 | enabled: true 63 | 64 | - name: Enable ssh and http ports 65 | firewalld: 66 | service: "{{ item }}" 67 | permanent: yes 68 | immediate: yes 69 | state: enabled 70 | with_items: 71 | - "{{ ssh_port }}" 72 | - "{{ http_port }}" 73 | - "{{ https_port }}" 74 | 75 | # Lockdown ssh access 76 | - name: Disallow password authentication 77 | lineinfile: 78 | dest: /etc/ssh/sshd_config 79 | regexp: "^PasswordAuthentication" 80 | line: "PasswordAuthentication no" 81 | state: present 82 | notify: restart ssh 83 | 84 | - name: Disallow root SSH access 85 | lineinfile: 86 | dest: /etc/ssh/sshd_config 87 | regexp: "^PermitRootLogin" 88 | line: "PermitRootLogin no" 89 | state: present 90 | notify: restart ssh 91 | 92 | - name: Collect Public IP to access 93 | uri: 94 | url: http://169.254.169.254/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip 95 | dest: /tmp/abc 96 | return_content: yes 97 | headers: 98 | Metadata-Flavor: "Google" 99 | register: instance_meta 100 | #notify: show public url 101 | 102 | - name: Verify website access 103 | uri: 104 | url: "http://{{ instance_meta.content }}" 105 | status_code: 200 106 | 107 | handlers: 108 | - name: restart ssh 109 | service: 110 | name: sshd 111 | state: restarted 112 | 113 | # Show Public Hostname/Url to access website 114 | - name: Display status 115 | hosts: all 116 | vars_files: 117 | - var/main.yml 118 | tasks: 119 | - name: Show public IP to Access 120 | debug: 121 | msg: "Your website can be accessed using public IP : http://{{ instance_meta.content }}" #{{ ansible_default_ipv4 }}" # : {{ aws_meta.content }} 122 | -------------------------------------------------------------------------------- /virtualbox-minikube/README.md: -------------------------------------------------------------------------------- 1 | # Installing minikube with Vagrant and Ansible 2 | 3 | > __IMPORTANCE NOTE__: Minikube now supports various drivers (including Podman, VirtualBox, Docker, etc.), so I have stopped using Minikube within a Vagrant + VirtualBox VM. As a result, I am no longer maintaining this Vagrant use case folder. 4 | 5 | Refer to [minikube](https://www.iamgini.com/minikube) notes for more details. 6 | 7 | ```shell 8 | ## Install minikube 9 | $ curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 10 | $ sudo install minikube-linux-amd64 /usr/local/bin/minikube 11 | 12 | ## Start minikube with virtualbox as driver 13 | $ minikube start --driver=virtualbox 14 | 15 | ## Get pods if you dont have kubectl or different version of kubectl 16 | $ minikube kubectl -- get pods -A 17 | 18 | ## Start Kubernetes Dashboard 19 | $ minikube dashboard 20 | 21 | ## Stop the minikube VM 22 | $ minikube stop 23 | ``` 24 | 25 | ## Start Another minikube! 26 | 27 | Yes, you can create multiple Kubernetes clusters using minikube but remember to give different name (`--profile`). 28 | 29 | ```shell 30 | # Start a minikube cluster using Podman as driver. 31 | $ minikube start --profile cluster2-podman --driver=podman 32 | 33 | # Stop cluster 34 | $ minikube stop --profile cluster2-podman 35 | 36 | # Remove the cluster 37 | $ minikube delete --profile cluster2-podman 38 | ``` 39 | 40 | ## Multi-node Kubernetes Cluster using minikube 41 | 42 | ```shell 43 | $ minikube start --driver=virtualbox --nodes 2 44 | 45 | $ kubectl get nodes 46 | NAME STATUS ROLES AGE VERSION 47 | minikube Ready control-plane 95s v1.26.3 48 | minikube-m02 NotReady 8s v1.26.3 49 | ``` 50 | 51 | ## NOT in USE: Old method using the Vagrant + VirtualBox 52 | 53 | This is a simple repo to demonstrate how to install minikube inside a virtualbox vm using Vagrant and Ansible as provisioner. 54 | 55 | Watch **[video](https://www.youtube.com/watch?v=xPLQqHbp9BM&t=2s)** for detailed explanaton. 56 | 57 | **Important Note** 58 | If you are planning to other variants of box (ubuntu or debian instead of CentOS), make sure you adjust your Ansible playbook (`install-minikube.yaml`) accordingly. 59 | 60 | ![minikube-vagrant-iac](../images/minikube-vagrant-iac.png) 61 | 62 | ## How to use this repo - Quick Overview 63 | 64 | 1. Install Vagrant 65 | 66 | 2. ~~Install Ansible~~ 67 | 68 | **Update** 69 | Since some of the users reported that, they are using Windows and unable to use Ansible, I have adjusted the Vagrantfile to use with `ansible_local` option. 70 | 71 | 3. Clone this repo to your working directory 72 | 73 | `git clone git@github.com:ginigangadharan/vagrant-iac-usecases.git` 74 | 75 | 4. switch to `vagrant-iac-use cases/virtualbox-iac-minikube` directory and run `vagrant up` 76 | 77 | ## Additional Notes 78 | 79 | minikube will be installed and running with default components. If you want to enable additional components add those using `minikube enable` command. 80 | 81 | Eg: Enable `metrics-server` 82 | 83 | ```shell 84 | [vagrant@centos-minikube ~]$ sudo minikube addons enable metrics-server 85 | * The 'metrics-server' addon is enabled 86 | ``` 87 | 88 | ## References 89 | - [Installing Kubernetes with Minikube](https://kubernetes.io/docs/setup/learning-environment/minikube/) 90 | - [minikube start](https://minikube.sigs.k8s.io/docs/start/) 91 | - [minikube](https://technology.amis.nl/2019/02/12/rapidly-spinning-up-a-vm-with-ubuntu-docker-and-minikube-using-the-vm-drivernone-option-on-my-windows-laptop-using-vagrant-and-oracle-virtualbox/) -------------------------------------------------------------------------------- /playbooks/deploy-infra.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Configure Web server 3 | hosts: all 4 | become: yes 5 | vars_files: 6 | - var/main.yml 7 | tasks: 8 | - name: Create directory for storing our website (/webapp/main-site) 9 | become: yes 10 | file: 11 | path: /webapp/main-site 12 | state: directory 13 | 14 | - name: Install nginx server 15 | apt: 16 | name: nginx 17 | state: latest 18 | #force_apt_get: yes # Force usage of apt-get instead of aptitude 19 | 20 | - name: Start nginx service 21 | service: 22 | name: nginx 23 | state: started 24 | enabled: true 25 | 26 | - name: Copy nginx configuration 27 | copy: 28 | src: static_site.cfg 29 | dest: /etc/nginx/sites-available/static_site.cfg 30 | mode: 755 31 | become: yes 32 | 33 | - name: Create symlink to activate the site. 34 | file: 35 | src: /etc/nginx/sites-available/static_site.cfg 36 | dest: /etc/nginx/sites-enabled/default 37 | state: link 38 | become: yes 39 | 40 | - name: Clone website from github 41 | git: 42 | repo: 'https://github.com/ginigangadharan/demo-website-content.git' 43 | dest: /webapp/main-site 44 | 45 | - name: restart nginx to load configuratioins 46 | service: 47 | name: nginx 48 | state: restarted 49 | become: yes 50 | 51 | - name: Install ufw (firewall) 52 | apt: 53 | name: ufw 54 | state: latest 55 | 56 | - name: Start Firewall service 57 | service: 58 | name: ufw 59 | state: started 60 | enabled: true 61 | 62 | - name: Setup ufw and enable for reboot 63 | ufw: 64 | state: enabled 65 | policy: deny 66 | 67 | - name: Enable ssh and http ports 68 | ufw: 69 | rule: allow 70 | port: "{{ item }}" 71 | proto: tcp 72 | with_items: 73 | - "{{ ssh_port }}" 74 | - "{{ http_port }}" 75 | 76 | # Lockdown ssh access 77 | - name: Disallow password authentication 78 | lineinfile: 79 | dest: /etc/ssh/sshd_config 80 | regexp: "^PasswordAuthentication" 81 | line: "PasswordAuthentication no" 82 | state: present 83 | notify: restart ssh 84 | 85 | - name: Disallow root SSH access 86 | lineinfile: 87 | dest: /etc/ssh/sshd_config 88 | regexp: "^PermitRootLogin" 89 | line: "PermitRootLogin no" 90 | state: present 91 | notify: restart ssh 92 | 93 | - name: Collect Public IP to access 94 | uri: 95 | url: http://169.254.169.254/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip 96 | dest: /tmp/abc 97 | return_content: yes 98 | headers: 99 | Metadata-Flavor: "Google" 100 | register: instance_meta 101 | #notify: show public url 102 | 103 | - name: Verify website access 104 | uri: 105 | url: "http://{{ instance_meta.content }}" 106 | status_code: 200 107 | 108 | handlers: 109 | - name: restart ssh 110 | service: 111 | name: sshd 112 | state: restarted 113 | 114 | # Show Public Hostname/Url to access website 115 | - name: Display status 116 | hosts: all 117 | vars_files: 118 | - var/main.yml 119 | tasks: 120 | - name: Show public IP to Access 121 | debug: 122 | msg: "Your website can be accessed using public IP : http://{{ instance_meta.content }}" #{{ ansible_default_ipv4 }}" # : {{ aws_meta.content }} 123 | -------------------------------------------------------------------------------- /gcp-web-server/deploy-infra.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Configure Web server 3 | hosts: all 4 | become: yes 5 | vars_files: 6 | - var/main.yml 7 | tasks: 8 | - name: Create directory for storing our website (/webapp/main-site) 9 | become: yes 10 | file: 11 | path: /webapp/main-site 12 | state: directory 13 | 14 | - name: Install nginx server 15 | apt: 16 | name: nginx 17 | state: latest 18 | #force_apt_get: yes # Force usage of apt-get instead of aptitude 19 | 20 | - name: Start nginx service 21 | service: 22 | name: nginx 23 | state: started 24 | enabled: true 25 | 26 | - name: Copy nginx configuration 27 | copy: 28 | src: static_site.cfg 29 | dest: /etc/nginx/sites-available/static_site.cfg 30 | mode: 755 31 | become: yes 32 | 33 | - name: Create symlink to activate the site. 34 | file: 35 | src: /etc/nginx/sites-available/static_site.cfg 36 | dest: /etc/nginx/sites-enabled/default 37 | state: link 38 | become: yes 39 | 40 | - name: Clone website from github 41 | git: 42 | repo: 'https://github.com/ginigangadharan/demo-website-content.git' 43 | dest: /webapp/main-site 44 | 45 | - name: restart nginx to load configuratioins 46 | service: 47 | name: nginx 48 | state: restarted 49 | become: yes 50 | 51 | - name: Install ufw (firewall) 52 | apt: 53 | name: ufw 54 | state: latest 55 | 56 | - name: Start Firewall service 57 | service: 58 | name: ufw 59 | state: started 60 | enabled: true 61 | 62 | - name: Setup ufw and enable for reboot 63 | ufw: 64 | state: enabled 65 | policy: deny 66 | 67 | - name: Enable ssh and http ports 68 | ufw: 69 | rule: allow 70 | port: "{{ item }}" 71 | proto: tcp 72 | with_items: 73 | - "{{ ssh_port }}" 74 | - "{{ http_port }}" 75 | 76 | # Lockdown ssh access 77 | - name: Disallow password authentication 78 | lineinfile: 79 | dest: /etc/ssh/sshd_config 80 | regexp: "^PasswordAuthentication" 81 | line: "PasswordAuthentication no" 82 | state: present 83 | notify: restart ssh 84 | 85 | - name: Disallow root SSH access 86 | lineinfile: 87 | dest: /etc/ssh/sshd_config 88 | regexp: "^PermitRootLogin" 89 | line: "PermitRootLogin no" 90 | state: present 91 | notify: restart ssh 92 | 93 | - name: Collect Public IP to access 94 | uri: 95 | url: http://169.254.169.254/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip 96 | dest: /tmp/abc 97 | return_content: yes 98 | headers: 99 | Metadata-Flavor: "Google" 100 | register: instance_meta 101 | #notify: show public url 102 | 103 | - name: Verify website access 104 | uri: 105 | url: "http://{{ instance_meta.content }}" 106 | status_code: 200 107 | 108 | handlers: 109 | - name: restart ssh 110 | service: 111 | name: sshd 112 | state: restarted 113 | 114 | # Show Public Hostname/Url to access website 115 | - name: Display status 116 | hosts: all 117 | vars_files: 118 | - var/main.yml 119 | tasks: 120 | - name: Show public IP to Access 121 | debug: 122 | msg: "Your website can be accessed using public IP : http://{{ instance_meta.content }}" #{{ ansible_default_ipv4 }}" # : {{ aws_meta.content }} 123 | -------------------------------------------------------------------------------- /gcp-openshift-3/deploy-infra.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Configure Web server 3 | hosts: all 4 | become: yes 5 | vars_files: 6 | - var/main.yml 7 | tasks: 8 | - name: Create directory for storing our website (/webapp/main-site) 9 | become: yes 10 | file: 11 | path: /webapp/main-site 12 | state: directory 13 | 14 | - name: Install nginx server 15 | apt: 16 | name: nginx 17 | state: latest 18 | #force_apt_get: yes # Force usage of apt-get instead of aptitude 19 | 20 | - name: Start nginx service 21 | service: 22 | name: nginx 23 | state: started 24 | enabled: true 25 | 26 | - name: Copy nginx configuration 27 | copy: 28 | src: static_site.cfg 29 | dest: /etc/nginx/sites-available/static_site.cfg 30 | mode: 755 31 | become: yes 32 | 33 | - name: Create symlink to activate the site. 34 | file: 35 | src: /etc/nginx/sites-available/static_site.cfg 36 | dest: /etc/nginx/sites-enabled/default 37 | state: link 38 | become: yes 39 | 40 | - name: Clone website from github 41 | git: 42 | repo: 'https://github.com/ginigangadharan/demo-website-content.git' 43 | dest: /webapp/main-site 44 | 45 | - name: restart nginx to load configuratioins 46 | service: 47 | name: nginx 48 | state: restarted 49 | become: yes 50 | 51 | - name: Install ufw (firewall) 52 | apt: 53 | name: ufw 54 | state: latest 55 | 56 | - name: Start Firewall service 57 | service: 58 | name: ufw 59 | state: started 60 | enabled: true 61 | 62 | - name: Setup ufw and enable for reboot 63 | ufw: 64 | state: enabled 65 | policy: deny 66 | 67 | - name: Enable ssh and http ports 68 | ufw: 69 | rule: allow 70 | port: "{{ item }}" 71 | proto: tcp 72 | with_items: 73 | - "{{ ssh_port }}" 74 | - "{{ http_port }}" 75 | 76 | # Lockdown ssh access 77 | - name: Disallow password authentication 78 | lineinfile: 79 | dest: /etc/ssh/sshd_config 80 | regexp: "^PasswordAuthentication" 81 | line: "PasswordAuthentication no" 82 | state: present 83 | notify: restart ssh 84 | 85 | - name: Disallow root SSH access 86 | lineinfile: 87 | dest: /etc/ssh/sshd_config 88 | regexp: "^PermitRootLogin" 89 | line: "PermitRootLogin no" 90 | state: present 91 | notify: restart ssh 92 | 93 | - name: Collect Public IP to access 94 | uri: 95 | url: http://169.254.169.254/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip 96 | dest: /tmp/abc 97 | return_content: yes 98 | headers: 99 | Metadata-Flavor: "Google" 100 | register: instance_meta 101 | #notify: show public url 102 | 103 | - name: Verify website access 104 | uri: 105 | url: "http://{{ instance_meta.content }}" 106 | status_code: 200 107 | 108 | handlers: 109 | - name: restart ssh 110 | service: 111 | name: sshd 112 | state: restarted 113 | 114 | # Show Public Hostname/Url to access website 115 | - name: Display status 116 | hosts: all 117 | vars_files: 118 | - var/main.yml 119 | tasks: 120 | - name: Show public IP to Access 121 | debug: 122 | msg: "Your website can be accessed using public IP : http://{{ instance_meta.content }}" #{{ ansible_default_ipv4 }}" # : {{ aws_meta.content }} 123 | --------------------------------------------------------------------------------