|
1 | 1 | # MMUL Ansible roles
|
2 | 2 |
|
3 |
| -This collection of roles can be used to implement various cloud oriented |
4 |
| -solutions. |
| 3 | +This collection of roles can be used to implement various cloud native |
| 4 | +solutions: |
5 | 5 |
|
6 |
| -* [Graylog](roles/graylog-server): a clustered Graylog/MongoDB/Elasticsearch |
7 |
| - solution; |
8 | 6 | * [Kubernetes](roles/kubernetes): a Kubernetes cluster;
|
9 |
| -* [MaxScale](roles/maxscale): a MariaDB MaxScale instance (suitable also for |
10 |
| - Azure MaxScale); |
11 |
| -* [Redis](roles/redis): a Redis cluster implementation; |
12 | 7 | * [Terraform](roles/terraform): based on the passed inventory, it generates
|
13 | 8 | all the Terraform files needed to implement a cloud (today just Azure)
|
14 | 9 | datacenter;
|
15 | 10 | * [Azure](roles/azure): automate tasks on Azure;
|
16 |
| - |
17 |
| -A specific README will be available for each role. |
| 11 | +* [Graylog](roles/graylog-server): a clustered Graylog/MongoDB/Elasticsearch |
| 12 | + solution; |
| 13 | +* [MaxScale](roles/maxscale): a MariaDB MaxScale instance (suitable also for |
| 14 | + Azure MaxScale); |
| 15 | +* [Redis](roles/redis): a Redis cluster implementation; |
| 16 | + |
| 17 | +A specific README will be (soon, if not present) available for each role. |
| 18 | + |
| 19 | +## Using the roles |
| 20 | + |
| 21 | +For each of the role there is an Ansible plugin that will invoke everything that is needed to accomplish its scope. |
| 22 | + |
| 23 | +### Preparing the environment |
| 24 | + |
| 25 | +The best way to run everything is by using Python virtual environments and Ansible Collections. |
| 26 | + |
| 27 | +First of all you need to clone this repository: |
| 28 | + |
| 29 | +``` |
| 30 | +user@lab ~ # git clone https://github.com/mmul-it/ansible |
| 31 | +Cloning into 'ansible'... |
| 32 | +remote: Enumerating objects: 2572, done. |
| 33 | +remote: Counting objects: 100% (449/449), done. |
| 34 | +remote: Compressing objects: 100% (199/199), done. |
| 35 | +remote: Total 2572 (delta 269), reused 363 (delta 222), pack-reused 2123 |
| 36 | +Receiving objects: 100% (2572/2572), 9.10 MiB | 8.77 MiB/s, done. |
| 37 | +Resolving deltas: 100% (1345/1345), done. |
| 38 | +``` |
| 39 | + |
| 40 | +Then you will create your Python virtual environment: |
| 41 | + |
| 42 | +``` |
| 43 | +user@lab ~ # python3 -m virtualenv ansible-env |
| 44 | +Running virtualenv with interpreter /usr/bin/python2 |
| 45 | +New python executable in /root/ansible-env/bin/python2 |
| 46 | +Also creating executable in /root/ansible-env/bin/python |
| 47 | +Installing setuptools, pkg_resources, pip, wheel...done. |
| 48 | +
|
| 49 | +# source ansible-env/bin/activate |
| 50 | +(ansible-env) user@lab ~ # |
| 51 | +
|
| 52 | +(ansible-env) user@lab ~ # python3 -m pip install --upgrade pip |
| 53 | +``` |
| 54 | + |
| 55 | +And then you'll be ready to install the Python requirements: |
| 56 | + |
| 57 | +``` |
| 58 | +(ansible-env) user@lab ~ # pip3 install -r ansible/requirements.txt |
| 59 | +Requirement already satisfied: ansible in /usr/lib/python3.6/site-packages (from -r ansible/requirements.txt (line 1)) (2.10.7) |
| 60 | +Requirement already satisfied: ansible-vault in /usr/lib/python3.6/site-packages (from -r ansible/requirements.txt (line 2)) (1.2.0) |
| 61 | +Requirement already satisfied: azure-cli in /usr/lib/python3.6/site-packages (from -r ansible/requirements.txt (line 3)) (2.25.0) |
| 62 | +... |
| 63 | +... |
| 64 | +Installing collected packages: rsa, cachetools, google-auth, kubernetes |
| 65 | +Successfully installed cachetools-4.2.4 google-auth-2.13.0 kubernetes-24.2.0 rsa-4.9 |
| 66 | +``` |
| 67 | + |
| 68 | +And finally the Ansible collections: |
| 69 | + |
| 70 | +``` |
| 71 | +(ansible-env) user@lab ~ # ansible-galaxy install -r ansible/collections/requirements.yml |
| 72 | +Starting galaxy collection install process |
| 73 | +Process install dependency map |
| 74 | +... |
| 75 | +... |
| 76 | +kubernetes.core (2.3.2) was installed successfully |
| 77 | +``` |
| 78 | + |
| 79 | +Now you should be ready to use `ansible-playbook` to execute the desired playbooks. |
| 80 | + |
| 81 | +### Launching the playbooks |
| 82 | + |
| 83 | +Supposing that you want to install a Kubernetes environment, you'll need to pass an inventory (we will rely on `lab`) like this: |
| 84 | + |
| 85 | +``` |
| 86 | +$ ansible-playbook \ |
| 87 | +-i $HOME/ansible/inventory/lab \ |
| 88 | +$HOME/ansible/kubernetes.yml |
| 89 | +``` |
| 90 | + |
| 91 | +## Authors |
| 92 | + |
| 93 | +This project was created and is maintained by [Raoul Scarazzini](https://github.com/rascasoft) and has contributions from other users. Thanks to everyone who will contribute in the future, you're more than welcome! |
| 94 | + |
| 95 | +## License |
| 96 | + |
| 97 | +MIT License |
0 commit comments