cloud-portal
cloud-portal copied to clipboard
Add support for ansible playbooks for bootstrapping
- Create playbook.yml file:
- hosts: all
vars:
jenkins_hostname: 192.168.0.1
roles:
- role: geerlingguy.java
become: yes
- role: geerlingguy.jenkins
become: yes
- Parse playbook.yml for ansible galaxy roles
- Use ansible-galaxy install to download roles
ansible-galaxy --ignore-certs install geerlingguy.jenkins
- Execute ansible-playbook:
ansible-playbook -i 192.168.0.1, --extra-vars ansible_ssh_user=my_user --extra-vars ansible_sudo_pass='my_pass' --extra-vars ansible_python_interpreter=/usr/bin/python3 playbook.yml
Here's an example for executing ansible for Windows host machines:
ansible -i 192.168.0.1, -e ansible_user='ccc' -e ansible_password='P@ssword' -e ansible_port='5985' -e ansible_connection='winrm' -e ansible_winrm_server_cert_validation=ignore -e validate_certs=false 192.168.0.1 -m win_ping
And here's how to execute an ansible playbook:
ansible-playbook -i 192.168.0.1, -e ansible_user='ccc' -e ansible_password='P@ssword' -e ansible_port='5985' -e ansible_connection='winrm' -e ansible_winrm_server_cert_validation='ignore' -e validate_certs='false' windows.yml
And here's the ansible playbook file to install google chrome:
- hosts: all
tasks:
- name: Install google chrome package
win_chocolatey:
name: googlechrome
state: present