Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 842ae5079a | |||
| a8264d2939 | |||
| bd8bf9711b | |||
| a3bff9a4ff | |||
| 2ebe8fb39c | |||
| 6f7cc0da89 | |||
| be3bb4199c | |||
| 37d26ae236 |
43
Readme.md
43
Readme.md
@@ -1,43 +0,0 @@
|
||||
Installer et configurer ansible
|
||||
----------
|
||||
|
||||
*Tâche*: Installer et configurer ansible
|
||||
|
||||
*Condition*: Quand on souhaite utiliser ansible depuis son poste
|
||||
|
||||
*Norme*: gestionnaire de paquet, vim, ansible-config
|
||||
|
||||
*Pratique:*
|
||||
|
||||
Installer ansible et cowsay avec le gestionnaire de paquet.
|
||||
|
||||
S'assurer de la présence des commandes ansible, ansible-playbook, ansible-inventory, etc...
|
||||
|
||||
Localiser dans le fichier de configuration ansible et régler les éléments suivants:
|
||||
* forks = 20
|
||||
* ask_pass = true *sera changée une fois les cibles correctement configurées*
|
||||
* host_key_checking = false
|
||||
* remote_user = formation *sera changé une fois les cibles correctement configurées*
|
||||
* become = true
|
||||
* become_ask_pass = true *sera changé ultérieurement*
|
||||
* retry_files_enabled = false
|
||||
* gathering = smart
|
||||
* fact_caching = jsonfile
|
||||
* fact_caching_connection = /etc/ansible/facts
|
||||
* fact_caching_timeout = 86400
|
||||
* pipelining = True
|
||||
* callback_whitelist = timer, profile_tasks
|
||||
|
||||
|
||||
Créer le répertoire /etc/ansible/facts (l'opérateur doit pouvoir écrire dedans)
|
||||
|
||||
Valider avec la commande ansible-config dump
|
||||
|
||||
|
||||
|
||||
Si vous utilisez vi pour l'édition de playbook, je vous invite à rajouter la ligne suivante dans votre fichier ~/.vimrc:
|
||||
<code>
|
||||
set softtabstop=2 expandtab shiftwidth=2 smarttab autoindent
|
||||
</code>
|
||||
|
||||
*Performance*: On peut utiliser la commande *ansible-config
|
||||
25
ansible.cfg
Normal file
25
ansible.cfg
Normal file
@@ -0,0 +1,25 @@
|
||||
#/etc/ansible/ansible.cfg
|
||||
[defaults]
|
||||
forks = 20
|
||||
ask_pass = True
|
||||
host_key_checking = False
|
||||
callbacks_enabled = ansible.posix.timer, ansible.posix.profile_tasks
|
||||
remote_user = formation
|
||||
gathering = smart
|
||||
fact_caching = jsonfile
|
||||
fact_caching_connection = /etc/ansible/facts
|
||||
fact_caching_timeout = 86400
|
||||
retry_files_enabled = False
|
||||
ansible_managed = Ansible managed : {file} modified on %Y-%m-%d by {uid} on {host}
|
||||
[inventory]
|
||||
[privilege_escalation]
|
||||
become = True
|
||||
become_ask_pass = True
|
||||
[paramiko_connection]
|
||||
[ssh_connection]
|
||||
pipelining = True
|
||||
[persistent_connection]
|
||||
[accelerate]
|
||||
[selinux]
|
||||
[colors]
|
||||
[diff]
|
||||
14
solution.md
14
solution.md
@@ -1,4 +1,8 @@
|
||||
#/home/tom/Documents/Opendoor/Formations/Orsys/SIB/Exercices/1_configuration/ansible.cfg
|
||||
```bash
|
||||
sudo dnf install cowsay ansible # sur centos 8
|
||||
sudo yum install cowsay ansible # sur centos 7
|
||||
```
|
||||
|
||||
```bash
|
||||
grep -v -E '^(\s+#|#|$)' /etc/ansible/ansible.cfg
|
||||
```
|
||||
@@ -9,7 +13,7 @@ forks = 20
|
||||
ask_pass = True
|
||||
gathering = smart
|
||||
host_key_checking = False
|
||||
callback_whitelist = timer, profile_tasks
|
||||
callback_enabled = ansible.posix.timer, ansible.posix.profile_tasks
|
||||
remote_user = formation
|
||||
fact_caching = jsonfile
|
||||
fact_caching_connection = /etc/ansible/facts
|
||||
@@ -33,3 +37,9 @@ pipelining = True
|
||||
$ mkdir -m 1777 /etc/ansible/facts
|
||||
$ ansible-config dump
|
||||
```
|
||||
|
||||
```bash
|
||||
$ echo 'set softtabstop=2 expandtab shiftwidth=2 smarttab autoindent' >> ~/.vimrc
|
||||
```
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user