1
0
Fork 0

Add reponse for ansible

Signed-off-by: Arnaud M <arnaud.choupinette@mailops.fr>
This commit is contained in:
Arnaud M 2023-03-04 20:49:29 +01:00
parent 01eb15f6d5
commit 47d1e2b488
11 changed files with 33 additions and 7 deletions

1
ansible/training/lessons/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.yml

View File

@ -35,13 +35,12 @@ Check if ansible is correctly installed (and the version you have):
ansible --version
```
```
ansible 2.7.7
config file = /etc/ansible/ansible.cfg
ansible 2.10.8
config file = None
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 3.7.3 (default, Jul 25 2020, 13:03:44) [GCC 8.3.0]
python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
```
## Ad-hoc ping
@ -68,7 +67,7 @@ ansible localhost -m shell -a "hostname"
Result:
```
localhost | CHANGED | rc=0 >>
ansible101
isen-x
```
Q: what command can you use to get the IP of your machine?

View File

@ -7,11 +7,13 @@ But ansible can be used to manage multiple systems that you have in your infrast
To do so, we must tell ansible which servers compose our infrastructure. This is done thanks to an `inventory` file.
The default `inventory` file for ansible is located in `/etc/ansible/hosts`.
For now, your inventory is empty, so you can create one:
```
cat /etc/ansible/hosts
mkdir -p /etc/ansible/
touch /etc/ansible/hosts
```
It's empty by default (not really empty, but everything is commented).
With an empty `inventory` like that, ansible only knows about `localhost`.

View File

@ -0,0 +1,6 @@
#!/bin/bash
find . -name '*.yml' | while read f ; do
echo "Ciiphering $f"
cat $f | gpg -e -r arnaud@mailops.fr -r arnaud.choupinette@mailops.fr -r arnaud.morin@gmail.com > $f.gpg
done

Binary file not shown.

View File

@ -0,0 +1,11 @@
server {
listen {{src_port}};
listen [::]:{{src_port}};
access_log /var/log/nginx/reverse-access.log;
error_log /var/log/nginx/reverse-error.log;
location / {
proxy_pass http://127.0.0.2:{{dst_port}};
}
}

View File

@ -0,0 +1,7 @@
#!/bin/bash
find . -name '*.gpg' | while read f ; do
echo "Unciphering $f"
n=${f%.gpg}
cat $f | gpg -d > $n
done