Skip to content

Commit 4291346

Browse files
committed
extended info of 2
1 parent 1020dfa commit 4291346

File tree

4 files changed

+49
-6
lines changed

4 files changed

+49
-6
lines changed

2/Example_Ansible.md

+30-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
The Ansible collection 'community.mysql' and 'community.general' will need to be installed on the controller node!
44

5+
*NOTE: I did not test this playbook completely*
6+
57
## Inventory
68

79
### Hosts
@@ -34,14 +36,26 @@ app1_cnf:
3436
name: 'app1'
3537
users:
3638
user1:
37-
pwd: 'pwd1'
39+
pwd: !vault |
40+
$ANSIBLE_VAULT;1.1;AES256
41+
31363066336534336363653462386335623031303833333061646364326638653262356563363138
42+
3463393330356162316437343533303463613235353834610a383766366133626332653332363437
43+
34376431323634636564353430393365346165386332383061313033666466303436386362663933
44+
6433613638626337300a646432353063313264313835353362336637353263663936303833376439
45+
39303230316366333631316239313662633565376331326335323365316161313936613036653938
46+
6664653433343232333832636338656263366562353837633637
3847
privs: 'ALL'
3948
user2:
40-
pwd: 'pwd2'
49+
pwd: !vault |
50+
$ANSIBLE_VAULT;1.1;AES256
51+
66343461613165626562323935356166636462343761313538373537653933386663633137383433
52+
6530383933633437366264363130306663626561313335350a363930633737633431333666653837
53+
34653462663839623636313332343566363435636566633664653939373564363234646633656663
54+
3935626339373935650a353134323734396261396338396663663933653232336563626338386163
55+
37383930303362633264643339636162613932383133303933623261353935313262
4156
privs: 'SELECT'
4257
```
4358
44-
4559
## Playbook
4660
4761
```yaml
@@ -184,3 +198,16 @@ app1_cnf:
184198
enabled: true
185199
state: started
186200
```
201+
202+
## Execution
203+
204+
```bash
205+
ansible-playbook -D -K -k -i inventory/hosts.yml --ask-vault-pass playbook.yml --limit srv1
206+
# D = diff-mode
207+
# K = ask become password
208+
# k = ask connect password
209+
# i = inventory file
210+
# ask-vault-pass = ask for password that can be used to decrypt ansible-vault encrypted variables at runtime
211+
# playbook.yml = the actual playbook to execute
212+
# limit = only execute playbook targeting host 'srv1'
213+
```

2/Readme.md

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Intro to Ansible
22

3+
This introduction to Ansible is based on my personal experiences.
4+
5+
I will not compare Ansible to other automation tools/frameworks! There may be some out there that can replace Ansible - but I haven't got much experience using other ones.
6+
37
----
48

59
## Sources
@@ -20,13 +24,13 @@ There is also an Open-Source web-based control-environment named ['Ansible AWX']
2024

2125
For enterprise-use RedHat offers a product named ['Ansible Automation Platform'](https://www.redhat.com/en/technologies/management/ansible) that is Closed-Source and must be licensed.
2226

23-
### Arguments
27+
### Key points
2428

2529
**Practical examples** of use-cases are:
2630
* Provisioning/managing IT-services from small- up to large-scale
2731
* [Webserver nodes](https://github.com/ansibleguy/infra_nginx)
2832
* [Database clusters](https://github.com/ansibleguy/infra_mariadb)
29-
* Configuration of [host-](https://github.com/ansibleguy/infra_nftables) and [network-firewalls]((https://github.com/ansibleguy/collection_opnsense))
33+
* Configuration of [host-](https://github.com/ansibleguy/infra_nftables) and [network-firewalls](https://github.com/ansibleguy/collection_opnsense)
3034
* Configuration of [local users](https://github.com/ansibleguy/linux_users) or identity providers
3135
* Generating and renewing [certificates](https://github.com/ansibleguy/infra_certs) for encrypted connectivity
3236
* Preparing for the worst-case - automate your disaster-recovery
@@ -95,7 +99,7 @@ Most of the time one will use the system-specific default connection-types:
9599
* Many systems via APIs (_mainly HTTPS/REST_)
96100

97101
<a href="https://www.ansible.com/overview/how-ansible-works">
98-
<img src="https://www.ansible.com/hs-fs/hubfs/graphic-crop.jpg?width=500&name=graphic-crop.jpg" alt="RedHat - Ansible" width="400"/>
102+
<img src="https://www.ansible.com/hs-fs/hubfs/graphic-crop.jpg" alt="RedHat - Ansible" width="400"/>
99103
</a>
100104

101105
### Advanced tricks
@@ -148,6 +152,9 @@ That can catch user- or configuration-errors before they have any negative impac
148152
* Sensitive data can also be protected from being logged in clear-text using the ['no_log' parameter](https://docs.ansible.com/ansible/latest/reference_appendices/logging.html).
149153
Most Modules also implement this for secrets you pass to them.
150154
* Secrets that are [prompted at runtime](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_prompts.html#hashing-values-supplied-by-vars-prompt) can also be encrypted.
155+
* **Configuration**
156+
* Working with complex configurations that require [multiple scopes](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#scoping-variables) (_host, group, role, execution, ..._) can be challenging when using raw scripting.
157+
Ansible handles much of the mind-boggling logic in the background so we as admins/users don't have to deal with it.
151158

152159
----
153160

5/Readme.md

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ Only the most basic data-types will be discussed here.
2525
* [Integer/Float](https://www.w3schools.com/python/python_numbers.asp)
2626
* [Dictionary](https://www.w3schools.com/python/python_dictionaries.asp)
2727

28+
[Dynamically vs Statically typed languages](https://prepinsta.com/python/dynamic-typing-vs-static-typing-in-python)
29+
2830
## Interaction with data
2931

3032
* [Iteration](https://www.w3schools.com/python/python_iterators.asp)

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44

55
# Info
66

7+
> **Warning:**
8+
>
9+
> If you find any **discrepancy, errors or missing information** in these tutorials - please feel free to open a [GitHub issue](https://github.com/ansibleguy/ansible_tutorial/issues)!
10+
>
11+
> These tutorials are subjective as they are based on my personal experience.
12+
13+
714
I am creating videos on my [YouTube Channel](https://www.youtube.com/@ansibleguy) that target the topics listed below!
815

916
# Topics

0 commit comments

Comments
 (0)