KO
|
EN
gitlite — search
Search
#javascript
#python
#hacktoberfest
#react
#ai
#typescript
#llm
#go
#golang
#android
#machine-learning
#rust
#deep-learning
#linux
ansible-starter
★ 9
Open GitHub ↗
Ansible Playbooks Starter Kit
Download README (.md)
Explore Similar Repositories
SPIRAL-Handbook
:
Handbook for members of the SPIRAL group at Northeastern University.
LCLRRDL
:
Face Recognition via Locality Constrained Low Rank Representation and Dictionary Learning
VideoPlayer_for_Android
:
android网络视频播放器,可截图
LLVM-Windows
:
some tools and how-tos about llvm and windows
python-flask-cms-app
:
This is a Content Management System(CMS) App build by Python Flask
// repository documentation
Was this content helpful?
★ 0
(0 ratings)
Select Rating:
★
★
★
★
★
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
ansible-starter
?
Download (.md)
# Ansible Starter Kit This Ansible Playbooks Starter Kit is a collection of ideas and best practices in organizing and using Ansible. I used Ansible for several projects in many companies and stumbled across different approaches to organize all the mess. This is the essence of my learnings so I won't forget it. This repo only includes two roles for demonstration purposes. I maintain a repository with my essential roles in another repository. (That can be includes in `ansible.cfg`.) ## Installation You need a working Python installation and `pip` installed. ```bash pip install -r requirements.txt ``` ## Usage I add every host to at least one group in `ansible_hosts`. This can be cluster groups (e.g. consul-servers) or groups for a special purpose (e.g. streaming-servers). Every role has a group too (e.g. role `apache` to install Apache on a server). So I can add hosts or groups to a group that belong to a specific role to execute the tasks of this role on this hosts. Assume a group `webservers` with 4 hosts in `ansible_hosts` and a group `workers`: ```yaml [webservers] web1 ansible_host=web1.servers.local primary_ipv4=192.168.1.1 web2 ansible_host=web2.servers.local primary_ipv4=192.168.1.2 web3 ansible_host=web3.servers.local primary_ipv4=192.168.1.3 web4 ansible_host=web4.servers.local primary_ipv4=192.168.1.4 [workers] worker1 ansible_host=worker1.servers.local primary_ipv4=192.168.2.1 ``` (I use short names like `web1` and explicitly set a long name with `ansible_host`. The variable `primary_ipv4` is no official Ansible variable like `ansible_host`. But it's often a good choice to see the IP address of a host at frist sight and I use it in some roles.) If I need to install Aapche on all webservers and worker hosts I add them to the `apache` group: ```yaml [apache:children] webservers workers ``` In `site.yaml` every role gets an entry like this: ```yaml - name: Install Apache hosts: apache become: yes gather_facts: yes strategy: free roles: - { role: apache, tags: ['apache'] } ``` After that it's easy to work on a specific host or group: ```bash ansible-playbook site.yaml --limit webservers ```` Or execute a specific tag like `apache`: ```bash ansible-playbook site.yaml --tags "apache" ```` If you need to set variables for groups or hosts create a folder with the name of the group in `group_vars` or of the host in `host_vars`. Put YAML files with your settings in these folders.