Professional Documents
Culture Documents
Mobaxterm Personal Edition V22.0 - : (SSH Client, X Server and Network Tools)
Mobaxterm Personal Edition V22.0 - : (SSH Client, X Server and Network Tools)
114's password:
┌──────────────────────────────────────────────────────────────────────┐
│ • MobaXterm Personal Edition v22.0 •
│
│ (SSH client, X server and network tools)
│
│
│
│ → SSH session to ofi03@146.59.156.114
│
│ • Direct SSH : v
│
│ • SSH compression : v
│
│ • SSH-browser : v
│
│ • X11-forwarding : v (remote display is forwarded through
SSH) │
│
│
│ → For more info, ctrl+click on help or visit our website.
│
└──────────────────────────────────────────────────────────────────────┘
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
https://ubuntu.com/blog/microk8s-memory-optimisation
https://ubuntu.com/blog/microk8s-memory-optimisation
PLAY RECAP
***************************************************************************
146.59.158.16 : ok=4 changed=2 unreachable=0
failed=0 skipped =0 rescued=0 ignored=0
ansadmin@svl200:~$ 146.59.158.16 ^C
ansadmin@svl200:~$ ^C
ansadmin@svl200:~$ sudo vim handler.yaml
ansadmin@svl200:~$ ansible-playbook handler.yaml
[WARNING]: Could not match supplied host pattern, ignoring: cible{1
[WARNING]: Could not match supplied host pattern, ignoring: 2}
PLAY RECAP
***************************************************************************
PLAY RECAP
***************************************************************************
141.95.160.133 : ok=4 changed=2 unreachable=0
failed=0 skipped =0 rescued=0 ignored=0
146.59.158.16 : ok=3 changed=0 unreachable=0
failed=0 skipped =0 rescued=0 ignored=0
PLAY RECAP
***************************************************************************
141.95.160.133 : ok=3 changed=0 unreachable=0
failed=0 skipped =0 rescued=0 ignored=0
146.59.158.16 : ok=3 changed=0 unreachable=0
failed=0 skipped =0 rescued=0 ignored=0
PLAY RECAP
***************************************************************************
141.95.160.133 : ok=4 changed=2 unreachable=0
failed=0 skipped =0 rescued=0 ignored=0
146.59.158.16 : ok=4 changed=2 unreachable=0
failed=0 skipped =0 rescued=0 ignored=0
tasks:
- name: echo text
shell: echo "{{var1}} is var1, but var2 is {{var2}} >
/home/ansadmin/{{ansible_os_family}}
ansadmin@svl200:~$ sudo vim fact.yaml
ansadmin@svl200:~$ ansible-playbook fact.yaml
PLAY [facts]
***********************************************************************************
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 resc ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 resc ignored=0
ansadmin@svl200:~$ ansible all -a "ls -lrt"
146.59.158.16 | CHANGED | rc=0 >>
total 8
-rw-rw-r-- 1 ansadmin ansadmin 598 Oct 3 13:02 resultat.txt
-rw-r--r-- 1 root root 56 Oct 3 14:02 Debian.txt
141.95.160.133 | CHANGED | rc=0 >>
total 8
-rw-rw-r-- 1 ansadmin ansadmin 598 Oct 3 13:02 resultat.txt
-rw-r--r-- 1 root root 56 Oct 3 14:02 Debian.txt
ansadmin@svl200:~$ ansible all -a "cat Redhat.txt"
146.59.158.16 | FAILED | rc=1 >>
cat: Redhat.txt: No such file or directorynon-zero return code
141.95.160.133 | FAILED | rc=1 >>
cat: Redhat.txt: No such file or directorynon-zero return code
ansadmin@svl200:~$ ansible all -a "cat RedHat.txt"
146.59.158.16 | FAILED | rc=1 >>
cat: RedHat.txt: No such file or directorynon-zero return code
141.95.160.133 | FAILED | rc=1 >>
cat: RedHat.txt: No such file or directorynon-zero return code
ansadmin@svl200:~$ ansible all -a "cat Debian.txt"
146.59.158.16 | CHANGED | rc=0 >>
Hello DevOps1 is var1, but var2 is Good Morning DevOps2
141.95.160.133 | CHANGED | rc=0 >>
Hello DevOps1 is var1, but var2 is Good Morning DevOps2
ansadmin@svl200:~$
ansadmin@svl200:~$
ansadmin@svl200:~$ cp fact.yaml fact1.yaml
ansadmin@svl200:~$ sudo vim fact1.yaml
ansadmin@svl200:~$ sudo vim fact.yaml
ansadmin@svl200:~$ sudo vim fact1.yaml
ansadmin@svl200:~$ sudo vim fact1.yaml
ansadmin@svl200:~$ sudo vim fact.yaml
ansadmin@svl200:~$ sudo vim fact1.yaml
ansadmin@svl200:~$ sudo vim ip.txt
ansadmin@svl200:~$ ansible-playbook fact1.yaml
PLAY [facts]
***********************************************************************************
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc ignored=0
PLAY [facts]
***********************************************************************************
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 resc ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 resc ignored=0
PLAY [facts]
***********************************************************************************
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 resc ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 resc ignored=0
ansadmin@svl200:~$ sudo vim ip.txt
ansadmin@svl200:~$ cat ip.txt
ansadmin@svl200:~$ sudo vim fact1.yaml
ansadmin@svl200:~$ ansible all -a "cat ip.txt"
146.59.158.16 | CHANGED | rc=0 >>
['146.59.158.16']
141.95.160.133 | CHANGED | rc=0 >>
['141.95.160.133']
ansadmin@svl200:~$ sudo vim fact1.yaml
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim fact1.yaml
ansadmin@svl200:~$ sudo vim debug.yaml
ansadmin@svl200:~$ cat debug.yaml
---
-name: debug
hosts: cible1
become: true
vars:
- var1: Hello Devops
tasks:
- name: echo test
command: echo -e "{{var1}} is var1 it works"
register: results
-name: debug
hosts: cible1
^ here
ansadmin@svl200:~$ sudo vim debug.yaml
ansadmin@svl200:~$ ansible-playbook debug.yaml
PLAY [debug]
**********************************************************************************
PLAY RECAP
************************************************************************************
146.59.158.16 : ok=3 changed=1 unreachable=0
failed=0 skipped=0 res cued=0 ignored=0
PLAY [debug]
**********************************************************************************
PLAY RECAP
************************************************************************************
146.59.158.16 : ok=3 changed=1 unreachable=0
failed=0 skipped=0 res cued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ cp debug.yaml debug1.yaml
ansadmin@svl200:~$ sudo vim debug1.yaml
ansadmin@svl200:~$ ansible-playbook debug1.yaml
PLAY [debug]
**********************************************************************************
PLAY RECAP
************************************************************************************
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 res cued=0 ignored=0
PLAY RECAP
************************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 res cued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 res cued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim when.yaml
ansadmin@svl200:~$ ansible-playbook when.yaml
PLAY RECAP
************************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 res cued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 res cued=0 ignored=0
PLAY RECAP
************************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 res cued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 res cued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim when.yaml
ansadmin@svl200:~$ ansible-playbook when.yaml
PLAY RECAP
************************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 res cued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 res cued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim when.yaml
ansadmin@svl200:~$ ansible-playbook when.yaml
PLAY RECAP
************************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 res cued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 res cued=0 ignored=0
PLAY RECAP
************************************************************************************
141.95.160.133 : ok=3 changed=1 unreachable=0
failed=0 skipped=0 res cued=0 ignored=1
146.59.158.16 : ok=3 changed=0 unreachable=0
failed=0 skipped=0 res cued=0 ignored=1
─────────────────────────────────────────────────────────────────────────────────────
──────────
Session stopped
- Press <return> to exit tab
- Press R to restart session
- Press S to save terminal output to file
ofi03@146.59.156.114's password:
┌──────────────────────────────────────────────────────────────────────┐
│ • MobaXterm Personal Edition v22.0 •
│
│ (SSH client, X server and network tools)
│
│
│
│ → SSH session to ofi03@146.59.156.114
│
│ • Direct SSH : v
│
│ • SSH compression : v
│
│ • SSH-browser : v
│
│ • X11-forwarding : v (remote display is forwarded through
SSH) │
│
│
│ → For more info, ctrl+click on help or visit our website.
│
└──────────────────────────────────────────────────────────────────────┘
Welcome to Ubuntu 20.04.5 LTS (GNU/Linux 5.4.0-122-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
https://ubuntu.com/blog/microk8s-memory-optimisation
PLAY [debug]
**********************************************************************************
PLAY RECAP
************************************************************************************
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 res cued=0 ignored=0
PLAY RECAP
************************************************************************************
141.95.160.133 : ok=3 changed=0 unreachable=0
failed=0 skipped=0 res cued=0 ignored=1
146.59.158.16 : ok=3 changed=0 unreachable=0
failed=0 skipped=0 res cued=0 ignored=1
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim when1.yaml
ansadmin@svl200:~$ sudo rm when1.yaml
rm: cannot remove 'when1.yaml': No such file or directory
ansadmin@svl200:~$ sudo rm -f when1.yaml
ansadmin@svl200:~$ ls
cible1.txt debug1.yaml fact1.yaml index.html nginx.yaml when.yaml
debug.yaml fact.yaml handler.yaml ip.txt shell.yml
ansadmin@svl200:~$ sudo cp when.yaml when1.yaml
ansadmin@svl200:~$ sudo vim when1.yaml
ansadmin@svl200:~$ ansible-playbook when1.yaml
PLAY RECAP
************************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 res cued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 res cued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim items.yaml
ansadmin@svl200:~$ ansible-playbook items.yaml
PLAY RECAP
************************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 res cued=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 res cued=0 ignored=0
ansadmin@svl200:~$ ls
cible1.txt debug1.yaml fact1.yaml index.html items.yaml nginx.yaml
when.yaml
debug.yaml fact.yaml handler.yaml ip.txt list.yaml
shell.yml when1.yaml
ansadmin@svl200:~$ ansible cible1 -bm shell -a "ls -lrt /home/ansadmin"
146.59.158.16 | CHANGED | rc=0 >>
total 16
-rw-rw-r-- 1 ansadmin ansadmin 598 Oct 3 13:02 resultat.txt
-rw-r--r-- 1 root root 56 Oct 3 14:02 Debian.txt
-rw-r--r-- 1 root root 35 Oct 3 14:41 var.txt
-rw-r--r-- 1 root root 18 Oct 3 14:46 ip.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init1.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init2.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init3.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init4.txt
ansadmin@svl200:~$ ansible cible1 -bm shell -a "ls -lrt /home/ansadmin"
146.59.158.16 | CHANGED | rc=0 >>
total 16
-rw-rw-r-- 1 ansadmin ansadmin 598 Oct 3 13:02 resultat.txt
-rw-r--r-- 1 root root 56 Oct 3 14:02 Debian.txt
-rw-r--r-- 1 root root 35 Oct 3 14:41 var.txt
-rw-r--r-- 1 root root 18 Oct 3 14:46 ip.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init1.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init2.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init3.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init4.txt
ansadmin@svl200:~$ ansible cible2 -bm shell -a "ls -lrt /home/ansadmin"
141.95.160.133 | CHANGED | rc=0 >>
total 16
-rw-rw-r-- 1 ansadmin ansadmin 598 Oct 3 13:02 resultat.txt
-rw-r--r-- 1 root root 56 Oct 3 14:02 Debian.txt
-rw-r--r-- 1 root root 35 Oct 3 14:41 var.txt
-rw-r--r-- 1 root root 19 Oct 3 14:46 ip.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init1.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init2.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init3.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init4.txt
ansadmin@svl200:~$ ansible all -bm shell -a "ls -lrt /home/ansadmin"
146.59.158.16 | CHANGED | rc=0 >>
total 16
-rw-rw-r-- 1 ansadmin ansadmin 598 Oct 3 13:02 resultat.txt
-rw-r--r-- 1 root root 56 Oct 3 14:02 Debian.txt
-rw-r--r-- 1 root root 35 Oct 3 14:41 var.txt
-rw-r--r-- 1 root root 18 Oct 3 14:46 ip.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init1.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init2.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init3.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init4.txt
141.95.160.133 | CHANGED | rc=0 >>
total 16
-rw-rw-r-- 1 ansadmin ansadmin 598 Oct 3 13:02 resultat.txt
-rw-r--r-- 1 root root 56 Oct 3 14:02 Debian.txt
-rw-r--r-- 1 root root 35 Oct 3 14:41 var.txt
-rw-r--r-- 1 root root 19 Oct 3 14:46 ip.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init1.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init2.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init3.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init4.txt
ansadmin@svl200:~$ ansible all -bma "ls -lrt /home/ansadmin"
usage: ansible [-h] [--version] [-v] [-b] [--become-method BECOME_METHOD]
[--become-user BECOME_USER] [-K] [-i INVENTORY] [--
list-hosts] [-l SUBSET]
[-P POLL_INTERVAL] [-B SECONDS] [-o] [-t TREE] [-k]
[--private-key PRIVATE_KEY_FILE] [-u REMOTE_USER] [-c
CONNECTION] [-T TIMEOUT]
[--ssh-common-args SSH_COMMON_ARGS] [--sftp-extra-args
SFTP_EXTRA_ARGS]
[--scp-extra-args SCP_EXTRA_ARGS] [--ssh-extra-args
SSH_EXTRA_ARGS] [-C]
[--syntax-check] [-D] [-e EXTRA_VARS] [--vault-id
VAULT_IDS]
[--ask-vault-pass | --vault-password-file
VAULT_PASSWORD_FILES] [-f FORKS]
[-M MODULE_PATH] [--playbook-dir BASEDIR] [-a
MODULE_ARGS] [-m MODULE_NAME]
pattern
ansible: error: unrecognized arguments: ls -lrt /home/ansadmin
ansadmin@svl200:~$ ansible all -bm shell -a "ls -lrt /home/ansadmin"
146.59.158.16 | CHANGED | rc=0 >>
total 16
-rw-rw-r-- 1 ansadmin ansadmin 598 Oct 3 13:02 resultat.txt
-rw-r--r-- 1 root root 56 Oct 3 14:02 Debian.txt
-rw-r--r-- 1 root root 35 Oct 3 14:41 var.txt
-rw-r--r-- 1 root root 18 Oct 3 14:46 ip.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init1.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init2.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init3.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init4.txt
141.95.160.133 | CHANGED | rc=0 >>
total 16
-rw-rw-r-- 1 ansadmin ansadmin 598 Oct 3 13:02 resultat.txt
-rw-r--r-- 1 root root 56 Oct 3 14:02 Debian.txt
-rw-r--r-- 1 root root 35 Oct 3 14:41 var.txt
-rw-r--r-- 1 root root 19 Oct 3 14:46 ip.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init1.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init2.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init3.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init4.txt
ansadmin@svl200:~$
ansadmin@svl200:~$
ansadmin@svl200:~$ cp items.yaml seq.yaml
ansadmin@svl200:~$ sudo vim seq.yaml
ansadmin@svl200:~$ ansible-playbook seq.yaml
PLAY [exemple avec items]
*********************************************************************
PLAY RECAP
************************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 res cued=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 res cued=0 ignored=0
─────────────────────────────────────────────────────────────────────────────────────
──────────
Session stopped
- Press <return> to exit tab
- Press R to restart session
- Press S to save terminal output to file
ofi03@146.59.156.114's password:
┌──────────────────────────────────────────────────────────────────────┐
│ • MobaXterm Personal Edition v22.0 •
│
│ (SSH client, X server and network tools)
│
│
│
│ → SSH session to ofi03@146.59.156.114
│
│ • Direct SSH : v
│
│ • SSH compression : v
│
│ • SSH-browser : v
│
│ • X11-forwarding : v (remote display is forwarded through
SSH) │
│
│
│ → For more info, ctrl+click on help or visit our website.
│
└──────────────────────────────────────────────────────────────────────┘
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
https://ubuntu.com/blog/microk8s-memory-optimisation
tasks:
- name: utilisateur
^ here
ansadmin@svl200:~$ sudo vim exo3.yaml
ansadmin@svl200:~$ ansible-playbook exo3.yaml
ERROR! unexpected parameter type in action: <class 'int'>
The error appears to be in '/home/ansadmin/exo3.yaml': line 7, column 7, but may
be elsewhere in the file depending on the exact syntax problem.
tasks:
- name: adduser supervision
^ here
ansadmin@svl200:~$ sudo vim exo3.yaml
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible-playbook exo3.yaml
ERROR! A malformed block was encountered while loading tasks: {'user': [{'name':
'supervision', 'uid': '5000', 'groups': 'rennes'}]} should be a list or None but is
<class 'ansible.parsing.y aml.objects.AnsibleMapping'>
---
- name: creation d'utilisateur
^ here
ansadmin@svl200:~$ sudo vim exo3.yaml
ansadmin@svl200:~$ ansible-playbook exo3.yaml
PLAY RECAP
************************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 res cued=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 res cued=0 ignored=0
tasks:
- name: deploiement
─────────────────────────────────────────────────────────────────────────────────────
──────────
Session stopped
- Press <return> to exit tab
- Press R to restart session
- Press S to save terminal output to file
ofi03@146.59.156.114's password:
┌──────────────────────────────────────────────────────────────────────┐
│ • MobaXterm Personal Edition v22.0 •
│
│ (SSH client, X server and network tools)
│
│
│
│ → SSH session to ofi03@146.59.156.114
│
│ • Direct SSH : v
│
│ • SSH compression : v
│
│ • SSH-browser : v
│
│ • X11-forwarding : v (remote display is forwarded through
SSH) │
│
│
│ → For more info, ctrl+click on help or visit our website.
│
└──────────────────────────────────────────────────────────────────────┘
tasks:
- name: deploiement
^ here
ansadmin@svl200:~$ sudo vim exo4.yaml
ansadmin@svl200:~$ ansible-playbook exo4.yaml
TASK [deploiement]
****************************************************************************
fatal: [146.59.158.16]: FAILED! => {"changed": false, "msg": "No package matching
'apache' is a vailable"}
PLAY RECAP
************************************************************************************
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 res cued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim exo4.yaml
ansadmin@svl200:~$ ansible-playbook exo4.yaml
TASK [deploiement]
****************************************************************************
fatal: [146.59.158.16]: FAILED! => {"changed": false, "msg": "No package matching
'apache' is a vailable"}
fatal: [141.95.160.133]: FAILED! => {"changed": false, "msg": "No package matching
'apache' is available"}
PLAY RECAP
************************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 res cued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 res cued=0 ignored=0
TASK [deploiement]
****************************************************************************
changed: [146.59.158.16]
changed: [141.95.160.133]
PLAY RECAP
************************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 res cued=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 res cued=0 ignored=0
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped= 1 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped= 1 rescued=0 ignored=0
TASK [Creation]
***********************************************************************
skipping: [146.59.158.16]
skipping: [141.95.160.133]
TASK [Creation]
***********************************************************************
changed: [146.59.158.16]
changed: [141.95.160.133]
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped= 1 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped= 1 rescued=0 ignored=0
─────────────────────────────────────────────────────────────────────────────────────
──
Session stopped
- Press <return> to exit tab
- Press R to restart session
- Press S to save terminal output to file
ofi03@146.59.156.114's password:
┌──────────────────────────────────────────────────────────────────────┐
│ • MobaXterm Personal Edition v22.0 •
│
│ (SSH client, X server and network tools)
│
│
│
│ → SSH session to ofi03@146.59.156.114
│
│ • Direct SSH : v
│
│ • SSH compression : v
│
│ • SSH-browser : v
│
│ • X11-forwarding : v (remote display is forwarded through
SSH) │
│
│
│ → For more info, ctrl+click on help or visit our website.
│
└──────────────────────────────────────────────────────────────────────┘
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
https://ubuntu.com/blog/microk8s-memory-optimisation
TASK [Creation]
***********************************************************************
skipping: [146.59.158.16]
skipping: [141.95.160.133]
TASK [Creation]
***********************************************************************
ok: [146.59.158.16]
ok: [141.95.160.133]
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped= 1 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped= 1 rescued=0 ignored=0
ansadmin@svl200:~$ ansible all -bm shell -a "ls -lrt /etc | grep Deb"
146.59.158.16 | FAILED | rc=1 >>
non-zero return code
141.95.160.133 | FAILED | rc=1 >>
non-zero return code
ansadmin@svl200:~$ ansible all -bm shell -a "ls -lrt /etc | grep redhat"
146.59.158.16 | FAILED | rc=1 >>
non-zero return code
141.95.160.133 | FAILED | rc=1 >>
non-zero return code
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible-playbook rep.yaml
TASK [Creation]
***********************************************************************
skipping: [146.59.158.16]
skipping: [141.95.160.133]
TASK [Creation]
***********************************************************************
ok: [146.59.158.16]
ok: [141.95.160.133]
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped= 1 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped= 1 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim rep.yaml
ansadmin@svl200:~$ ansible-playbook rep.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=3 changed=1 unreachable=0
failed=0 skipped= 2 rescued=0 ignored=0
146.59.158.16 : ok=3 changed=1 unreachable=0
failed=0 skipped= 2 rescued=0 ignored=0
ansadmin@svl200:~$ ansible all -bm shell -a "ls -lrt /tmp/redhat | grep redhat"
146.59.158.16 | FAILED | rc=1 >>
ls: cannot access '/tmp/redhat': No such file or directorynon-zero return code
141.95.160.133 | FAILED | rc=1 >>
ls: cannot access '/tmp/redhat': No such file or directorynon-zero return code
ansadmin@svl200:~$ ansible all -bm shell -a "ls -lrt /tmp/redhat"
146.59.158.16 | FAILED | rc=2 >>
ls: cannot access '/tmp/redhat': No such file or directorynon-zero return code
141.95.160.133 | FAILED | rc=2 >>
ls: cannot access '/tmp/redhat': No such file or directorynon-zero return code
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible all -bm shell -a "ls -lrt /tmp/Redhat"
146.59.158.16 | FAILED | rc=2 >>
ls: cannot access '/tmp/Redhat': No such file or directorynon-zero return code
141.95.160.133 | FAILED | rc=2 >>
ls: cannot access '/tmp/Redhat': No such file or directorynon-zero return code
ansadmin@svl200:~$ ansible all -bm shell -a "ls -lrt /tmp/Debian"
146.59.158.16 | CHANGED | rc=0 >>
total 0
-rw-r--r-- 1 root root 0 Oct 4 09:57 Debian.txt
141.95.160.133 | CHANGED | rc=0 >>
total 0
-rw-r--r-- 1 root root 0 Oct 4 09:57 Debian.txt
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible all -bm shell -a "ls -lrt /tmp/Debian"
146.59.158.16 | CHANGED | rc=0 >>
total 0
-rw-r--r-- 1 root root 0 Oct 4 09:57 Debian.txt
141.95.160.133 | CHANGED | rc=0 >>
total 0
-rw-r--r-- 1 root root 0 Oct 4 09:57 Debian.txt
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible-playbook list.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim list.yaml
ansadmin@svl200:~$ sudo vim list.yaml
ansadmin@svl200:~$ ansible-playbook list.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim template.yaml
ansadmin@svl200:~$ sudo vim template.yaml
ansadmin@svl200:~$ sudo vim items.yaml
ansadmin@svl200:~$ ansible-playbook items.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim items.yaml
ansadmin@svl200:~$ ansible all -bm shell -a "ls -lrt /home/ansadmin"
146.59.158.16 | CHANGED | rc=0 >>
total 16
-rw-rw-r-- 1 ansadmin ansadmin 598 Oct 3 13:02 resultat.txt
-rw-r--r-- 1 root root 56 Oct 3 14:02 Debian.txt
-rw-r--r-- 1 root root 35 Oct 3 14:41 var.txt
-rw-r--r-- 1 root root 18 Oct 3 14:46 ip.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops20.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops21.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops22.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops23.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops24.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops25.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops26.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops27.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:19 init1.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:19 init2.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:20 init3.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:20 init4.txt
141.95.160.133 | CHANGED | rc=0 >>
total 16
-rw-rw-r-- 1 ansadmin ansadmin 598 Oct 3 13:02 resultat.txt
-rw-r--r-- 1 root root 56 Oct 3 14:02 Debian.txt
-rw-r--r-- 1 root root 35 Oct 3 14:41 var.txt
-rw-r--r-- 1 root root 19 Oct 3 14:46 ip.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops20.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops21.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops22.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops23.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops24.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops25.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops26.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops27.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:19 init1.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:19 init2.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:20 init3.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:20 init4.txt
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible all -bm shell -a "ls -lrt /home/ansadmin | grep init"
146.59.158.16 | CHANGED | rc=0 >>
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:19 init1.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:19 init2.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:20 init3.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:20 init4.txt
141.95.160.133 | CHANGED | rc=0 >>
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:19 init1.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:19 init2.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:20 init3.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:20 init4.txt
ansadmin@svl200:~$ sudo vim items_users.yaml
ansadmin@svl200:~$ sudo -f items_users.yaml
sudo: invalid option -- 'f'
usage: sudo -h | -K | -k | -V
usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user] [command]
usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p prompt]
[-T timeout] [-u user] [VAR=value] [-i|-s] [<command>]
usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p prompt]
[-T timeout] [-u user] file ...
ansadmin@svl200:~$
ansadmin@svl200:~$ rm items_users.yaml
rm: remove write-protected regular empty file 'items_users.yaml'?
ansadmin@svl200:~$
ansadmin@svl200:~$ cp items.yaml item_users.yaml
ansadmin@svl200:~$ sudo vim items_users.yaml
ansadmin@svl200:~$ ls
cible1.txt exo3.yaml handler.yaml items.yaml
rep.yaml when.yaml
debug.yaml exo4.yaml index.html items_users.yaml seq.yaml
when1.yaml
debug1.yaml fact.yaml ip.txt list.yaml
shell.yml
exo2.yaml fact1.yaml item_users.yaml nginx.yaml
template.yaml
ansadmin@svl200:~$ sudo vim item_users.yaml
ansadmin@svl200:~$ ls
cible1.txt exo3.yaml handler.yaml items.yaml
rep.yaml when.yaml
debug.yaml exo4.yaml index.html items_users.yaml seq.yaml
when1.yaml
debug1.yaml fact.yaml ip.txt list.yaml
shell.yml
exo2.yaml fact1.yaml item_users.yaml nginx.yaml
template.yaml
ansadmin@svl200:~$ sudo vim exo3.yaml
ansadmin@svl200:~$ sudo vim item_users.yaml
ansadmin@svl200:~$ ansible-playbook item_users.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim item_users.yaml
ansadmin@svl200:~$ sudo vim items.yaml
ansadmin@svl200:~$ sudo vim item_users.yaml
ansadmin@svl200:~$ ansible-playbook item_users.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim items.yaml
ansadmin@svl200:~$ sudo vim item_users.yaml
ansadmin@svl200:~$ ansible-playbook item_users.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$ ^C
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim exo3.yaml
ansadmin@svl200:~$ sudo vim item_users.yaml
ansadmin@svl200:~$ ansible-playbook item_users.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$
Network error: Software caused connection abort
─────────────────────────────────────────────────────────────────────────────────────
────
Session stopped
- Press <return> to exit tab
- Press R to restart session
- Press S to save terminal output to file
ofi03@146.59.156.114's password:
┌──────────────────────────────────────────────────────────────────────┐
│ • MobaXterm Personal Edition v22.0 •
│
│ (SSH client, X server and network tools)
│
│
│
│ → SSH session to ofi03@146.59.156.114
│
│ • Direct SSH : v
│
│ • SSH compression : v
│
│ • SSH-browser : v
│
│ • X11-forwarding : v (remote display is forwarded through
SSH) │
│
│
│ → For more info, ctrl+click on help or visit our website.
│
└──────────────────────────────────────────────────────────────────────┘
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
https://ubuntu.com/blog/microk8s-memory-optimisation
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim index.html.j2
ansadmin@svl200:~$ ansible-playbook template.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$ 146.59.158.16^C
ansadmin@svl200:~$ ^C
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim template.yaml
ansadmin@svl200:~$ sudo vim index.html.j2
ansadmin@svl200:~$ ansible-playbook template.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim index.html.j2
ansadmin@svl200:~$ ansible-playbook template.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$ sudo vim index.html.j2
ansadmin@svl200:~$ ansible-playbook template.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ cp index.html.j2 index.html1.j2
ansadmin@svl200:~$ sudo vim index.html1.j2
ansadmin@svl200:~$ sudo vim index.html1.j2
ansadmin@svl200:~$ sudo vim index.html.j2
ansadmin@svl200:~$ ansible-playbook template.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim index.html.j2
ansadmin@svl200:~$ sudo vim index.html.j2
ansadmin@svl200:~$ ansible-playbook template.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim index.html.j2
ansadmin@svl200:~$ sudo vim index.html1.j2
ansadmin@svl200:~$ sudo vim index.html.j2
ansadmin@svl200:~$ sudo vim index.html1.j2
ansadmin@svl200:~$ sudo vim index.html.j2
ansadmin@svl200:~$ sudo vim index.html1.j2
ansadmin@svl200:~$ cp template.yaml template1.yaml
ansadmin@svl200:~$ sudo vim template1.yaml
ansadmin@svl200:~$ ansible-playbook template1.yaml
ERROR! conflicting action statements: user, template
tasks:
- user:
^ here
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim template1.yaml
ansadmin@svl200:~$ ls
cible1.txt exo4.yaml index.html1.j2 nginx.yaml
when.yaml
copie.yaml fact.yaml ip.txt rep.yaml
when1.yaml
debug.yaml fact1.yaml item_users.yaml seq.yaml
debug1.yaml handler.yaml items.yaml shell.yml
exo2.yaml index.html items_users.yaml template.yaml
exo3.yaml index.html.j2 list.yaml template1.yaml
ansadmin@svl200:~$ sudo vim exo4.yaml
ansadmin@svl200:~$ sudo vim exo3.yaml
ansadmin@svl200:~$ sudo vim template1.yaml
ansadmin@svl200:~$ ansible-playbook template1.yaml
ERROR! conflicting action statements: user, template
tasks:
- name: creer user
^ here
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim template1.yaml
ansadmin@svl200:~$ ansible-playbook template1.yaml
ERROR! conflicting action statements: user, template
tasks:
- name: creer user
^ here
ansadmin@svl200:~$ sudo vim template1.yaml
ansadmin@svl200:~$ ansible-playbook template1.yaml
ERROR! conflicting action statements: template, src
tasks:
- name: creer user
^ here
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim template1.yaml
ansadmin@svl200:~$ ansible-playbook template1.yaml
ERROR! conflicting action statements: template, src
tasks:
- name: creer user
^ here
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim template1.yaml
ansadmin@svl200:~$ sudo vim template.yaml
ansadmin@svl200:~$ sudo vim template1.yaml
ansadmin@svl200:~$ ansible-playbook template1.yaml
ERROR! conflicting action statements: template, src
tasks:
- name: creer user
^ here
ansadmin@svl200:~$ w
ansadmin@svl200:~$ sudo vim template1.yaml
ansadmin@svl200:~$ ansible-playbook template1.yaml
ERROR! A malformed block was encountered while loading tasks: {'template': None,
'src': 'index.html1', 'dest': '/var/www/html/index.html1'} should
be a list or None but is <c lass
'ansible.parsing.yaml.objects.AnsibleMapping'>
---
- name: exemple avec template
^ here
ansadmin@svl200:~$ wq
wq: command not found
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim template1.yaml
ansadmin@svl200:~$ ansible-vault create hello.yml
New Vault password: [ERROR]: User interrupted execution
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible-vault create hello.yaml
New Vault password:
Confirm New Vault password:
ansadmin@svl200:~$ cp
.ansible/ cible1.txt handler.yaml
list.yaml
.bash_history copie.yaml hello.yaml
nginx.yaml
.bash_logout debug.yaml index.html
rep.yaml
.bashrc debug1.yaml index.html.j2
seq.yaml
.exo4.yaml.swp exo2.yaml index.html1.j2
shell.yml
.handler.yaml.swp exo3.yaml ip.txt
template.yaml
.profile exo4.yaml item_users.yaml
template1.yaml
.ssh/ fact.yaml items.yaml
when.yaml
.viminfo fact1.yaml items_users.yaml
when1.yaml
ansadmin@svl200:~$ cat template1.yaml >> hello.yaml
ansadmin@svl200:~$ sudo vim hello.yaml
ansadmin@svl200:~$ sudo vim hello.yaml
ansadmin@svl200:~$ ansible-playbook hello.yaml
ERROR! Syntax Error while loading YAML.
found unexpected end of stream
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescgnored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescgnored=0
vars:
- user: ofi03
- port: 80
tasks:
- name: echo variable
debug:
msg: "L'utilisateur {{user}} utilise le port {{port}} sur la
machine {{ansible_hostname
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim play-vars.yaml
ansadmin@svl200:~$ ansible-playbook play-vars.yaml --ask-vault-pass
Vault password:
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescred=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescred=0
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible-vault create play-vars.yml
New Vault password:
Confirm New Vault password:
ansadmin@svl200:~$ cat play-vars.yaml >> play-vars.yml
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim play-vars.yml
ansadmin@svl200:~$ ansible-playbook play-vars.yml --ask-vault-pass
Vault password:
PLAY [Affichage d'une variable globale]
********************************************************
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescred=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescred=0
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescred=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescred=0
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible-playbook play-vars.yml --ask-vault-pass
Vault password:
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescred=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescred=0
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescred=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescred=0
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescred=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescred=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim locale.yml
ansadmin@svl200:~$ cat play-vars.yml >> locale.yml
-bash: locale.yml: Permission denied
ansadmin@svl200:~$ sudo cat play-vars.yml >> locale.yml
-bash: locale.yml: Permission denied
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim play-vars.yml
ansadmin@svl200:~$ sudo vim locale.yml
ansadmin@svl200:~$ ansible-playbook locale.yml
ERROR! Syntax Error while loading YAML.
found unacceptable key (unhashable type: 'AnsibleMapping')
The error appears to be in '/home/ansadmin/locale.yml': line 12, column 15, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
debug:
msg: {{port_http}}
^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:
with_items:
- {{ foo }}
with_items:
- "{{ foo }}"
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim locale.yml
ansadmin@svl200:~$ ansible-playbook locale.yml
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescred=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescred=0
debug:
msg: "{{service["name"] {{service.rpm}}"
^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:
with_items:
- {{ foo }}
with_items:
- "{{ foo }}"
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim var_dic.yml
ansadmin@svl200:~$ ansible-playbook var_dic.yml
ansadmin@svl200:~$
ansadmin@svl200:~$ cp var_dic.yml var_dic1.yml
ansadmin@svl200:~$ sudo vim var_dic1.yml
ansadmin@svl200:~$ ansible-playbook var_dic1.yml
[WARNING]: While constructing a mapping from /home/ansadmin/var_dic1.yml, line 8,
column 14, found a duplicate dict key (name). Using last defined value only.
[WARNING]: While constructing a mapping from /home/ansadmin/var_dic1.yml, line 8,
column 14, found a duplicate dict key (rpm). Using last defined value only.
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim var_dic1.yml
ansadmin@svl200:~$ ansible-playbook var_dic1.yml
ERROR! Syntax Error while loading YAML.
found unexpected end of stream
PLAY RECAP
*****************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim var_dic1.yml
ansadmin@svl200:~$ ansible-playbook var_dic1.yml
[WARNING]: While constructing a mapping from /home/ansadmin/var_dic1.yml, line 8,
column 14,
found a duplicate dict key (name). Using last defined value only.
[WARNING]: While constructing a mapping from /home/ansadmin/var_dic1.yml, line 8,
column 14,
found a duplicate dict key (rpm). Using last defined value only.
ERROR! conflicting action statements: debug, msg
tasks:
- name: var dict
^ here
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim var_dic1.yml
ansadmin@svl200:~$ ansible-playbook var_dic1.yml
[WARNING]: While constructing a mapping from /home/ansadmin/var_dic1.yml, line 8,
column
14, found a duplicate dict key (name). Using last defined value only.
[WARNING]: While constructing a mapping from /home/ansadmin/var_dic1.yml, line 8,
column
14, found a duplicate dict key (rpm). Using last defined value only.
ERROR! conflicting action statements: debug, msg
tasks:
- name: var dict
^ here
ansadmin@svl200:~$ sudo vim var_dic1.yml
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible-playbook var_dic1.yml
ERROR! Syntax Error while loading YAML.
mapping values are not allowed in this context
The error appears to be in '/home/ansadmin/var_dic1.yml': line 13, column 14, but may
be elsewhere in the file depending on the exact syntax problem.
name: mariadb
rpm: mariadb-server
^ here
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim var_dic1.yml
ansadmin@svl200:~$ ansible-playbook var_dic1.yml
ERROR! Syntax Error while loading YAML.
mapping values are not allowed in this context
The error appears to be in '/home/ansadmin/var_dic1.yml': line 13, column 14, but may
be elsewhere in the file depending on the exact syntax problem.
name: mariadb
rpm: mariadb-server
^ here
ansadmin@svl200:~$ sudo vim var_dic1.yml
ansadmin@svl200:~$ ansible-playbook var_dic1.yml
ERROR! Syntax Error while loading YAML.
mapping values are not allowed in this context
The error appears to be in '/home/ansadmin/var_dic1.yml': line 13, column 14, but may
be elsewhere in the file depending on the exact syntax problem.
name: mariadb
rpm: mariadb-server
^ here
ansadmin@svl200:~$ sudo vim var_dic1.yml
ansadmin@svl200:~$ ansible-playbook var_dic1.yml
ERROR! Syntax Error while loading YAML.
mapping values are not allowed in this context
The error appears to be in '/home/ansadmin/var_dic1.yml': line 13, column 14, but may
be elsewhere in the file depending on the exact syntax problem.
name: mariadb
rpm: mariadb-server
^ here
ansadmin@svl200:~$ sudo vim var_dic1.yml
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible-playbook var_dic1.yml
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim var_dic1.yml
ansadmin@svl200:~$ ansible-playbook var_dic1.yml
PLAY [variable locale de type dictionnaire]
************************************************
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
rpm: httpd
db:
^ here
ansadmin@svl200:~$ sudo vim var_dic1.yml
ansadmin@svl200:~$ ansible-playbook var_dic1.yml
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim var_dic1.yml
ansadmin@svl200:~$ ansible-playbook var_dic1.yml
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ cp vim var_dic1.yml var_dic2.yml
cp: target 'var_dic2.yml' is not a directory
ansadmin@svl200:~$ cp var_dic1.yml var_dic2.yml
ansadmin@svl200:~$ sudo vim var_dic2.yml
ansadmin@svl200:~$ mv var_dic2.yml vars.yml
ansadmin@svl200:~$ sudo vim vars.yml
ansadmin@svl200:~$ sudo vim vars_files.yml
ansadmin@svl200:~$
ansadmin@svl200:~$ mv var_dic2.yml vars.yml
mv: cannot stat 'var_dic2.yml': No such file or directory
ansadmin@svl200:~$ sudo vim var_dic2.yml
ansadmin@svl200:~$ mv var_dic1.yml var
var_dic.yml var_dic1.yml vars.yml
ansadmin@svl200:~$ mv var_dic1.yml var_dic2.yml
ansadmin@svl200:~$ sudo vim var_dic2.yml
ansadmin@svl200:~$ ansible-playbook var_dic2.yml
ERROR! 'vars_file' is not a valid attribute for a Play
---
- name: variable locale de type dictionnaire
^ here
ansadmin@svl200:~$ sudo vim var_dic2.yml
ansadmin@svl200:~$ ansible-playbook var_dic2.yml
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible-playbook var_dic2.yml
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible-playbook var_dic2.yml --extra-vars="type=web"
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
─────────────────────────────────────────────────────────────────────────────────────
───────
Session stopped
- Press <return> to exit tab
- Press R to restart session
- Press S to save terminal output to file
ofi03@146.59.156.114's password:
Remote side unexpectedly closed network connection
─────────────────────────────────────────────────────────────────────────────────────
───────
Session stopped
- Press <return> to exit tab
- Press R to restart session
- Press S to save terminal output to file
ofi03@146.59.156.114's password:
┌──────────────────────────────────────────────────────────────────────┐
│ • MobaXterm Personal Edition v22.0 •
│
│ (SSH client, X server and network tools)
│
│
│
│ → SSH session to ofi03@146.59.156.114
│
│ • Direct SSH : v
│
│ • SSH compression : v
│
│ • SSH-browser : v
│
│ • X11-forwarding : v (remote display is forwarded through
SSH) │
│
│
│ → For more info, ctrl+click on help or visit our website.
│
└──────────────────────────────────────────────────────────────────────┘
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
https://ubuntu.com/blog/microk8s-memory-optimisation
user:
name: {{item.key}}
^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:
with_items:
- {{ foo }}
with_items:
- "{{ foo }}"
ansadmin@svl200:~$ sudo vim var_dic_multi3.yml
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible-playbook var_dic_multi3.yml
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim var_dic_multi3.yml
ansadmin@svl200:~$ sudo vim var_dic2.yml
ansadmin@svl200:~$ sudo vim var_dic_multi3.yml
ansadmin@svl200:~$ ansible-playbook var_dic_multi3.yml
ERROR! Syntax Error while loading YAML.
mapping values are not allowed in this context
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
ansadmin@svl200:~$ sudo vim var_dic_multi3.yml
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible-playbook var_dic_multi3.yml
ERROR! Syntax Error while loading YAML.
found unacceptable key (unhashable type: 'AnsibleMapping')
user:
name: {{item.key}}
^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:
with_items:
- {{ foo }}
with_items:
- "{{ foo }}"
ansadmin@svl200:~$ ansible-playbook var_dic_multi3.yml
ERROR! Syntax Error while loading YAML.
found unacceptable key (unhashable type: 'AnsibleMapping')
user:
name: {{item.key}}
^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:
with_items:
- {{ foo }}
with_items:
- "{{ foo }}"
ansadmin@svl200:~$ sudo vim var_dic_multi3.yml
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible-playbook var_dic_multi3.yml
PLAY [variable locale de type dictionnaire multi dimensions]
*******************************
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
tasks:
- name: variable dictionnaire MultiDim
user:
name: "{{item.key}}"
group: "{{item.value.group}}"
state: "{{item.value.state}}"
ofi03@146.59.156.114's password:
┌──────────────────────────────────────────────────────────────────────┐
│ • MobaXterm Personal Edition v22.0 •
│
│ (SSH client, X server and network tools)
│
│
│
│ → SSH session to ofi03@146.59.156.114
│
│ • Direct SSH : v
│
│ • SSH compression : v
│
│ • SSH-browser : v
│
│ • X11-forwarding : v (remote display is forwarded through
SSH) │
│
│
│ → For more info, ctrl+click on help or visit our website.
│
└──────────────────────────────────────────────────────────────────────┘
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
https://ubuntu.com/blog/microk8s-memory-optimisation
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
PLAY RECAP
***************************************************************************
146.59.158.16 : ok=4 changed=2 unreachable=0
failed=0 skipped =0 rescued=0 ignored=0
ansadmin@svl200:~$ 146.59.158.16 ^C
ansadmin@svl200:~$ ^C
ansadmin@svl200:~$ sudo vim handler.yaml
ansadmin@svl200:~$ ansible-playbook handler.yaml
[WARNING]: Could not match supplied host pattern, ignoring: cible{1
[WARNING]: Could not match supplied host pattern, ignoring: 2}
PLAY RECAP
***************************************************************************
141.95.160.133 : ok=4 changed=2 unreachable=0
failed=0 skipped =0 rescued=0 ignored=0
146.59.158.16 : ok=3 changed=0 unreachable=0
failed=0 skipped =0 rescued=0 ignored=0
PLAY RECAP
***************************************************************************
141.95.160.133 : ok=4 changed=2 unreachable=0
failed=0 skipped =0 rescued=0 ignored=0
146.59.158.16 : ok=4 changed=2 unreachable=0
failed=0 skipped =0 rescued=0 ignored=0
tasks:
- name: echo text
shell: echo "{{var1}} is var1, but var2 is {{var2}} >
/home/ansadmin/{{ansible_os_fami
ansadmin@svl200:~$ sudo vim fact.yaml
ansadmin@svl200:~$ ansible-playbook fact.yaml
PLAY [facts]
*******************************************************************************
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 ignored=0
PLAY [facts]
*******************************************************************************
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 ignored=0
ansadmin@svl200:~$ sudo vim fact1.yaml
ansadmin@svl200:~$ ansible-playbook fact1.yaml
PLAY [facts]
*******************************************************************************
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 ignored=0
PLAY [facts]
*******************************************************************************
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 ignored=0
tasks:
- name: echo test
command: echo -e "{{var1}} is var1 it works"
register: results
-name: debug
hosts: cible1
^ here
ansadmin@svl200:~$ sudo vim debug.yaml
ansadmin@svl200:~$ ansible-playbook debug.yaml
PLAY [debug]
*******************************************************************************
PLAY RECAP
*********************************************************************************
146.59.158.16 : ok=3 changed=1 unreachable=0
failed=0 skipped=0 cued=0 ignored=0
PLAY [debug]
*******************************************************************************
PLAY RECAP
*********************************************************************************
146.59.158.16 : ok=3 changed=1 unreachable=0
failed=0 skipped=0 cued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ cp debug.yaml debug1.yaml
ansadmin@svl200:~$ sudo vim debug1.yaml
ansadmin@svl200:~$ ansible-playbook debug1.yaml
PLAY [debug]
*******************************************************************************
PLAY RECAP
*********************************************************************************
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 cued=0 ignored=0
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 cued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 cued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim when.yaml
ansadmin@svl200:~$ ansible-playbook when.yaml
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 cued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 cued=0 ignored=0
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 cued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 cued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim when.yaml
ansadmin@svl200:~$ ansible-playbook when.yaml
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 cued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 cued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim when.yaml
ansadmin@svl200:~$ ansible-playbook when.yaml
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 cued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 cued=0 ignored=0
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=3 changed=1 unreachable=0
failed=0 skipped=0 cued=0 ignored=1
146.59.158.16 : ok=3 changed=0 unreachable=0
failed=0 skipped=0 cued=0 ignored=1
─────────────────────────────────────────────────────────────────────────────────────
───────
Session stopped
- Press <return> to exit tab
- Press R to restart session
- Press S to save terminal output to file
ofi03@146.59.156.114's password:
┌──────────────────────────────────────────────────────────────────────┐
│ • MobaXterm Personal Edition v22.0 •
│
│ (SSH client, X server and network tools)
│
│
│
│ → SSH session to ofi03@146.59.156.114
│
│ • Direct SSH : v
│
│ • SSH compression : v
│
│ • SSH-browser : v
│
│ • X11-forwarding : v (remote display is forwarded through
SSH) │
│
│
│ → For more info, ctrl+click on help or visit our website.
│
└──────────────────────────────────────────────────────────────────────┘
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
https://ubuntu.com/blog/microk8s-memory-optimisation
PLAY [debug]
*******************************************************************************
PLAY RECAP
*********************************************************************************
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 cued=0 ignored=0
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=3 changed=0 unreachable=0
failed=0 skipped=0 cued=0 ignored=1
146.59.158.16 : ok=3 changed=0 unreachable=0
failed=0 skipped=0 cued=0 ignored=1
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim when1.yaml
ansadmin@svl200:~$ sudo rm when1.yaml
rm: cannot remove 'when1.yaml': No such file or directory
ansadmin@svl200:~$ sudo rm -f when1.yaml
ansadmin@svl200:~$ ls
cible1.txt debug1.yaml fact1.yaml index.html nginx.yaml when.yaml
debug.yaml fact.yaml handler.yaml ip.txt shell.yml
ansadmin@svl200:~$ sudo cp when.yaml when1.yaml
ansadmin@svl200:~$ sudo vim when1.yaml
ansadmin@svl200:~$ ansible-playbook when1.yaml
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=1 cued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=1 cued=0 ignored=0
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 cued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 cued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim items.yaml
ansadmin@svl200:~$ ansible-playbook items.yaml
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 cued=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 cued=0 ignored=0
ansadmin@svl200:~$ ls
cible1.txt debug1.yaml fact1.yaml index.html items.yaml nginx.yaml
when.yaml
debug.yaml fact.yaml handler.yaml ip.txt list.yaml
shell.yml when1.yaml
ansadmin@svl200:~$ ansible cible1 -bm shell -a "ls -lrt /home/ansadmin"
146.59.158.16 | CHANGED | rc=0 >>
total 16
-rw-rw-r-- 1 ansadmin ansadmin 598 Oct 3 13:02 resultat.txt
-rw-r--r-- 1 root root 56 Oct 3 14:02 Debian.txt
-rw-r--r-- 1 root root 35 Oct 3 14:41 var.txt
-rw-r--r-- 1 root root 18 Oct 3 14:46 ip.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init1.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init2.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init3.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init4.txt
ansadmin@svl200:~$ ansible cible1 -bm shell -a "ls -lrt /home/ansadmin"
146.59.158.16 | CHANGED | rc=0 >>
total 16
-rw-rw-r-- 1 ansadmin ansadmin 598 Oct 3 13:02 resultat.txt
-rw-r--r-- 1 root root 56 Oct 3 14:02 Debian.txt
-rw-r--r-- 1 root root 35 Oct 3 14:41 var.txt
-rw-r--r-- 1 root root 18 Oct 3 14:46 ip.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init1.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init2.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init3.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init4.txt
ansadmin@svl200:~$ ansible cible2 -bm shell -a "ls -lrt /home/ansadmin"
141.95.160.133 | CHANGED | rc=0 >>
total 16
-rw-rw-r-- 1 ansadmin ansadmin 598 Oct 3 13:02 resultat.txt
-rw-r--r-- 1 root root 56 Oct 3 14:02 Debian.txt
-rw-r--r-- 1 root root 35 Oct 3 14:41 var.txt
-rw-r--r-- 1 root root 19 Oct 3 14:46 ip.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init1.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init2.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init3.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init4.txt
ansadmin@svl200:~$ ansible all -bm shell -a "ls -lrt /home/ansadmin"
146.59.158.16 | CHANGED | rc=0 >>
total 16
-rw-rw-r-- 1 ansadmin ansadmin 598 Oct 3 13:02 resultat.txt
-rw-r--r-- 1 root root 56 Oct 3 14:02 Debian.txt
-rw-r--r-- 1 root root 35 Oct 3 14:41 var.txt
-rw-r--r-- 1 root root 18 Oct 3 14:46 ip.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init1.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init2.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init3.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init4.txt
141.95.160.133 | CHANGED | rc=0 >>
total 16
-rw-rw-r-- 1 ansadmin ansadmin 598 Oct 3 13:02 resultat.txt
-rw-r--r-- 1 root root 56 Oct 3 14:02 Debian.txt
-rw-r--r-- 1 root root 35 Oct 3 14:41 var.txt
-rw-r--r-- 1 root root 19 Oct 3 14:46 ip.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init1.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init2.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init3.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init4.txt
ansadmin@svl200:~$ ansible all -bma "ls -lrt /home/ansadmin"
usage: ansible [-h] [--version] [-v] [-b] [--become-method BECOME_METHOD]
[--become-user BECOME_USER] [-K] [-i INVENTORY] [--
list-hosts] [-l SUBSET]
[-P POLL_INTERVAL] [-B SECONDS] [-o] [-t TREE] [-k]
[--private-key PRIVATE_KEY_FILE] [-u REMOTE_USER] [-c
CONNECTION] [-T TIMEOUT
[--ssh-common-args SSH_COMMON_ARGS] [--sftp-extra-args
SFTP_EXTRA_ARGS]
[--scp-extra-args SCP_EXTRA_ARGS] [--ssh-extra-args
SSH_EXTRA_ARGS] [-C]
[--syntax-check] [-D] [-e EXTRA_VARS] [--vault-id
VAULT_IDS]
[--ask-vault-pass | --vault-password-file
VAULT_PASSWORD_FILES] [-f FORKS]
[-M MODULE_PATH] [--playbook-dir BASEDIR] [-a
MODULE_ARGS] [-m MODULE_NAME]
pattern
ansible: error: unrecognized arguments: ls -lrt /home/ansadmin
ansadmin@svl200:~$ ansible all -bm shell -a "ls -lrt /home/ansadmin"
146.59.158.16 | CHANGED | rc=0 >>
total 16
-rw-rw-r-- 1 ansadmin ansadmin 598 Oct 3 13:02 resultat.txt
-rw-r--r-- 1 root root 56 Oct 3 14:02 Debian.txt
-rw-r--r-- 1 root root 35 Oct 3 14:41 var.txt
-rw-r--r-- 1 root root 18 Oct 3 14:46 ip.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init1.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init2.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init3.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init4.txt
141.95.160.133 | CHANGED | rc=0 >>
total 16
-rw-rw-r-- 1 ansadmin ansadmin 598 Oct 3 13:02 resultat.txt
-rw-r--r-- 1 root root 56 Oct 3 14:02 Debian.txt
-rw-r--r-- 1 root root 35 Oct 3 14:41 var.txt
-rw-r--r-- 1 root root 19 Oct 3 14:46 ip.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init1.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init2.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init3.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:14 init4.txt
ansadmin@svl200:~$
ansadmin@svl200:~$
ansadmin@svl200:~$ cp items.yaml seq.yaml
ansadmin@svl200:~$ sudo vim seq.yaml
ansadmin@svl200:~$ ansible-playbook seq.yaml
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 cued=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 cued=0 ignored=0
─────────────────────────────────────────────────────────────────────────────────────
───────
Session stopped
- Press <return> to exit tab
- Press R to restart session
- Press S to save terminal output to file
ofi03@146.59.156.114's password:
┌──────────────────────────────────────────────────────────────────────┐
│ • MobaXterm Personal Edition v22.0 •
│
│ (SSH client, X server and network tools)
│
│
│
│ → SSH session to ofi03@146.59.156.114
│
│ • Direct SSH : v
│
│ • SSH compression : v
│
│ • SSH-browser : v
│
│ • X11-forwarding : v (remote display is forwarded through
SSH) │
│
│
│ → For more info, ctrl+click on help or visit our website.
│
└──────────────────────────────────────────────────────────────────────┘
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
https://ubuntu.com/blog/microk8s-memory-optimisation
tasks:
- name: utilisateur
^ here
ansadmin@svl200:~$ sudo vim exo3.yaml
ansadmin@svl200:~$ ansible-playbook exo3.yaml
ERROR! unexpected parameter type in action: <class 'int'>
tasks:
- name: adduser supervision
^ here
ansadmin@svl200:~$ sudo vim exo3.yaml
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible-playbook exo3.yaml
ERROR! A malformed block was encountered while loading tasks: {'user': [{'name':
'supervisio 'uid': '5000', 'groups': 'rennes'}]} should be a list or None
but is <class 'ansible.parsin aml.objects.AnsibleMapping'>
---
- name: creation d'utilisateur
^ here
ansadmin@svl200:~$ sudo vim exo3.yaml
ansadmin@svl200:~$ ansible-playbook exo3.yaml
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 cued=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 cued=0 ignored=0
tasks:
- name: deploiement
─────────────────────────────────────────────────────────────────────────────────────
───────
Session stopped
- Press <return> to exit tab
- Press R to restart session
- Press S to save terminal output to file
ofi03@146.59.156.114's password:
┌──────────────────────────────────────────────────────────────────────┐
│ • MobaXterm Personal Edition v22.0 •
│
│ (SSH client, X server and network tools)
│
│
│
│ → SSH session to ofi03@146.59.156.114
│
│ • Direct SSH : v
│
│ • SSH compression : v
│
│ • SSH-browser : v
│
│ • X11-forwarding : v (remote display is forwarded through
SSH) │
│
│
│ → For more info, ctrl+click on help or visit our website.
│
└──────────────────────────────────────────────────────────────────────┘
tasks:
- name: deploiement
^ here
ansadmin@svl200:~$ sudo vim exo4.yaml
ansadmin@svl200:~$ ansible-playbook exo4.yaml
TASK [deploiement]
*************************************************************************
fatal: [146.59.158.16]: FAILED! => {"changed": false, "msg": "No package matching
'apache' i vailable"}
PLAY RECAP
*********************************************************************************
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 cued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim exo4.yaml
ansadmin@svl200:~$ ansible-playbook exo4.yaml
TASK [deploiement]
*************************************************************************
fatal: [146.59.158.16]: FAILED! => {"changed": false, "msg": "No package matching
'apache' i vailable"}
fatal: [141.95.160.133]: FAILED! => {"changed": false, "msg": "No package matching
'apache' available"}
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 cued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 cued=0 ignored=0
TASK [deploiement]
*************************************************************************
changed: [146.59.158.16]
changed: [141.95.160.133]
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 cued=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped=0 cued=0 ignored=0
ansadmin@svl200:~$ sudo vim exo4.yaml
ansadmin@svl200:~$
ansadmin@svl200:~$
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim when1.yaml
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim when.yaml
ansadmin@svl200:~$ sudo vim when1.yaml
ansadmin@svl200:~$ ansible-playbook when1.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped= 1 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped= 1 rescued=0 ignored=0
TASK [Creation]
***********************************************************************
skipping: [146.59.158.16]
skipping: [141.95.160.133]
TASK [Creation]
***********************************************************************
changed: [146.59.158.16]
changed: [141.95.160.133]
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped= 1 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped= 1 rescued=0 ignored=0
─────────────────────────────────────────────────────────────────────────────────────
──
Session stopped
- Press <return> to exit tab
- Press R to restart session
- Press S to save terminal output to file
ofi03@146.59.156.114's password:
┌──────────────────────────────────────────────────────────────────────┐
│ • MobaXterm Personal Edition v22.0 •
│
│ (SSH client, X server and network tools)
│
│
│
│ → SSH session to ofi03@146.59.156.114
│
│ • Direct SSH : v
│
│ • SSH compression : v
│
│ • SSH-browser : v
│
│ • X11-forwarding : v (remote display is forwarded through
SSH) │
│
│
│ → For more info, ctrl+click on help or visit our website.
│
└──────────────────────────────────────────────────────────────────────┘
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
https://ubuntu.com/blog/microk8s-memory-optimisation
TASK [Creation]
***********************************************************************
skipping: [146.59.158.16]
skipping: [141.95.160.133]
TASK [Creation]
***********************************************************************
ok: [146.59.158.16]
ok: [141.95.160.133]
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped= 1 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped= 1 rescued=0 ignored=0
ansadmin@svl200:~$ ansible all -bm shell -a "ls -lrt /etc | grep Deb"
146.59.158.16 | FAILED | rc=1 >>
non-zero return code
141.95.160.133 | FAILED | rc=1 >>
non-zero return code
ansadmin@svl200:~$ ansible all -bm shell -a "ls -lrt /etc | grep redhat"
146.59.158.16 | FAILED | rc=1 >>
non-zero return code
141.95.160.133 | FAILED | rc=1 >>
non-zero return code
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible-playbook rep.yaml
TASK [Creation]
***********************************************************************
skipping: [146.59.158.16]
skipping: [141.95.160.133]
TASK [Creation]
***********************************************************************
ok: [146.59.158.16]
ok: [141.95.160.133]
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped= 1 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped= 1 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim rep.yaml
ansadmin@svl200:~$ ansible-playbook rep.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=3 changed=1 unreachable=0
failed=0 skipped= 2 rescued=0 ignored=0
146.59.158.16 : ok=3 changed=1 unreachable=0
failed=0 skipped= 2 rescued=0 ignored=0
ansadmin@svl200:~$ ansible all -bm shell -a "ls -lrt /tmp/redhat | grep redhat"
146.59.158.16 | FAILED | rc=1 >>
ls: cannot access '/tmp/redhat': No such file or directorynon-zero return code
141.95.160.133 | FAILED | rc=1 >>
ls: cannot access '/tmp/redhat': No such file or directorynon-zero return code
ansadmin@svl200:~$ ansible all -bm shell -a "ls -lrt /tmp/redhat"
146.59.158.16 | FAILED | rc=2 >>
ls: cannot access '/tmp/redhat': No such file or directorynon-zero return code
141.95.160.133 | FAILED | rc=2 >>
ls: cannot access '/tmp/redhat': No such file or directorynon-zero return code
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible all -bm shell -a "ls -lrt /tmp/Redhat"
146.59.158.16 | FAILED | rc=2 >>
ls: cannot access '/tmp/Redhat': No such file or directorynon-zero return code
141.95.160.133 | FAILED | rc=2 >>
ls: cannot access '/tmp/Redhat': No such file or directorynon-zero return code
ansadmin@svl200:~$ ansible all -bm shell -a "ls -lrt /tmp/Debian"
146.59.158.16 | CHANGED | rc=0 >>
total 0
-rw-r--r-- 1 root root 0 Oct 4 09:57 Debian.txt
141.95.160.133 | CHANGED | rc=0 >>
total 0
-rw-r--r-- 1 root root 0 Oct 4 09:57 Debian.txt
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible all -bm shell -a "ls -lrt /tmp/Debian"
146.59.158.16 | CHANGED | rc=0 >>
total 0
-rw-r--r-- 1 root root 0 Oct 4 09:57 Debian.txt
141.95.160.133 | CHANGED | rc=0 >>
total 0
-rw-r--r-- 1 root root 0 Oct 4 09:57 Debian.txt
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible-playbook list.yaml
PLAY [exemple ansible list]
***********************************************************
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim list.yaml
ansadmin@svl200:~$ sudo vim list.yaml
ansadmin@svl200:~$ ansible-playbook list.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim template.yaml
ansadmin@svl200:~$ sudo vim template.yaml
ansadmin@svl200:~$ sudo vim items.yaml
ansadmin@svl200:~$ ansible-playbook items.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim items.yaml
ansadmin@svl200:~$ ansible all -bm shell -a "ls -lrt /home/ansadmin"
146.59.158.16 | CHANGED | rc=0 >>
total 16
-rw-rw-r-- 1 ansadmin ansadmin 598 Oct 3 13:02 resultat.txt
-rw-r--r-- 1 root root 56 Oct 3 14:02 Debian.txt
-rw-r--r-- 1 root root 35 Oct 3 14:41 var.txt
-rw-r--r-- 1 root root 18 Oct 3 14:46 ip.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops20.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops21.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops22.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops23.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops24.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops25.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops26.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops27.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:19 init1.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:19 init2.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:20 init3.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:20 init4.txt
141.95.160.133 | CHANGED | rc=0 >>
total 16
-rw-rw-r-- 1 ansadmin ansadmin 598 Oct 3 13:02 resultat.txt
-rw-r--r-- 1 root root 56 Oct 3 14:02 Debian.txt
-rw-r--r-- 1 root root 35 Oct 3 14:41 var.txt
-rw-r--r-- 1 root root 19 Oct 3 14:46 ip.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops20.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops21.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops22.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops23.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops24.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops25.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops26.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 3 20:36 Devops27.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:19 init1.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:19 init2.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:20 init3.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:20 init4.txt
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible all -bm shell -a "ls -lrt /home/ansadmin | grep init"
146.59.158.16 | CHANGED | rc=0 >>
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:19 init1.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:19 init2.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:20 init3.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:20 init4.txt
141.95.160.133 | CHANGED | rc=0 >>
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:19 init1.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:19 init2.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:20 init3.txt
-rwxrwxr-x 1 ansadmin ansadmin 0 Oct 4 10:20 init4.txt
ansadmin@svl200:~$ sudo vim items_users.yaml
ansadmin@svl200:~$ sudo -f items_users.yaml
sudo: invalid option -- 'f'
usage: sudo -h | -K | -k | -V
usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user] [command]
usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p prompt]
[-T timeout] [-u user] [VAR=value] [-i|-s] [<command>]
usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p prompt]
[-T timeout] [-u user] file ...
ansadmin@svl200:~$
ansadmin@svl200:~$ rm items_users.yaml
rm: remove write-protected regular empty file 'items_users.yaml'?
ansadmin@svl200:~$
ansadmin@svl200:~$ cp items.yaml item_users.yaml
ansadmin@svl200:~$ sudo vim items_users.yaml
ansadmin@svl200:~$ ls
cible1.txt exo3.yaml handler.yaml items.yaml
rep.yaml when.yaml
debug.yaml exo4.yaml index.html items_users.yaml seq.yaml
when1.yaml
debug1.yaml fact.yaml ip.txt list.yaml
shell.yml
exo2.yaml fact1.yaml item_users.yaml nginx.yaml
template.yaml
ansadmin@svl200:~$ sudo vim item_users.yaml
ansadmin@svl200:~$ ls
cible1.txt exo3.yaml handler.yaml items.yaml
rep.yaml when.yaml
debug.yaml exo4.yaml index.html items_users.yaml seq.yaml
when1.yaml
debug1.yaml fact.yaml ip.txt list.yaml
shell.yml
exo2.yaml fact1.yaml item_users.yaml nginx.yaml
template.yaml
ansadmin@svl200:~$ sudo vim exo3.yaml
ansadmin@svl200:~$ sudo vim item_users.yaml
ansadmin@svl200:~$ ansible-playbook item_users.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim item_users.yaml
ansadmin@svl200:~$ sudo vim items.yaml
ansadmin@svl200:~$ sudo vim item_users.yaml
ansadmin@svl200:~$ ansible-playbook item_users.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim items.yaml
ansadmin@svl200:~$ sudo vim item_users.yaml
ansadmin@svl200:~$ ansible-playbook item_users.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$ ^C
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim exo3.yaml
ansadmin@svl200:~$ sudo vim item_users.yaml
ansadmin@svl200:~$ ansible-playbook item_users.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$
Network error: Software caused connection abort
─────────────────────────────────────────────────────────────────────────────────────
────
Session stopped
- Press <return> to exit tab
- Press R to restart session
- Press S to save terminal output to file
ofi03@146.59.156.114's password:
┌──────────────────────────────────────────────────────────────────────┐
│ • MobaXterm Personal Edition v22.0 •
│
│ (SSH client, X server and network tools)
│
│
│
│ → SSH session to ofi03@146.59.156.114
│
│ • Direct SSH : v
│
│ • SSH compression : v
│
│ • SSH-browser : v
│
│ • X11-forwarding : v (remote display is forwarded through
SSH) │
│
│
│ → For more info, ctrl+click on help or visit our website.
│
└──────────────────────────────────────────────────────────────────────┘
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
https://ubuntu.com/blog/microk8s-memory-optimisation
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim index.html.j2
ansadmin@svl200:~$ ansible-playbook template.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$ 146.59.158.16^C
ansadmin@svl200:~$ ^C
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim template.yaml
ansadmin@svl200:~$ sudo vim index.html.j2
ansadmin@svl200:~$ ansible-playbook template.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim index.html.j2
ansadmin@svl200:~$ ansible-playbook template.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=1 unreachable=0
failed=0 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ cp index.html.j2 index.html1.j2
ansadmin@svl200:~$ sudo vim index.html1.j2
ansadmin@svl200:~$ sudo vim index.html1.j2
ansadmin@svl200:~$ sudo vim index.html.j2
ansadmin@svl200:~$ ansible-playbook template.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim index.html.j2
ansadmin@svl200:~$ sudo vim index.html.j2
ansadmin@svl200:~$ ansible-playbook template.yaml
PLAY RECAP
****************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped= 0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim index.html.j2
ansadmin@svl200:~$ sudo vim index.html1.j2
ansadmin@svl200:~$ sudo vim index.html.j2
ansadmin@svl200:~$ sudo vim index.html1.j2
ansadmin@svl200:~$ sudo vim index.html.j2
ansadmin@svl200:~$ sudo vim index.html1.j2
ansadmin@svl200:~$ cp template.yaml template1.yaml
ansadmin@svl200:~$ sudo vim template1.yaml
ansadmin@svl200:~$ ansible-playbook template1.yaml
ERROR! conflicting action statements: user, template
tasks:
- user:
^ here
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim template1.yaml
ansadmin@svl200:~$ ls
cible1.txt exo4.yaml index.html1.j2 nginx.yaml
when.yaml
copie.yaml fact.yaml ip.txt rep.yaml
when1.yaml
debug.yaml fact1.yaml item_users.yaml seq.yaml
debug1.yaml handler.yaml items.yaml shell.yml
exo2.yaml index.html items_users.yaml template.yaml
exo3.yaml index.html.j2 list.yaml template1.yaml
ansadmin@svl200:~$ sudo vim exo4.yaml
ansadmin@svl200:~$ sudo vim exo3.yaml
ansadmin@svl200:~$ sudo vim template1.yaml
ansadmin@svl200:~$ ansible-playbook template1.yaml
ERROR! conflicting action statements: user, template
The error appears to be in '/home/ansadmin/template1.yaml': line 7, column 7, but may
be elsewhere in the file depending on the exact syntax problem.
tasks:
- name: creer user
^ here
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim template1.yaml
ansadmin@svl200:~$ ansible-playbook template1.yaml
ERROR! conflicting action statements: user, template
tasks:
- name: creer user
^ here
ansadmin@svl200:~$ sudo vim template1.yaml
ansadmin@svl200:~$ ansible-playbook template1.yaml
ERROR! conflicting action statements: template, src
tasks:
- name: creer user
^ here
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim template1.yaml
ansadmin@svl200:~$ ansible-playbook template1.yaml
ERROR! conflicting action statements: template, src
tasks:
- name: creer user
^ here
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim template1.yaml
ansadmin@svl200:~$ sudo vim template.yaml
ansadmin@svl200:~$ sudo vim template1.yaml
ansadmin@svl200:~$ ansible-playbook template1.yaml
ERROR! conflicting action statements: template, src
The error appears to be in '/home/ansadmin/template1.yaml': line 10, column 7, but
may
be elsewhere in the file depending on the exact syntax problem.
tasks:
- name: creer user
^ here
ansadmin@svl200:~$ w
ansadmin@svl200:~$ sudo vim template1.yaml
ansadmin@svl200:~$ ansible-playbook template1.yaml
ERROR! A malformed block was encountered while loading tasks: {'template': None,
'src': 'index.html1', 'dest': '/var/www/html/index.html1'} should
be a list or None but is <c lass
'ansible.parsing.yaml.objects.AnsibleMapping'>
---
- name: exemple avec template
^ here
ansadmin@svl200:~$ wq
wq: command not found
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim template1.yaml
ansadmin@svl200:~$ ansible-vault create hello.yml
New Vault password: [ERROR]: User interrupted execution
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible-vault create hello.yaml
New Vault password:
Confirm New Vault password:
ansadmin@svl200:~$ cp
.ansible/ cible1.txt handler.yaml
list.yaml
.bash_history copie.yaml hello.yaml
nginx.yaml
.bash_logout debug.yaml index.html
rep.yaml
.bashrc debug1.yaml index.html.j2
seq.yaml
.exo4.yaml.swp exo2.yaml index.html1.j2
shell.yml
.handler.yaml.swp exo3.yaml ip.txt
template.yaml
.profile exo4.yaml item_users.yaml
template1.yaml
.ssh/ fact.yaml items.yaml
when.yaml
.viminfo fact1.yaml items_users.yaml
when1.yaml
ansadmin@svl200:~$ cat template1.yaml >> hello.yaml
ansadmin@svl200:~$ sudo vim hello.yaml
ansadmin@svl200:~$ sudo vim hello.yaml
ansadmin@svl200:~$ ansible-playbook hello.yaml
ERROR! Syntax Error while loading YAML.
found unexpected end of stream
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 gnored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 gnored=0
vars:
- user: ofi03
- port: 80
tasks:
- name: echo variable
debug:
msg: "L'utilisateur {{user}} utilise le port {{port}} sur la
machine {{ansible_host
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim play-vars.yaml
ansadmin@svl200:~$ ansible-playbook play-vars.yaml --ask-vault-pass
Vault password:
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 red=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 red=0
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible-vault create play-vars.yml
New Vault password:
Confirm New Vault password:
ansadmin@svl200:~$ cat play-vars.yaml >> play-vars.yml
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim play-vars.yml
ansadmin@svl200:~$ ansible-playbook play-vars.yml --ask-vault-pass
Vault password:
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 red=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 red=0
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 red=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 red=0
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible-playbook play-vars.yml --ask-vault-pass
Vault password:
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 red=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 red=0
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 red=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 red=0
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 red=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 red=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim locale.yml
ansadmin@svl200:~$ cat play-vars.yml >> locale.yml
-bash: locale.yml: Permission denied
ansadmin@svl200:~$ sudo cat play-vars.yml >> locale.yml
-bash: locale.yml: Permission denied
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim play-vars.yml
ansadmin@svl200:~$ sudo vim locale.yml
ansadmin@svl200:~$ ansible-playbook locale.yml
ERROR! Syntax Error while loading YAML.
found unacceptable key (unhashable type: 'AnsibleMapping')
The error appears to be in '/home/ansadmin/locale.yml': line 12, column 15, but may
be elsewhere in the file depending on the exact syntax problem.
debug:
msg: {{port_http}}
^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:
with_items:
- {{ foo }}
with_items:
- "{{ foo }}"
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim locale.yml
ansadmin@svl200:~$ ansible-playbook locale.yml
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 red=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 red=0
debug:
msg: "{{service["name"] {{service.rpm}}"
^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:
with_items:
- {{ foo }}
with_items:
- "{{ foo }}"
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim var_dic.yml
ansadmin@svl200:~$ ansible-playbook var_dic.yml
ansadmin@svl200:~$
ansadmin@svl200:~$ cp var_dic.yml var_dic1.yml
ansadmin@svl200:~$ sudo vim var_dic1.yml
ansadmin@svl200:~$ ansible-playbook var_dic1.yml
[WARNING]: While constructing a mapping from /home/ansadmin/var_dic1.yml, line 8,
column 14, found a duplicate dict key (name). Using last defined value only.
[WARNING]: While constructing a mapping from /home/ansadmin/var_dic1.yml, line 8,
column 14, found a duplicate dict key (rpm). Using last defined value only.
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim var_dic1.yml
ansadmin@svl200:~$ ansible-playbook var_dic1.yml
ERROR! Syntax Error while loading YAML.
found unexpected end of stream
PLAY RECAP
*****************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim var_dic1.yml
ansadmin@svl200:~$ ansible-playbook var_dic1.yml
[WARNING]: While constructing a mapping from /home/ansadmin/var_dic1.yml, line 8,
column 14,
found a duplicate dict key (name). Using last defined value only.
[WARNING]: While constructing a mapping from /home/ansadmin/var_dic1.yml, line 8,
column 14,
found a duplicate dict key (rpm). Using last defined value only.
ERROR! conflicting action statements: debug, msg
tasks:
- name: var dict
^ here
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim var_dic1.yml
ansadmin@svl200:~$ ansible-playbook var_dic1.yml
[WARNING]: While constructing a mapping from /home/ansadmin/var_dic1.yml, line 8,
column
14, found a duplicate dict key (name). Using last defined value only.
[WARNING]: While constructing a mapping from /home/ansadmin/var_dic1.yml, line 8,
column
14, found a duplicate dict key (rpm). Using last defined value only.
ERROR! conflicting action statements: debug, msg
tasks:
- name: var dict
^ here
ansadmin@svl200:~$ sudo vim var_dic1.yml
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible-playbook var_dic1.yml
ERROR! Syntax Error while loading YAML.
mapping values are not allowed in this context
The error appears to be in '/home/ansadmin/var_dic1.yml': line 13, column 14, but may
be elsewhere in the file depending on the exact syntax problem.
The error appears to be in '/home/ansadmin/var_dic1.yml': line 13, column 14, but may
be elsewhere in the file depending on the exact syntax problem.
name: mariadb
rpm: mariadb-server
^ here
ansadmin@svl200:~$ sudo vim var_dic1.yml
ansadmin@svl200:~$ ansible-playbook var_dic1.yml
ERROR! Syntax Error while loading YAML.
mapping values are not allowed in this context
The error appears to be in '/home/ansadmin/var_dic1.yml': line 13, column 14, but may
be elsewhere in the file depending on the exact syntax problem.
name: mariadb
rpm: mariadb-server
^ here
ansadmin@svl200:~$ sudo vim var_dic1.yml
ansadmin@svl200:~$ ansible-playbook var_dic1.yml
ERROR! Syntax Error while loading YAML.
mapping values are not allowed in this context
The error appears to be in '/home/ansadmin/var_dic1.yml': line 13, column 14, but may
be elsewhere in the file depending on the exact syntax problem.
name: mariadb
rpm: mariadb-server
^ here
ansadmin@svl200:~$ sudo vim var_dic1.yml
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible-playbook var_dic1.yml
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim var_dic1.yml
ansadmin@svl200:~$ ansible-playbook var_dic1.yml
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim var_dic1.yml
ansadmin@svl200:~$ ansible-playbook var_dic1.yml
tasks:
- name: variable dictionnaire MultiDim
user:
ansadmin@svl200:~$ head -n20 var_dic_multi3.yml
---
- name: variable locale de type dictionnaire multi dimensions
hosts: all
become: true
vars_files:
- /home/ansadmin/vars_multi.yml
tasks:
- name: variable dictionnaire MultiDim
user:
name: "{{item.key}}"
group: "{{item.value.group}}"
state: "{{item.value.state}}"
ofi03@146.59.156.114's password:
┌──────────────────────────────────────────────────────────────────────┐
│ • MobaXterm Personal Edition v22.0 •
│
│ (SSH client, X server and network tools)
│
│
│
│ → SSH session to ofi03@146.59.156.114
│
│ • Direct SSH : v
│
ansadmin@svl200:~$ head -n30 var_dic_multi3.yml
---
- name: variable locale de type dictionnaire multi dimensions
hosts: all
become: true
vars_files:
- /home/ansadmin/vars_multi.yml
tasks:
- name: variable dictionnaire MultiDim
user:
name: "{{item.key}}"
group: "{{item.value.group}}"
state: "{{item.value.state}}"
ofi03@146.59.156.114's password:
┌──────────────────────────────────────────────────────────────────────┐
│ • MobaXterm Personal Edition v22.0 •
│
│ (SSH client, X server and network tools)
│
│
│
│ → SSH session to ofi03@146.59.156.114
│
│ • Direct SSH : v
│
│ • SSH compression : v
│
│ • SSH-browser : v
│
│ • X11-forwarding : v (remote display is forwarded through
SSH) │
│
│
│ → For more info, ctrl+click on help or visit our website.
│
└──────────────────────────────────────────────────────────────────────┘
* Documentation: https://help.ubuntu.com
ansadmin@svl200:~$ ^C
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim var_dic_multi3.yml
ansadmin@svl200:~$ rm var_dic_multi3.yml
ansadmin@svl200:~$ sudo vim var_dic_multi3.yml
ansadmin@svl200:~$ sudo vim var_dic_multi3.yml^C
ansadmin@svl200:~$ sudo vim var_dic_multi3.yml
ansadmin@svl200:~$ ansible-playbook var_dic_multi3.yml
PLAY RECAP
*********************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim vars.yml
ansadmin@svl200:~$ cp vim vars.yml vars2.yml
cp: target 'vars2.yml' is not a directory
ansadmin@svl200:~$ sudo vim vars2.yml
ansadmin@svl200:~$ cp vars.yml vars2.yml
ansadmin@svl200:~$ sudo vim vars2.yml
ansadmin@svl200:~$ cp var_dic_multi3.yml var_dic_multi4.yml
ansadmin@svl200:~$ sudo vim var_dic_multi4.yml
ansadmin@svl200:~$ ls
cible1.txt fact1.yaml item_users.yaml rep.yaml
var_dic_multi4.yml
copie.yaml handler.yaml items.yaml seq.yaml
vars.yml
debug.yaml hello.yaml items_users.yaml shell.yml
vars2.yml
debug1.yaml hello.yml list.yaml template.yaml
vars_multi.yml
exo2.yaml index.html locale.yml template1.yaml
when.yaml
exo3.yaml index.html.j2 nginx.yaml var_dic.yml
when1.yaml
exo4.yaml index.html1.j2 play-vars.yaml var_dic2.yml
fact.yaml ip.txt play-vars.yml var_dic_multi3.yml
ansadmin@svl200:~$ sudo vim var_dic.yml
ansadmin@svl200:~$ sudo vim var_dic2.yml
ansadmin@svl200:~$ sudo vim var_dic_multi4.yml
ansadmin@svl200:~$ sudo vim var_dic.yml
ansadmin@svl200:~$ sudo vim var_dic_multi4.yml
ansadmin@svl200:~$ sudo vim var_dic.yml
ansadmin@svl200:~$ sudo vim var_dic2.yml
ansadmin@svl200:~$ sudo vim var_dic_multi4.yml
ansadmin@svl200:~$ ansible-playbook var_dic_multi4.yml
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc0
ansadmin@svl200:~$ sudo vim var_dic_multi4.yml
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible-playbook var_dic_multi4.yml
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim var_dic_multi4.yml
ansadmin@svl200:~$ sudo vim vars2.yml
ansadmin@svl200:~$ sudo vim var_dic_multi4.yml
ansadmin@svl200:~$ ansible-playbook var_dic_multi4.yml
ERROR! Syntax Error while loading YAML.
did not find expected key
state: latest
when: "{{item.key}}" == "{{service[type]['name']}}"
^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:
with_items:
- {{ foo }}
with_items:
- "{{ foo }}"
ansadmin@svl200:~$ sudo vim var_dic_multi4.yml
ansadmin@svl200:~$
ansadmin@svl200:~$ ansible-playbook var_dic_multi4.yml
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim var_dic_multi4.yml
ansadmin@svl200:~$ ansible-playbook var_dic_multi4.yml
ERROR! Syntax Error while loading YAML.
did not find expected key
state: latest
when: "type==web" and "ansible_os_family=Debian"
^ here
We could be wrong, but this one looks like it might be an issue with
unbalanced quotes. If starting a value with a quote, make sure the
line ends with the same set of quotes. For instance this arbitrary
example:
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc0
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc0
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc0
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim var_dic_multi4.yml
ansadmin@svl200:~$ ansible-playbook var_dic_multi4.yml
[WARNING]: While constructing a mapping from /home/ansadmin/var_dic_multi4.yml, line
9, column 5
duplicate dict key (apt). Using last defined value only.
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim var_dic_multi4.yml
ansadmin@svl200:~$ ansible-playbook var_dic_multi4.yml
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc0
ansadmin@svl200:~$ q
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim var_dic_multi4.yml
ansadmin@svl200:~$ ansible-playbook var_dic_multi4.yml
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc0
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim var_dic_multi4.yml
ansadmin@svl200:~$ ansible-playbook var_dic_multi4.yml
[WARNING]: While constructing a mapping from /home/ansadmin/var_dic_multi4.yml, line
9, column 5
duplicate dict key (apt). Using last defined value only.
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc0
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=0 skipped=1 resc0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=0 skipped=1 resc0
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=0 skipped=1 resc0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=0 skipped=1 resc0
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=0 skipped=1 resc0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=0 skipped=1 resc0
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=0 skipped=2 resc0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=0 skipped=2 resc0
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=1 resc0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=1 resc0
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=1 resc0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=1 resc0
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim group.yml
ansadmin@svl200:~$ mv vim group.yml inventory.yaml
mv: target 'inventory.yaml' is not a directory
ansadmin@svl200:~$ mv group.yml inventory.yaml
ansadmin@svl200:~$ sudo vim inventory.yaml
ansadmin@svl200:~$ ansible-playbook -i inventory.yaml var_dic_multi4.yml --extra-vars
"type=web"
[WARNING]: Skipping key (ansible_port) in group (vars) as it is not a mapping, it is
a <class 'i
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=0 changed=0 unreachable=1
failed=0 skipped=0 resc0
146.59.158.16 : ok=0 changed=0 unreachable=1
failed=0 skipped=0 resc0
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=0 changed=0 unreachable=1
failed=0 skipped=0 resc0
146.59.158.16 : ok=0 changed=0 unreachable=1
failed=0 skipped=0 resc0
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=1 resc0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=1 resc0
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=1 resc
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=1 resc
5 directories, 39 files
ansadmin@svl200:~$
ansadmin@svl200:~$ mkdir host_vars
ansadmin@svl200:~$ mkdir group_vars
ansadmin@svl200:~$ mkdir projet
ansadmin@svl200:~$ mv inventory.yaml var_dic_multi4.yml host_vars group_vars projet/
ansadmin@svl200:~$ cd projet/
ansadmin@svl200:~/projet$ ls
group_vars host_vars inventory.yaml var_dic_multi4.yml
ansadmin@svl200:~/projet$ cd
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim vars2.yml
ansadmin@svl200:~$ cp vars2.yml projet/
ansadmin@svl200:~$
ansadmin@svl200:~$ cd projet/
ansadmin@svl200:~/projet$
ansadmin@svl200:~/projet$ ls -lrt
total 20
-rw-r--r-- 1 ansadmin ansadmin 617 Oct 5 09:45 var_dic_multi4.yml
-rw-r--r-- 1 root root 159 Oct 5 10:20 inventory.yaml
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 10:21 host_vars
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 10:21 group_vars
-rw-r--r-- 1 ansadmin ansadmin 149 Oct 5 10:26 vars2.yml
ansadmin@svl200:~/projet$ mv var_dic_multi4.yml install.yaml
ansadmin@svl200:~/projet$
ansadmin@svl200:~/projet$ ls -lrt
total 20
-rw-r--r-- 1 ansadmin ansadmin 617 Oct 5 09:45 install.yaml
-rw-r--r-- 1 root root 159 Oct 5 10:20 inventory.yaml
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 10:21 host_vars
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 10:21 group_vars
-rw-r--r-- 1 ansadmin ansadmin 149 Oct 5 10:26 vars2.yml
ansadmin@svl200:~/projet$ mv vars2.yml vars_install.yaml
ansadmin@svl200:~/projet$
ansadmin@svl200:~/projet$ ls -lrt
total 20
-rw-r--r-- 1 ansadmin ansadmin 617 Oct 5 09:45 install.yaml
-rw-r--r-- 1 root root 159 Oct 5 10:20 inventory.yaml
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 10:21 host_vars
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 10:21 group_vars
-rw-r--r-- 1 ansadmin ansadmin 149 Oct 5 10:26 vars_install.yaml
ansadmin@svl200:~/projet$ sudo vim inventory.yaml
ansadmin@svl200:~/projet$ sudo vim inventory.yaml
ansadmin@svl200:~/projet$ cd group_vars/
ansadmin@svl200:~/projet/group_vars$ sudo vim port.yaml
ansadmin@svl200:~/projet/group_vars$ mv port.yaml cible1.yaml
ansadmin@svl200:~/projet/group_vars$ cp cible1.yaml cible2.yaml
ansadmin@svl200:~/projet/group_vars$
ansadmin@svl200:~/projet/group_vars$ cd ..
ansadmin@svl200:~/projet$ tree
.
├── group_vars
│ ├── cible1.yaml
│ └── cible2.yaml
├── host_vars
├── install.yaml
├── inventory.yaml
└── vars_install.yaml
2 directories, 5 files
ansadmin@svl200:~/projet$ ansible-playbook -i inventory.yaml var_dic_multi4.yml --
extra-vars "ty
ERROR! the playbook: var_dic_multi4.yml could not be found
ansadmin@svl200:~/projet$ ansible-playbook -i inventory.yaml install.yaml --extra-
vars "type=web
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=1 resc
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=1 resc
ansadmin@svl200:~/projet$
ansadmin@svl200:~/projet$ sudo vim
group_vars/ host_vars/ install.yaml
inventory.yaml vars_install.yaml
ansadmin@svl200:~/projet$ sudo vim inventory.yaml
ansadmin@svl200:~/projet$ sudo vim install.yaml
ansadmin@svl200:~/projet$ ls -lrt
total 20
-rw-r--r-- 1 ansadmin ansadmin 617 Oct 5 09:45 install.yaml
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 10:21 host_vars
-rw-r--r-- 1 ansadmin ansadmin 149 Oct 5 10:26 vars_install.yaml
-rw-r--r-- 1 root root 171 Oct 5 10:30 inventory.yaml
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 10:32 group_vars
ansadmin@svl200:~/projet$ cd group_vars/
ansadmin@svl200:~/projet/group_vars$ ls
cible1.yaml cible2.yaml
ansadmin@svl200:~/projet/group_vars$ sudo vim cible1.yaml
ansadmin@svl200:~/projet/group_vars$ sudo vim cible2.yaml
ansadmin@svl200:~/projet/group_vars$ ls -lrt
ansadmin@svl200:~/projet/group_vars$ ansible-playbook -i inventory.yaml install.yaml
--extra-varERROR! the playbook: install.yaml could not be found
ansadmin@svl200:~/projet/group_vars$ cd
ansadmin@svl200:~$ cd projet/
ansadmin@svl200:~/projet$ ls
group_vars host_vars install.yaml inventory.yaml vars_install.yaml
ansadmin@svl200:~/projet$ ansible-playbook -i inventory.yaml install.yaml --extra-
vars "type=web
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=0 changed=0 unreachable=1
failed=0 skipped=0 rescred=0
146.59.158.16 : ok=0 changed=0 unreachable=1
failed=0 skipped=0 rescred=0
ansadmin@svl200:~/projet$
ansadmin@svl200:~/projet$ cd projet/
-bash: cd: projet/: No such file or directory
ansadmin@svl200:~/projet$
ansadmin@svl200:~/projet$ cd group_vars/
ansadmin@svl200:~/projet/group_vars$ sudo vim cible1.yaml
ansadmin@svl200:~/projet/group_vars$ sudo vim cible2.yaml
ansadmin@svl200:~/projet/group_vars$ cd ..
ansadmin@svl200:~/projet$ ansible-playbook -i inventory.yaml install.yaml --extra-
vars "type=web
PLAY [variable locale de type dictionnaire (service) multi dimensions]
*************************
PLAY RECAP
*************************************************************************************
141.95.160.133 : ok=2 changed=0 unreachable=0
failed=0 skipped=1 rescred=0
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=1 rescred=0
ansadmin@svl200:~/projet$ cd host_vars/
ansadmin@svl200:~/projet/host_vars$ sudo vim client1.yaml
ansadmin@svl200:~/projet/host_vars$ sudo vim client2.yaml
ansadmin@svl200:~/projet/host_vars$ cd ..
ansadmin@svl200:~/projet$ sudo vim install.yaml
ansadmin@svl200:~/projet$ cd host_vars/
ansadmin@svl200:~/projet/host_vars$ ls
client1.yaml client2.yaml
ansadmin@svl200:~/projet/host_vars$ cd ..
ansadmin@svl200:~/projet$ sudo vim inventory.yaml
ansadmin@svl200:~/projet$
ansadmin@svl200:~/projet$ ansible-playbook -i inventory.yaml install.yaml --extra-
vars "type=web
ERROR! Syntax Error while loading YAML.
did not find expected key
with_items:
- {{ foo }}
with_items:
- "{{ foo }}"
ansadmin@svl200:~/projet$ sudo vim install.yaml
ansadmin@svl200:~/projet$ ansible-playbook -i inventory.yaml install.yaml --extra-
vars "type=web
ERROR! conflicting action statements: apt, debug
# ("{{item.key}}" == "{{service[type]['name']}}")
- name: install dbserver
^ here
ansadmin@svl200:~/projet$
ansadmin@svl200:~/projet$ cd host_vars/
ansadmin@svl200:~/projet/host_vars$ sudo vim client1.yaml
ansadmin@svl200:~/projet/host_vars$ sudo vim client2.yaml
ansadmin@svl200:~/projet/host_vars$ cd ..
ansadmin@svl200:~/projet$ ansible-playbook -i inventory.yaml install.yaml --extra-
vars "type=web
ERROR! conflicting action statements: apt, debug
# ("{{item.key}}" == "{{service[type]['name']}}")
- name: install dbserver
^ here
ansadmin@svl200:~/projet$ sudo vim install.yaml
ansadmin@svl200:~/projet$
ansadmin@svl200:~/projet$ ansible-playbook -i inventory.yaml install.yaml --extra-
vars "type=web
ERROR! conflicting action statements: apt, debug
# ("{{item.key}}" == "{{service[type]['name']}}")
- name: install dbserver
^ here
ansadmin@svl200:~/projet$ sudo vim install.yaml
ansadmin@svl200:~/projet$ cd host_vars/
ansadmin@svl200:~/projet/host_vars$ ls
client1.yaml client2.yaml
ansadmin@svl200:~/projet/host_vars$ ll
total 16
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 10:49 ./
drwxrwxr-x 4 ansadmin ansadmin 4096 Oct 5 10:51 ../
-rw-r--r-- 1 root root 13 Oct 5 10:49 client1.yaml
-rw-r--r-- 1 root root 12 Oct 5 10:49 client2.yaml
ansadmin@svl200:~/projet/host_vars$ cd ..
ansadmin@svl200:~/projet$ cd
group_vars/ host_vars/
ansadmin@svl200:~/projet$ cd group_vars/
ansadmin@svl200:~/projet/group_vars$ ls
cible1.yaml cible2.yaml
ansadmin@svl200:~/projet/group_vars$ sudo vim cible1.yaml
ansadmin@svl200:~/projet/group_vars$
ansadmin@svl200:~/projet/group_vars$ cd ..
ansadmin@svl200:~/projet$ cd host_vars/
ansadmin@svl200:~/projet/host_vars$ ls
client1.yaml client2.yaml
ansadmin@svl200:~/projet/host_vars$ sudo vim client1.yaml
ansadmin@svl200:~/projet/host_vars$ sudo vim client2.yaml
ansadmin@svl200:~/projet/host_vars$ cd ..
ansadmin@svl200:~/projet$ ansible-playbook -i inventory.yaml install.yaml --extra-
vars "type=web
ERROR! conflicting action statements: apt, debug
# ("{{item.key}}" == "{{service[type]['name']}}")
- name: install dbserver
^ here
ansadmin@svl200:~/projet$ sudo vim install.yaml
ansadmin@svl200:~/projet$ ansible-playbook -i inventory.yaml install.yaml --extra-
vars "type=web
ERROR! conflicting action statements: apt, debug
# ("{{item.key}}" == "{{service[type]['name']}}")
- name: install dbserver
^ here
ansadmin@svl200:~/projet$ sudo vim install.yaml
ansadmin@svl200:~/projet$
ansadmin@svl200:~/projet$ ansible-playbook -i inventory.yaml install.yaml --extra-
vars "type=web
ERROR! conflicting action statements: apt, debug
The error appears to be in '/home/ansadmin/projet/install.yaml': line 15, column 5,
but may
be elsewhere in the file depending on the exact syntax problem.
---
- name: variable locale de type dictionnaire (service) multi dimensions
^ here
ansadmin@svl200:~/projet$ sudo vim install.yaml
ansadmin@svl200:~/projet$ ansible-playbook -i inventory.yaml install.yaml --extra-
vars "type=web
ERROR! conflicting action statements: apt, debug
debug:
^ here
ansadmin@svl200:~/projet$ sudo vim install.yaml
ansadmin@svl200:~/projet$
ansadmin@svl200:~/projet$ cd
ansadmin@svl200:~$ sudo vim
.ansible/ copie.yaml hello.yml
nginx.yaml var_dic.yml
.bash_history debug.yaml index.html
play-vars.yaml var_dic2.yml
.bash_logout debug1.yaml index.html.j2
play-vars.yml var_dic_multi3.y
.bashrc exo2.yaml index.html1.j2
projet/ vars.yml
.exo4.yaml.swp exo3.yaml ip.txt
rep.yaml vars2.yml
.handler.yaml.swp exo4.yaml item_users.yaml
seq.yaml vars_multi.yml
.profile fact.yaml items.yaml
shell.yml when.yaml
.ssh/ fact1.yaml items_users.yaml
snap/ when1.yaml
.viminfo handler.yaml list.yaml
template.yaml
cible1.txt hello.yaml locale.yml
template1.yaml
ansadmin@svl200:~$ sudo vim debug.yaml
ansadmin@svl200:~$ cd projet/
ansadmin@svl200:~/projet$ sudo vim install.yaml
ansadmin@svl200:~/projet$ ansible-playbook -i inventory.yaml install.yaml --extra-
vars "type=web
ERROR! conflicting action statements: apt, debug
PLAY RECAP
*************************************************************************************
client1 : ok=0 changed=0
unreachable=1 failed=0 skipped=0 rescred=0
client2 : ok=0 changed=0
unreachable=1 failed=0 skipped=0 rescred=0
ansadmin@svl200:~/projet$ cd host_vars/
ansadmin@svl200:~/projet/host_vars$ ls
client1.yaml client2.yaml
ansadmin@svl200:~/projet/host_vars$ sudo vim client1.yaml
ansadmin@svl200:~/projet/host_vars$ sudo vim client2.yaml
ansadmin@svl200:~/projet/host_vars$ cd ..
ansadmin@svl200:~/projet$ cd group_vars/
ansadmin@svl200:~/projet/group_vars$ ls
cible1.yaml cible2.yaml
ansadmin@svl200:~/projet/group_vars$ sudo vim cible1.yaml
ansadmin@svl200:~/projet/group_vars$ sudo vim cible2.yaml
ansadmin@svl200:~/projet/group_vars$
ansadmin@svl200:~/projet/group_vars$ cd ..
ansadmin@svl200:~/projet$ ansible-playbook -i inventory.yaml install.yaml --extra-
vars "type=web
PLAY RECAP
*************************************************************************************
client1 : ok=0 changed=0
unreachable=1 failed=0 skipped=0 rescred=0
client2 : ok=0 changed=0
unreachable=1 failed=0 skipped=0 rescred=0
debug:
^ here
ansadmin@svl200:~/projet$
ansadmin@svl200:~/projet$ sudo vim install.yaml
ansadmin@svl200:~/projet$ ansible-playbook -i inventory.yaml install.yaml --extra-
vars "type=web
ERROR! Syntax Error while loading YAML.
mapping values are not allowed in this context
PLAY RECAP
*************************************************************************************
client1 : ok=0 changed=0
unreachable=1 failed=0 skipped=0 rescred=0
client2 : ok=0 changed=0
unreachable=1 failed=0 skipped=0 rescred=0
ansadmin@svl200:~/projet$
ansadmin@svl200:~/projet$ ll
total 28
drwxrwxr-x 4 ansadmin ansadmin 4096 Oct 5 11:47 ./
drwxr-xr-x 6 ansadmin ansadmin 4096 Oct 5 11:29 ../
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 11:43 group_vars/
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 11:40 host_vars/
-rw-r--r-- 1 ansadmin ansadmin 563 Oct 5 11:47 install.yaml
-rw-r--r-- 1 root root 158 Oct 5 11:31 inventory.yaml
-rw-r--r-- 1 ansadmin ansadmin 149 Oct 5 10:26 vars_install.yaml
ansadmin@svl200:~/projet$
ansadmin@svl200:~/projet$ tree
.
├── group_vars
│ ├── cible1.yaml
│ └── cible2.yaml
├── host_vars
│ ├── client1.yaml
│ └── client2.yaml
├── install.yaml
├── inventory.yaml
└── vars_install.yaml
2 directories, 7 files
ansadmin@svl200:~/projet$ cd
ansadmin@svl200:~$
ansadmin@svl200:~$ mkdir projet1
ansadmin@svl200:~$ cd projet1
ansadmin@svl200:~/projet1$ mkdir roles
ansadmin@svl200:~/projet1$ cd roles/
ansadmin@svl200:~/projet1/roles$ mkdir apache
ansadmin@svl200:~/projet1/roles$ cd apache/
ansadmin@svl200:~/projet1/roles/apache$ tree
.
0 directories, 0 files
ansadmin@svl200:~/projet1/roles/apache$ pwd
/home/ansadmin/projet1/roles/apache
ansadmin@svl200:~/projet1/roles/apache$ mkdir tasks vars templates handlers
ansadmin@svl200:~/projet1/roles/apache$ tree
.
├── handlers
├── tasks
├── templates
└── vars
4 directories, 0 files
ansadmin@svl200:~/projet1/roles/apache$ touch tasks/main.yml
ansadmin@svl200:~/projet1/roles/apache$ touch vars/main.yml
ansadmin@svl200:~/projet1/roles/apache$ touch handlers/main.yml
ansadmin@svl200:~/projet1/roles/apache$ tree
.
├── handlers
│ └── main.yml
├── tasks
│ └── main.yml
├── templates
└── vars
└── main.yml
4 directories, 3 files
ansadmin@svl200:~/projet1/roles/apache$ sudo vim tasks/main.yml
ansadmin@svl200:~/projet1/roles/apache$ sudo vim handlers/main.yml
ansadmin@svl200:~/projet1/roles/apache$ sudo vim vars/main.yml
ansadmin@svl200:~/projet1/roles/apache$ sudo vim t
tasks/ templates/
ansadmin@svl200:~/projet1/roles/apache$ sudo vim templates/index.html.j2
ansadmin@svl200:~/projet1/roles/apache$ cd ..
ansadmin@svl200:~/projet1/roles$ cd ..
ansadmin@svl200:~/projet1$ sudo vim hosts.yml
ansadmin@svl200:~/projet1$ sudo vim site.yml
ansadmin@svl200:~/projet1$ sudo vim templates/index.html.j2
ansadmin@svl200:~/projet1$ cd roles/apache
ansadmin@svl200:~/projet1/roles/apache$ sudo vim templates/index.html.j2
ansadmin@svl200:~/projet1/roles/apache$ sudo vim vars/main.yml
ansadmin@svl200:~/projet1/roles/apache$
ansadmin@svl200:~/projet1/roles/apache$ cd ..
ansadmin@svl200:~/projet1/roles$ cd ..
ansadmin@svl200:~/projet1$ ansible-playbook -i
hosts.yml roles/ site.yml
ansadmin@svl200:~/projet1$ ansible-playbook -i hosts.yml site.yml
[WARNING]: provided hosts list is empty, only localhost is available. Note that the
implicit loc
PLAY [install apache]
**************************************************************************
skipping: no hosts matched
PLAY RECAP
*************************************************************************************
PLAY RECAP
*************************************************************************************
client1 : ok=0 changed=0
unreachable=1 failed=0 skipped=0 resc
ansadmin@svl200:~/projet1$ tree
.
├── hosts.yml
├── roles
│ └── apache
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── site.yml
6 directories, 6 files
ansadmin@svl200:~/projet1$ curl client1
curl: (6) Could not resolve host: client1
ansadmin@svl200:~/projet1$
ansadmin@svl200:~/projet1$ tree
.
├── hosts.yml
├── roles
│ └── apache
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── site.yml
6 directories, 6 files
ansadmin@svl200:~/projet1$ mkdir group_vars
ansadmin@svl200:~/projet1$ mkdir hosts_vars
ansadmin@svl200:~/projet1$ cat roles/apache/tasks/main.yml
---
- name: install apache
apt:
name: apache2
state: latest
8 directories, 6 files
ansadmin@svl200:~/projet1$ ansible-playbook -i hosts.yml site.yml
ERROR! failed to combine variables, expected dicts but got a 'dict' and a
'AnsibleSequence':
{}
[{"file_version": 4.42}]
ansadmin@svl200:~/projet1$
ansadmin@svl200:~/projet1$ ansible-playbook -i hosts.yml site.yml
ERROR! failed to combine variables, expected dicts but got a 'dict' and a
'AnsibleSequence':
{}
[{"file_version": 4.42}]
ansadmin@svl200:~/projet1$ cat roles/apache/templates/index.html.j2
Je suis un fichier de test
Je suis deploye sur le serveur {{ansible_hostname}} avec apache version
{{file_version}}
ansadmin@svl200:~/projet1$ sudo vim roles/apache/vars/main.yml
ansadmin@svl200:~/projet1$ cat roles/apache/templates/index.html.j2
Je suis un fichier de test
Je suis deploye sur le serveur {{ansible_hostname}} avec apache version
{{file_version}}
ansadmin@svl200:~/projet1$ ansible-playbook -i hosts.yml site.yml
ERROR! failed to combine variables, expected dicts but got a 'dict' and a
'AnsibleSequence':
{}
[{"file_version": 4.42}]
ansadmin@svl200:~/projet1$ sudo vim roles/apache/
handlers/ tasks/ templates/ vars/
ansadmin@svl200:~/projet1$ sudo vim roles/apache/tasks/main.yml
ansadmin@svl200:~/projet1$ ansible-playbook -i hosts.yml site.yml
ERROR! failed to combine variables, expected dicts but got a 'dict' and a
'AnsibleSequence':
{}
[{"file_version": 4.42}]
ansadmin@svl200:~/projet1$
ansadmin@svl200:~/projet1$ tree
.
├── group_vars
├── hosts.yml
├── hosts_vars
├── roles
│ └── apache
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── site.yml
8 directories, 6 files
ansadmin@svl200:~/projet1$ ansible-playbook -i hosts.yml site.yml
ERROR! failed to combine variables, expected dicts but got a 'dict' and a
'AnsibleSequence':
{}
[{"file_version": 4.42}]
ansadmin@svl200:~/projet1$ sudo vim roles/apache/vars/main.yml
ansadmin@svl200:~/projet1$ ansible-playbook -i hosts.yml site.yml
PLAY RECAP
*************************************************************************************
client1 : ok=0 changed=0
unreachable=1 failed=0 skipped=0 resc
ansadmin@svl200:~/projet1$ cd
ansadmin@svl200:~$ sudo vim /etc/hosts
ansadmin@svl200:~$
ansadmin@svl200:~$ cd projet1/
ansadmin@svl200:~/projet1$ ansible-playbook -i hosts.yml site.yml
PLAY RECAP
*************************************************************************************
client1 : ok=0 changed=0
unreachable=1 failed=0 skipped=0 resc
ansadmin@svl200:~/projet1$ tree
.
├── group_vars
├── hosts.yml
├── hosts_vars
├── roles
│ └── apache
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── site.yml
8 directories, 6 files
ansadmin@svl200:~/projet1$ cat hosts
hosts.yml hosts_vars/
ansadmin@svl200:~/projet1$ cat hosts
hosts.yml hosts_vars/
ansadmin@svl200:~/projet1$ cat hosts.yml
all:
children:
cible1:
hosts:
client1:
ansadmin@svl200:~/projet1$
ansadmin@svl200:~/projet1$ ansible-playbook -i hosts.yml site.yml
PLAY RECAP
*************************************************************************************
client1 : ok=0 changed=0
unreachable=1 failed=0 skipped=0 resc
ansadmin@svl200:~/projet1$ cd
ansadmin@svl200:~$ sudo vim /etc/hosts
ansadmin@svl200:~$ cd projet1/
ansadmin@svl200:~/projet1$ ansible -i
group_vars/ hosts.yml hosts_vars/ roles/ site.yml
ansadmin@svl200:~/projet1$ ansible -i hosts.yml client1 -m ping
client1 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ssh: connect to host client1
port 22: Connect
"unreachable": true
}
ansadmin@svl200:~/projet1$ cd roles/
ansadmin@svl200:~/projet1/roles$ ls
apache
ansadmin@svl200:~/projet1/roles$ cd apache/
ansadmin@svl200:~/projet1/roles/apache$ ls
handlers tasks templates vars
ansadmin@svl200:~/projet1/roles/apache$ sudo vim vars/main.yml
ansadmin@svl200:~/projet1/roles/apache$ sudo vim
handlers/ tasks/ templates/ vars/
ansadmin@svl200:~/projet1/roles/apache$ sudo vim handlers/main.yml
ansadmin@svl200:~/projet1/roles/apache$ sudo vim templates/
ansadmin@svl200:~/projet1/roles/apache$ sudo vim templates/index.html.j2
ansadmin@svl200:~/projet1/roles/apache$
ansadmin@svl200:~/projet1/roles/apache$ sudo vim
handlers/ tasks/ templates/ vars/
ansadmin@svl200:~/projet1/roles/apache$ sudo vim
handlers/ tasks/ templates/ vars/
ansadmin@svl200:~/projet1/roles/apache$ cd ..
ansadmin@svl200:~/projet1/roles$ ll
total 12
drwxrwxr-x 3 ansadmin ansadmin 4096 Oct 5 12:14 ./
drwxrwxr-x 5 ansadmin ansadmin 4096 Oct 5 12:39 ../
drwxrwxr-x 6 ansadmin ansadmin 4096 Oct 5 12:15 apache/
ansadmin@svl200:~/projet1/roles$ cd ..
ansadmin@svl200:~/projet1$ ll
total 28
drwxrwxr-x 5 ansadmin ansadmin 4096 Oct 5 12:39 ./
drwxr-xr-x 7 ansadmin ansadmin 4096 Oct 5 12:13 ../
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 12:37 group_vars/
-rw-r--r-- 1 root root 73 Oct 5 12:33 hosts.yml
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 12:37 hosts_vars/
drwxrwxr-x 3 ansadmin ansadmin 4096 Oct 5 12:14 roles/
-rw-r--r-- 1 root root 80 Oct 5 12:39 site.yml
ansadmin@svl200:~/projet1$ sudo vim site.yml
ansadmin@svl200:~/projet1$
ansadmin@svl200:~/projet1$ ansible-playbook -i hosts.yml site.yml
PLAY RECAP
*************************************************************************************
client1 : ok=0 changed=0
unreachable=1 failed=0 skipped=0 resc
ansadmin@svl200:~/projet1$
ansadmin@svl200:~/projet1$ ansible -i hosts.yml client1 -m ping
client1 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ssh: connect to host client1
port 22: Connect
"unreachable": true
}
ansadmin@svl200:~/projet1$ tree
.
├── group_vars
├── hosts.yml
├── hosts_vars
├── roles
│ └── apache
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── site.yml
8 directories, 6 files
ansadmin@svl200:~/projet1$ cd group_vars/
ansadmin@svl200:~/projet1/group_vars$ ls
ansadmin@svl200:~/projet1/group_vars$ sudo vim all.yml
ansadmin@svl200:~/projet1/group_vars$ cd ..
ansadmin@svl200:~/projet1$ ansible -i hosts.yml client1 -m ping
The authenticity of host '[client1]:55600 ([146.59.158.16]:55600)' can't be
established.
ECDSA key fingerprint is SHA256:aQH+1UeVJklKq8A45Soa63iOGGkNRC/op7o5MgPiJtc.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
client1 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"ping": "pong"
}
ansadmin@svl200:~/projet1$
ansadmin@svl200:~/projet1$ ansible -i hosts.yml client1 -m ping
client1 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"ping": "pong"
}
ansadmin@svl200:~/projet1$ ansible-playbook -i hosts.yml site.yml
PLAY RECAP
*************************************************************************************
client1 : ok=3 changed=1
unreachable=0 failed=1 skipped=0 resc
ansadmin@svl200:~/projet1$ cd
ansadmin@svl200:~$ ansible all -m service -a "name=nginx state= stopped"
ERROR! this task 'service' has extra params, which is only allowed in the following
mo dules: include_role, import_tasks, win_command, add_host,
include_vars, group_by, set_ fact, win_shell, script,
include_tasks, command, import_role, raw, meta, include, shel l
ansadmin@svl200:~$ cd projet/
group_vars/ host_vars/
ansadmin@svl200:~$ cd projet1/
group_vars/ hosts_vars/ roles/
ansadmin@svl200:~$ cd projet1/roles/apache/
handlers/ tasks/ templates/ vars/
ansadmin@svl200:~$ sudo vim projet1/roles/apache/vars/
ansadmin@svl200:~$ sudo vim projet1/roles/apache/vars/main.yml
ansadmin@svl200:~$ cd projet1
ansadmin@svl200:~/projet1$
ansadmin@svl200:~/projet1$ tree
.
├── group_vars
│ └── all.yml
├── hosts.yml
├── hosts_vars
├── roles
│ └── apache
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── site.yml
8 directories, 7 files
ansadmin@svl200:~/projet1$ cd group_vars/
ansadmin@svl200:~/projet1/group_vars$ sudo vim all.yml
ansadmin@svl200:~/projet1/group_vars$
ansadmin@svl200:~/projet1/group_vars$ cd ..
ansadmin@svl200:~/projet1$ ansible all -bm service -a "name=nginx state=stopped"
146.59.158.16 | CHANGED => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": true,
"name": "nginx",
"state": "stopped",
"status": {
"ActiveEnterTimestamp": "Mon 2022-10-03 13:38:38 UTC",
"ActiveEnterTimestampMonotonic": "3302273985318",
"ActiveExitTimestamp": "Mon 2022-10-03 13:38:38 UTC",
"ActiveExitTimestampMonotonic": "3302273891667",
"ActiveState": "active",
"After": "basic.target systemd-journald.socket system.slice
network.target sys init.target",
"AllowIsolate": "no",
"AllowedCPUs": "",
"AllowedMemoryNodes": "",
"AmbientCapabilities": "",
"AssertResult": "yes",
"AssertTimestamp": "Mon 2022-10-03 13:38:38 UTC",
"AssertTimestampMonotonic": "3302273921869",
"Before": "shutdown.target multi-user.target",
"BlockIOAccounting": "no",
"BlockIOWeight": "[not set]",
"CPUAccounting": "no",
"CPUAffinity": "",
"CPUAffinityFromNUMA": "no",
"CPUQuotaPerSecUSec": "infinity",
"CPUQuotaPeriodUSec": "infinity",
"CPUSchedulingPolicy": "0",
"CPUSchedulingPriority": "0",
"CPUSchedulingResetOnFork": "no",
"CPUShares": "[not set]",
"CPUUsageNSec": "[not set]",
"CPUWeight": "[not set]",
"CacheDirectoryMode": "0755",
"CanIsolate": "no",
"CanReload": "yes",
"CanStart": "yes",
"CanStop": "yes",
"CapabilityBoundingSet": "cap_chown cap_dac_override
cap_dac_read_search cap_f owner cap_fsetid cap_kill cap_setgid
cap_setuid cap_setpcap cap_linux_immutable cap_ne t_bind_service
cap_net_broadcast cap_net_admin cap_net_raw cap_ipc_lock cap_ipc_owner
cap_sys_module cap_sys_rawio cap_sys_chroot cap_sys_ptrace cap_sys_pacct
cap_sys_admin cap_sys_boot cap_sys_nice cap_sys_resource
cap_sys_time cap_sys_tty_config cap_mknod cap_lease
cap_audit_write cap_audit_control cap_setfcap cap_mac_override cap_mac_admin
cap_syslog cap_wake_alarm cap_block_suspend cap_audit_read",
"CleanResult": "success",
"CollectMode": "inactive",
"ConditionResult": "yes",
"ConditionTimestamp": "Mon 2022-10-03 13:38:38 UTC",
"ConditionTimestampMonotonic": "3302273921868",
"ConfigurationDirectoryMode": "0755",
"Conflicts": "shutdown.target",
"ControlGroup": "/system.slice/nginx.service",
"ControlPID": "0",
"DefaultDependencies": "yes",
"DefaultMemoryLow": "0",
"DefaultMemoryMin": "0",
"Delegate": "no",
"Description": "A high performance web server and a reverse proxy
server",
"DevicePolicy": "auto",
"Documentation": "man:nginx(8)",
"DynamicUser": "no",
"EffectiveCPUs": "",
"EffectiveMemoryNodes": "",
"ExecMainCode": "0",
"ExecMainExitTimestampMonotonic": "0",
"ExecMainPID": "259389",
"ExecMainStartTimestamp": "Mon 2022-10-03 13:38:38 UTC",
"ExecMainStartTimestampMonotonic": "3302273985272",
"ExecMainStatus": "0",
"ExecReload": "{ path=/usr/sbin/nginx ; argv[]=/usr/sbin/nginx -g
daemon on; m aster_process on; -s reload ; ignore_errors=no ;
start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ;
status=0/0 }",
"ExecReloadEx": "{ path=/usr/sbin/nginx ; argv[]=/usr/sbin/nginx -g
daemon on; master_process on; -s reload ; flags= ;
start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ;
status=0/0 }",
"ExecStart": "{ path=/usr/sbin/nginx ; argv[]=/usr/sbin/nginx -g
daemon on; ma ster_process on; ; ignore_errors=no ;
start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; cod e=(null) ;
status=0/0 }",
"ExecStartEx": "{ path=/usr/sbin/nginx ; argv[]=/usr/sbin/nginx -g
daemon on; master_process on; ; flags= ; start_time=[n/a] ;
stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 }",
"ExecStartPre": "{ path=/usr/sbin/nginx ; argv[]=/usr/sbin/nginx -t -
q -g daem on on; master_process on; ; ignore_errors=no ;
start_time=[n/a] ; stop_time=[n/a] ; pi d=0 ; code=(null) ;
status=0/0 }",
"ExecStartPreEx": "{ path=/usr/sbin/nginx ; argv[]=/usr/sbin/nginx -t
-q -g da emon on; master_process on; ; flags= ; start_time=[n/a] ;
stop_time=[n/a] ; pid=0 ; co de=(null) ; status=0/0 }",
"ExecStop": "{ path=/sbin/start-stop-daemon ; argv[]=/sbin/start-
stop-daemon - -quiet --stop --retry QUIT/5 --pidfile
/run/nginx.pid ; ignore_errors=yes ; start_time =[n/a] ;
stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 }",
"ExecStopEx": "{ path=/sbin/start-stop-daemon ; argv[]=/sbin/start-
stop-daemon --quiet --stop --retry QUIT/5 --pidfile
/run/nginx.pid ; flags=ignore-failure ; start _time=[n/a] ;
stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 }",
"FailureAction": "none",
"FileDescriptorStoreMax": "0",
"FinalKillSignal": "9",
"FragmentPath": "/lib/systemd/system/nginx.service",
"GID": "[not set]",
"GuessMainPID": "yes",
"IOAccounting": "no",
"IOReadBytes": "18446744073709551615",
"IOReadOperations": "18446744073709551615",
"IOSchedulingClass": "0",
"IOSchedulingPriority": "0",
"IOWeight": "[not set]",
"IOWriteBytes": "18446744073709551615",
"IOWriteOperations": "18446744073709551615",
"IPAccounting": "no",
"IPEgressBytes": "[no data]",
"IPEgressPackets": "[no data]",
"IPIngressBytes": "[no data]",
"IPIngressPackets": "[no data]",
"Id": "nginx.service",
"IgnoreOnIsolate": "no",
"IgnoreSIGPIPE": "yes",
"InactiveEnterTimestamp": "Mon 2022-10-03 13:38:38 UTC",
"InactiveEnterTimestampMonotonic": "3302273920721",
"InactiveExitTimestamp": "Mon 2022-10-03 13:38:38 UTC",
"InactiveExitTimestampMonotonic": "3302273924890",
"InvocationID": "ae99bd68c38e4f0888f4fcc0fdb6e604",
"JobRunningTimeoutUSec": "infinity",
"JobTimeoutAction": "none",
"JobTimeoutUSec": "infinity",
"KeyringMode": "private",
"KillMode": "mixed",
"KillSignal": "15",
"LimitAS": "infinity",
"LimitASSoft": "infinity",
"LimitCORE": "infinity",
"LimitCORESoft": "0",
"LimitCPU": "infinity",
"LimitCPUSoft": "infinity",
"LimitDATA": "infinity",
"LimitDATASoft": "infinity",
"LimitFSIZE": "infinity",
"LimitFSIZESoft": "infinity",
"LimitLOCKS": "infinity",
"LimitLOCKSSoft": "infinity",
"LimitMEMLOCK": "65536",
"LimitMEMLOCKSoft": "65536",
"LimitMSGQUEUE": "819200",
"LimitMSGQUEUESoft": "819200",
"LimitNICE": "0",
"LimitNICESoft": "0",
"LimitNOFILE": "524288",
"LimitNOFILESoft": "1024",
"LimitNPROC": "7606",
"LimitNPROCSoft": "7606",
"LimitRSS": "infinity",
"LimitRSSSoft": "infinity",
"LimitRTPRIO": "0",
"LimitRTPRIOSoft": "0",
"LimitRTTIME": "infinity",
"LimitRTTIMESoft": "infinity",
"LimitSIGPENDING": "7606",
"LimitSIGPENDINGSoft": "7606",
"LimitSTACK": "infinity",
"LimitSTACKSoft": "8388608",
"LoadState": "loaded",
"LockPersonality": "no",
"LogLevelMax": "-1",
"LogRateLimitBurst": "0",
"LogRateLimitIntervalUSec": "0",
"LogsDirectoryMode": "0755",
"MainPID": "259389",
"MemoryAccounting": "yes",
"MemoryCurrent": "3936256",
"MemoryDenyWriteExecute": "no",
"MemoryHigh": "infinity",
"MemoryLimit": "infinity",
"MemoryLow": "0",
"MemoryMax": "infinity",
"MemoryMin": "0",
"MemorySwapMax": "infinity",
"MountAPIVFS": "no",
"MountFlags": "",
"NFileDescriptorStore": "0",
"NRestarts": "0",
"NUMAMask": "",
"NUMAPolicy": "n/a",
"Names": "nginx.service",
"NeedDaemonReload": "no",
"Nice": "0",
"NoNewPrivileges": "no",
"NonBlocking": "no",
"NotifyAccess": "none",
"OOMPolicy": "stop",
"OOMScoreAdjust": "0",
"OnFailureJobMode": "replace",
"PIDFile": "/run/nginx.pid",
"Perpetual": "no",
"PrivateDevices": "no",
"PrivateMounts": "no",
"PrivateNetwork": "no",
"PrivateTmp": "no",
"PrivateUsers": "no",
"ProtectControlGroups": "no",
"ProtectHome": "no",
"ProtectHostname": "no",
"ProtectKernelLogs": "no",
"ProtectKernelModules": "no",
"ProtectKernelTunables": "no",
"ProtectSystem": "no",
"RefuseManualStart": "no",
"RefuseManualStop": "no",
"ReloadResult": "success",
"RemainAfterExit": "no",
"RemoveIPC": "no",
"Requires": "system.slice sysinit.target",
"Restart": "no",
"RestartKillSignal": "15",
"RestartUSec": "100ms",
"RestrictNamespaces": "no",
"RestrictRealtime": "no",
"RestrictSUIDSGID": "no",
"Result": "success",
"RootDirectoryStartOnly": "no",
"RuntimeDirectoryMode": "0755",
"RuntimeDirectoryPreserve": "no",
"RuntimeMaxUSec": "infinity",
"SameProcessGroup": "no",
"SecureBits": "0",
"SendSIGHUP": "no",
"SendSIGKILL": "yes",
"Slice": "system.slice",
"StandardError": "inherit",
"StandardInput": "null",
"StandardInputData": "",
"StandardOutput": "journal",
"StartLimitAction": "none",
"StartLimitBurst": "5",
"StartLimitIntervalUSec": "10s",
"StartupBlockIOWeight": "[not set]",
"StartupCPUShares": "[not set]",
"StartupCPUWeight": "[not set]",
"StartupIOWeight": "[not set]",
"StateChangeTimestamp": "Mon 2022-10-03 13:38:38 UTC",
"StateChangeTimestampMonotonic": "3302273985318",
"StateDirectoryMode": "0755",
"StatusErrno": "0",
"StopWhenUnneeded": "no",
"SubState": "running",
"SuccessAction": "none",
"SyslogFacility": "3",
"SyslogLevel": "6",
"SyslogLevelPrefix": "yes",
"SyslogPriority": "30",
"SystemCallErrorNumber": "0",
"TTYReset": "no",
"TTYVHangup": "no",
"TTYVTDisallocate": "no",
"TasksAccounting": "yes",
"TasksCurrent": "2",
"TasksMax": "2281",
"TimeoutAbortUSec": "5s",
"TimeoutCleanUSec": "infinity",
"TimeoutStartUSec": "1min 30s",
"TimeoutStopUSec": "5s",
"TimerSlackNSec": "50000",
"Transient": "no",
"Type": "forking",
"UID": "[not set]",
"UMask": "0022",
"UnitFilePreset": "enabled",
"UnitFileState": "enabled",
"UtmpMode": "init",
"WantedBy": "multi-user.target",
"WatchdogSignal": "6",
"WatchdogTimestampMonotonic": "0",
"WatchdogUSec": "0"
}
}
141.95.160.133 | CHANGED => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": true,
"name": "nginx",
"state": "stopped",
"status": {
"ActiveEnterTimestamp": "Mon 2022-10-03 13:38:38 UTC",
"ActiveEnterTimestampMonotonic": "1653327603774",
"ActiveExitTimestamp": "Mon 2022-10-03 13:38:38 UTC",
"ActiveExitTimestampMonotonic": "1653327512824",
"ActiveState": "active",
"After": "system.slice sysinit.target systemd-journald.socket
network.target b asic.target",
"AllowIsolate": "no",
"AllowedCPUs": "",
"AllowedMemoryNodes": "",
"AmbientCapabilities": "",
"AssertResult": "yes",
"AssertTimestamp": "Mon 2022-10-03 13:38:38 UTC",
"AssertTimestampMonotonic": "1653327525041",
"Before": "shutdown.target multi-user.target",
"BlockIOAccounting": "no",
"BlockIOWeight": "[not set]",
"CPUAccounting": "no",
"CPUAffinity": "",
"CPUAffinityFromNUMA": "no",
"CPUQuotaPerSecUSec": "infinity",
"CPUQuotaPeriodUSec": "infinity",
"CPUSchedulingPolicy": "0",
"CPUSchedulingPriority": "0",
"CPUSchedulingResetOnFork": "no",
"CPUShares": "[not set]",
"CPUUsageNSec": "[not set]",
"CPUWeight": "[not set]",
"CacheDirectoryMode": "0755",
"CanIsolate": "no",
"CanReload": "yes",
"CanStart": "yes",
"CanStop": "yes",
"CapabilityBoundingSet": "cap_chown cap_dac_override
cap_dac_read_search cap_f owner cap_fsetid cap_kill cap_setgid
cap_setuid cap_setpcap cap_linux_immutable cap_ne t_bind_service
cap_net_broadcast cap_net_admin cap_net_raw cap_ipc_lock cap_ipc_owner
cap_sys_module cap_sys_rawio cap_sys_chroot cap_sys_ptrace cap_sys_pacct
cap_sys_admin cap_sys_boot cap_sys_nice cap_sys_resource
cap_sys_time cap_sys_tty_config cap_mknod cap_lease
cap_audit_write cap_audit_control cap_setfcap cap_mac_override cap_mac_admin
cap_syslog cap_wake_alarm cap_block_suspend cap_audit_read",
"CleanResult": "success",
"CollectMode": "inactive",
"ConditionResult": "yes",
"ConditionTimestamp": "Mon 2022-10-03 13:38:38 UTC",
"ConditionTimestampMonotonic": "1653327525041",
"ConfigurationDirectoryMode": "0755",
"Conflicts": "shutdown.target",
"ControlGroup": "/system.slice/nginx.service",
"ControlPID": "0",
"DefaultDependencies": "yes",
"DefaultMemoryLow": "0",
"DefaultMemoryMin": "0",
"Delegate": "no",
"Description": "A high performance web server and a reverse proxy
server",
"DevicePolicy": "auto",
"Documentation": "man:nginx(8)",
"DynamicUser": "no",
"EffectiveCPUs": "",
"EffectiveMemoryNodes": "",
"ExecMainCode": "0",
"ExecMainExitTimestampMonotonic": "0",
"ExecMainPID": "168715",
"ExecMainStartTimestamp": "Mon 2022-10-03 13:38:38 UTC",
"ExecMainStartTimestampMonotonic": "1653327603733",
"ExecMainStatus": "0",
"ExecReload": "{ path=/usr/sbin/nginx ; argv[]=/usr/sbin/nginx -g
daemon on; m aster_process on; -s reload ; ignore_errors=no ;
start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ;
status=0/0 }",
"ExecReloadEx": "{ path=/usr/sbin/nginx ; argv[]=/usr/sbin/nginx -g
daemon on; master_process on; -s reload ; flags= ;
start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ;
status=0/0 }",
"ExecStart": "{ path=/usr/sbin/nginx ; argv[]=/usr/sbin/nginx -g
daemon on; ma ster_process on; ; ignore_errors=no ;
start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; cod e=(null) ;
status=0/0 }",
"ExecStartEx": "{ path=/usr/sbin/nginx ; argv[]=/usr/sbin/nginx -g
daemon on; master_process on; ; flags= ; start_time=[n/a] ;
stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 }",
"ExecStartPre": "{ path=/usr/sbin/nginx ; argv[]=/usr/sbin/nginx -t -
q -g daem on on; master_process on; ; ignore_errors=no ;
start_time=[n/a] ; stop_time=[n/a] ; pi d=0 ; code=(null) ;
status=0/0 }",
"ExecStartPreEx": "{ path=/usr/sbin/nginx ; argv[]=/usr/sbin/nginx -t
-q -g da emon on; master_process on; ; flags= ; start_time=[n/a] ;
stop_time=[n/a] ; pid=0 ; co de=(null) ; status=0/0 }",
"ExecStop": "{ path=/sbin/start-stop-daemon ; argv[]=/sbin/start-
stop-daemon - -quiet --stop --retry QUIT/5 --pidfile
/run/nginx.pid ; ignore_errors=yes ; start_time =[n/a] ;
stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 }",
"ExecStopEx": "{ path=/sbin/start-stop-daemon ; argv[]=/sbin/start-
stop-daemon --quiet --stop --retry QUIT/5 --pidfile
/run/nginx.pid ; flags=ignore-failure ; start _time=[n/a] ;
stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 }",
"FailureAction": "none",
"FileDescriptorStoreMax": "0",
"FinalKillSignal": "9",
"FragmentPath": "/lib/systemd/system/nginx.service",
"GID": "[not set]",
"GuessMainPID": "yes",
"IOAccounting": "no",
"IOReadBytes": "18446744073709551615",
"IOReadOperations": "18446744073709551615",
"IOSchedulingClass": "0",
"IOSchedulingPriority": "0",
"IOWeight": "[not set]",
"IOWriteBytes": "18446744073709551615",
"IOWriteOperations": "18446744073709551615",
"IPAccounting": "no",
"IPEgressBytes": "[no data]",
"IPEgressPackets": "[no data]",
"IPIngressBytes": "[no data]",
"IPIngressPackets": "[no data]",
"Id": "nginx.service",
"IgnoreOnIsolate": "no",
"IgnoreSIGPIPE": "yes",
"InactiveEnterTimestamp": "Mon 2022-10-03 13:38:38 UTC",
"InactiveEnterTimestampMonotonic": "1653327524043",
"InactiveExitTimestamp": "Mon 2022-10-03 13:38:38 UTC",
"InactiveExitTimestampMonotonic": "1653327527139",
"InvocationID": "d47d8efaef624bfd94ed882646996bd0",
"JobRunningTimeoutUSec": "infinity",
"JobTimeoutAction": "none",
"JobTimeoutUSec": "infinity",
"KeyringMode": "private",
"KillMode": "mixed",
"KillSignal": "15",
"LimitAS": "infinity",
"LimitASSoft": "infinity",
"LimitCORE": "infinity",
"LimitCORESoft": "0",
"LimitCPU": "infinity",
"LimitCPUSoft": "infinity",
"LimitDATA": "infinity",
"LimitDATASoft": "infinity",
"LimitFSIZE": "infinity",
"LimitFSIZESoft": "infinity",
"LimitLOCKS": "infinity",
"LimitLOCKSSoft": "infinity",
"LimitMEMLOCK": "65536",
"LimitMEMLOCKSoft": "65536",
"LimitMSGQUEUE": "819200",
"LimitMSGQUEUESoft": "819200",
"LimitNICE": "0",
"LimitNICESoft": "0",
"LimitNOFILE": "524288",
"LimitNOFILESoft": "1024",
"LimitNPROC": "7606",
"LimitNPROCSoft": "7606",
"LimitRSS": "infinity",
"LimitRSSSoft": "infinity",
"LimitRTPRIO": "0",
"LimitRTPRIOSoft": "0",
"LimitRTTIME": "infinity",
"LimitRTTIMESoft": "infinity",
"LimitSIGPENDING": "7606",
"LimitSIGPENDINGSoft": "7606",
"LimitSTACK": "infinity",
"LimitSTACKSoft": "8388608",
"LoadState": "loaded",
"LockPersonality": "no",
"LogLevelMax": "-1",
"LogRateLimitBurst": "0",
"LogRateLimitIntervalUSec": "0",
"LogsDirectoryMode": "0755",
"MainPID": "168715",
"MemoryAccounting": "yes",
"MemoryCurrent": "3080192",
"MemoryDenyWriteExecute": "no",
"MemoryHigh": "infinity",
"MemoryLimit": "infinity",
"MemoryLow": "0",
"MemoryMax": "infinity",
"MemoryMin": "0",
"MemorySwapMax": "infinity",
"MountAPIVFS": "no",
"MountFlags": "",
"NFileDescriptorStore": "0",
"NRestarts": "0",
"NUMAMask": "",
"NUMAPolicy": "n/a",
"Names": "nginx.service",
"NeedDaemonReload": "no",
"Nice": "0",
"NoNewPrivileges": "no",
"NonBlocking": "no",
"NotifyAccess": "none",
"OOMPolicy": "stop",
"OOMScoreAdjust": "0",
"OnFailureJobMode": "replace",
"PIDFile": "/run/nginx.pid",
"Perpetual": "no",
"PrivateDevices": "no",
"PrivateMounts": "no",
"PrivateNetwork": "no",
"PrivateTmp": "no",
"PrivateUsers": "no",
"ProtectControlGroups": "no",
"ProtectHome": "no",
"ProtectHostname": "no",
"ProtectKernelLogs": "no",
"ProtectKernelModules": "no",
"ProtectKernelTunables": "no",
"ProtectSystem": "no",
"RefuseManualStart": "no",
"RefuseManualStop": "no",
"ReloadResult": "success",
"RemainAfterExit": "no",
"RemoveIPC": "no",
"Requires": "system.slice sysinit.target",
"Restart": "no",
"RestartKillSignal": "15",
"RestartUSec": "100ms",
"RestrictNamespaces": "no",
"RestrictRealtime": "no",
"RestrictSUIDSGID": "no",
"Result": "success",
"RootDirectoryStartOnly": "no",
"RuntimeDirectoryMode": "0755",
"RuntimeDirectoryPreserve": "no",
"RuntimeMaxUSec": "infinity",
"SameProcessGroup": "no",
"SecureBits": "0",
"SendSIGHUP": "no",
"SendSIGKILL": "yes",
"Slice": "system.slice",
"StandardError": "inherit",
"StandardInput": "null",
"StandardInputData": "",
"StandardOutput": "journal",
"StartLimitAction": "none",
"StartLimitBurst": "5",
"StartLimitIntervalUSec": "10s",
"StartupBlockIOWeight": "[not set]",
"StartupCPUShares": "[not set]",
"StartupCPUWeight": "[not set]",
"StartupIOWeight": "[not set]",
"StateChangeTimestamp": "Mon 2022-10-03 13:38:38 UTC",
"StateChangeTimestampMonotonic": "1653327603774",
"StateDirectoryMode": "0755",
"StatusErrno": "0",
"StopWhenUnneeded": "no",
"SubState": "running",
"SuccessAction": "none",
"SyslogFacility": "3",
"SyslogLevel": "6",
"SyslogLevelPrefix": "yes",
"SyslogPriority": "30",
"SystemCallErrorNumber": "0",
"TTYReset": "no",
"TTYVHangup": "no",
"TTYVTDisallocate": "no",
"TasksAccounting": "yes",
"TasksCurrent": "2",
"TasksMax": "2281",
"TimeoutAbortUSec": "5s",
"TimeoutCleanUSec": "infinity",
"TimeoutStartUSec": "1min 30s",
"TimeoutStopUSec": "5s",
"TimerSlackNSec": "50000",
"Transient": "no",
"Type": "forking",
"UID": "[not set]",
"UMask": "0022",
"UnitFilePreset": "enabled",
"UnitFileState": "enabled",
"UtmpMode": "init",
"WantedBy": "multi-user.target",
"WatchdogSignal": "6",
"WatchdogTimestampMonotonic": "0",
"WatchdogUSec": "0"
}
}
ansadmin@svl200:~/projet1$
ansadmin@svl200:~/projet1$ ansible-playbook -i hosts.yml site.yml
PLAY RECAP
***************************************************************************
client1 : ok=3 changed=0
unreachable=0 failed=0 skipped =0 rescued=0
ignored=0
ansadmin@svl200:~/projet1$ tree
.
├── group_vars
│ └── all.yml
├── hosts.yml
├── hosts_vars
├── roles
│ └── apache
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── site.yml
8 directories, 7 files
ansadmin@svl200:~/projet1$ sudo vim hosts.yml
ansadmin@svl200:~/projet1$ curl client1
curl: (7) Failed to connect to client1 port 80: Connection refused
ansadmin@svl200:~/projet1$
ansadmin@svl200:~/projet1$ cd roles/
ansadmin@svl200:~/projet1/roles$ ls
apache
ansadmin@svl200:~/projet1/roles$ cp -r apache users
ansadmin@svl200:~/projet1/roles$
ansadmin@svl200:~/projet1/roles$ ls
apache users
ansadmin@svl200:~/projet1/roles$ cd users
ansadmin@svl200:~/projet1/roles/users$ ls -lrt
total 16
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 13:16 vars
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 13:16 templates
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 13:16 tasks
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 13:16 handlers
ansadmin@svl200:~/projet1/roles/users$ tree
.
├── handlers
│ └── main.yml
├── tasks
│ └── main.yml
├── templates
│ └── index.html.j2
└── vars
└── main.yml
4 directories, 4 files
ansadmin@svl200:~/projet1/roles/users$ cd ..
ansadmin@svl200:~/projet1/roles$ tree
.
├── apache
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── users
├── handlers
│ └── main.yml
├── tasks
│ └── main.yml
├── templates
│ └── index.html.j2
└── vars
└── main.yml
10 directories, 8 files
ansadmin@svl200:~/projet1/roles$
ansadmin@svl200:~/projet1/roles$ ll
total 16
drwxrwxr-x 4 ansadmin ansadmin 4096 Oct 5 13:16 ./
drwxrwxr-x 5 ansadmin ansadmin 4096 Oct 5 13:14 ../
drwxrwxr-x 6 ansadmin ansadmin 4096 Oct 5 12:15 apache/
drwxrwxr-x 6 ansadmin ansadmin 4096 Oct 5 13:16 users/
ansadmin@svl200:~/projet1/roles$ cd users/
ansadmin@svl200:~/projet1/roles/users$ ls
handlers tasks templates vars
ansadmin@svl200:~/projet1/roles/users$
ansadmin@svl200:~/projet1/roles/users$ ls -lrt
total 16
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 13:16 vars
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 13:16 templates
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 13:16 tasks
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 13:16 handlers
ansadmin@svl200:~/projet1/roles/users$ sudo vim vars/main.yml
ansadmin@svl200:~/projet1/roles/users$ sudo vim templates/index.html.j2
ansadmin@svl200:~/projet1/roles/users$ sudo vim tasks/main.yml
ansadmin@svl200:~/projet1/roles/users$ cd
ansadmin@svl200:~$ ls
cible1.txt exo4.yaml index.html items_users.yaml projet
template.yaml var
copie.yaml fact.yaml index.html.j2 list.yaml
projet1 template1.yaml var
debug.yaml fact1.yaml index.html1.j2 locale.yml
rep.yaml var_dic.yml whe
debug1.yaml handler.yaml ip.txt nginx.yaml
seq.yaml var_dic2.yml whe
exo2.yaml hello.yaml item_users.yaml play-vars.yaml shell.yml
var_dic_multi3.yml
exo3.yaml hello.yml items.yaml play-vars.yml
snap vars.yml
ansadmin@svl200:~$ sudo vim item_users.yaml
ansadmin@svl200:~$ cd projet1/roles/users/
ansadmin@svl200:~/projet1/roles/users$ sudo vim tasks/main.yml
ansadmin@svl200:~/projet1/roles/users$
ansadmin@svl200:~/projet1/roles/users$ tree
.
├── handlers
│ └── main.yml
├── tasks
│ └── main.yml
├── templates
│ └── index.html.j2
└── vars
└── main.yml
4 directories, 4 files
ansadmin@svl200:~/projet1/roles/users$ sudo vim vars/main.yml
ansadmin@svl200:~/projet1/roles/users$ cd ..
ansadmin@svl200:~/projet1/roles$ cd ..
ansadmin@svl200:~/projet1$ tree
.
├── group_vars
│ └── all.yml
├── hosts.yml
├── hosts_vars
├── roles
│ ├── apache
│ │ ├── handlers
│ │ │ └── main.yml
│ │ ├── tasks
│ │ │ └── main.yml
│ │ ├── templates
│ │ │ └── index.html.j2
│ │ └── vars
│ │ └── main.yml
│ └── users
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── site.yml
13 directories, 11 files
ansadmin@svl200:~/projet1$ cd roles/
ansadmin@svl200:~/projet1/roles$ cd users/
ansadmin@svl200:~/projet1/roles/users$ sudo vim vars/main.yml
ansadmin@svl200:~/projet1/roles/users$
ansadmin@svl200:~/projet1/roles/users$ cd
ansadmin@svl200:~$ ls
cible1.txt exo4.yaml index.html items_users.yaml projet
template.yaml var
copie.yaml fact.yaml index.html.j2 list.yaml
projet1 template1.yaml var
debug.yaml fact1.yaml index.html1.j2 locale.yml
rep.yaml var_dic.yml whe
debug1.yaml handler.yaml ip.txt nginx.yaml
seq.yaml var_dic2.yml whe
exo2.yaml hello.yaml item_users.yaml play-vars.yaml shell.yml
var_dic_multi3.yml
exo3.yaml hello.yml items.yaml play-vars.yml
snap vars.yml
ansadmin@svl200:~$ cd projet
ansadmin@svl200:~/projet$ ls
group_vars host_vars install.yaml inventory.yaml vars_install.yaml
ansadmin@svl200:~/projet$ sudo vim vars_install.yaml
ansadmin@svl200:~/projet$
ansadmin@svl200:~/projet$ cd
ansadmin@svl200:~$ cd projet1/
group_vars/ hosts_vars/ roles/
ansadmin@svl200:~$ cd projet1/roles/
apache/ users/
ansadmin@svl200:~$ cd projet1/roles/users/
handlers/ tasks/ templates/ vars/
ansadmin@svl200:~$ cd projet1/roles/users/vars/
ansadmin@svl200:~/projet1/roles/users/vars$ sudo vim vars/main.yml
ansadmin@svl200:~/projet1/roles/users/vars$ sudo main.yml
sudo: main.yml: command not found
ansadmin@svl200:~/projet1/roles/users/vars$ sudo vim main.yml
ansadmin@svl200:~/projet1/roles/users/vars$ cd ..
ansadmin@svl200:~/projet1/roles/users$ ansible-playbook -i hosts.yml site.yml
ERROR! the playbook: site.yml could not be found
ansadmin@svl200:~/projet1/roles/users$ cd ..
ansadmin@svl200:~/projet1/roles$ cd ..
ansadmin@svl200:~/projet1$ ansible-playbook -i hosts.yml site.yml
PLAY RECAP
*************************************************************************************
client1 : ok=3 changed=0
unreachable=0 failed=0 skipped=0 rescred=0
ansadmin@svl200:~/projet1$
ansadmin@svl200:~/projet1$ cd roles/
ansadmin@svl200:~/projet1/roles$ ansible-playbook -i hosts.yml site.yml
ERROR! the playbook: site.yml could not be found
ansadmin@svl200:~/projet1/roles$
ansadmin@svl200:~/projet1/roles$ ls
apache users
ansadmin@svl200:~/projet1/roles$ mv users /home/ansadmin/
ansadmin@svl200:~/projet1/roles$ cd
ansadmin@svl200:~$ ls
cible1.txt exo4.yaml index.html items_users.yaml projet
template.yaml var
copie.yaml fact.yaml index.html.j2 list.yaml
projet1 template1.yaml var
debug.yaml fact1.yaml index.html1.j2 locale.yml
rep.yaml users var
debug1.yaml handler.yaml ip.txt nginx.yaml
seq.yaml var_dic.yml whe
exo2.yaml hello.yaml item_users.yaml play-vars.yaml shell.yml
var_dic2.yml whe
exo3.yaml hello.yml items.yaml play-vars.yml
snap var_dic_multi3.yml
ansadmin@svl200:~$ mv users projet2
ansadmin@svl200:~$
ansadmin@svl200:~$ cd projet2
ansadmin@svl200:~/projet2$ ls
handlers tasks templates vars
ansadmin@svl200:~/projet2$
ansadmin@svl200:~/projet2$ tree
.
├── handlers
│ └── main.yml
├── tasks
│ └── main.yml
├── templates
│ └── index.html.j2
└── vars
└── main.yml
4 directories, 4 files
ansadmin@svl200:~/projet2$ mkdir roles
ansadmin@svl200:~/projet2$ cd ..
ansadmin@svl200:~$ ls
cible1.txt exo4.yaml index.html items_users.yaml projet
snap var
copie.yaml fact.yaml index.html.j2 list.yaml
projet1 template.yaml var
debug.yaml fact1.yaml index.html1.j2 locale.yml
projet2 template1.yaml var
debug1.yaml handler.yaml ip.txt nginx.yaml
rep.yaml var_dic.yml whe
exo2.yaml hello.yaml item_users.yaml play-vars.yaml seq.yaml
var_dic2.yml whe
exo3.yaml hello.yml items.yaml play-vars.yml
shell.yml var_dic_multi3.yml
ansadmin@svl200:~$ cd projet
projet/ projet1/ projet2/
ansadmin@svl200:~$ cd projet2
ansadmin@svl200:~/projet2$ ls
handlers roles tasks templates vars
ansadmin@svl200:~/projet2$ mv handlers tasks templates vars roles/
ansadmin@svl200:~/projet2$ ls
roles
ansadmin@svl200:~/projet2$ cd roles/
ansadmin@svl200:~/projet2/roles$ ls
handlers tasks templates vars
ansadmin@svl200:~/projet2/roles$ mkdir user
ansadmin@svl200:~/projet2/roles$ ls
handlers tasks templates user vars
ansadmin@svl200:~/projet2/roles$ mv handlers tasks templates vars user/
ansadmin@svl200:~/projet2/roles$ cd user/
handlers/ tasks/ templates/ vars/
ansadmin@svl200:~/projet2/roles$ cd ..
ansadmin@svl200:~/projet2$ tree
.
└── roles
└── user
├── handlers
│ └── main.yml
├── tasks
│ └── main.yml
├── templates
│ └── index.html.j2
└── vars
└── main.yml
6 directories, 4 files
ansadmin@svl200:~/projet2$ sudo vim roles/user/handlers/main.yml
ansadmin@svl200:~/projet2$ cd
ansadmin@svl200:~$ cd projet1/
ansadmin@svl200:~/projet1$ ls
group_vars hosts.yml hosts_vars roles site.yml
ansadmin@svl200:~/projet1$ cp group_vars hosts_vars hosts.yml site.yml ../projet
projet/ projet1/ projet2/
ansadmin@svl200:~/projet1$ cp group_vars hosts_vars hosts.yml site.yml ../projet2
cp: -r not specified; omitting directory 'group_vars'
cp: -r not specified; omitting directory 'hosts_vars'
ansadmin@svl200:~/projet1$ cp -r group_vars hosts_vars hosts.yml site.yml ../projet2
ansadmin@svl200:~/projet1$ cd ..
ansadmin@svl200:~$ cd projet2
ansadmin@svl200:~/projet2$ tree
.
├── group_vars
│ └── all.yml
├── hosts.yml
├── hosts_vars
├── roles
│ └── user
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── site.yml
8 directories, 7 files
ansadmin@svl200:~/projet2$ ansible-playbook -i hosts.yml site.yml
ERROR! the role 'apache' was not found in
/home/ansadmin/projet2/roles:/home/ansadmin/.ansible/rre/ansible/roles:/etc/ansible/
roles:/home/ansadmin/projet2
roles:
- apache
^ here
ansadmin@svl200:~/projet2$ tree
.
├── group_vars
│ └── all.yml
├── hosts.yml
├── hosts_vars
├── roles
│ └── user
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── site.yml
8 directories, 7 files
ansadmin@svl200:~/projet2$ sudo vim site.yml
ansadmin@svl200:~/projet2$ ansible-playbook -i hosts.yml site.yml
ERROR! Syntax Error while loading YAML.
mapping values are not allowed in this context
8 directories, 7 files
ansadmin@svl200:~/projet2$ sudo vim site.yml
ansadmin@svl200:~/projet2$ ansible-playbook -i hosts.yml site.yml
ERROR! Syntax Error while loading YAML.
mapping values are not allowed in this context
8 directories, 7 files
ansadmin@svl200:~/projet2$ cd roles
ansadmin@svl200:~/projet2/roles$ mv user/ users/
ansadmin@svl200:~/projet2/roles$
ansadmin@svl200:~/projet2/roles$ cd ..
ansadmin@svl200:~/projet2$ tree
.
├── group_vars
│ └── all.yml
├── hosts.yml
├── hosts_vars
├── roles
│ └── users
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── site.yml
8 directories, 7 files
ansadmin@svl200:~/projet2$ sudo vim site.yml
ansadmin@svl200:~/projet2$ sudo vim roles/user/tasks/main.yml
ansadmin@svl200:~/projet2$ sudo vim roles/users/tasks/main.yml
ansadmin@svl200:~/projet2$ sudo vim roles/users/templates/index.html.j2
ansadmin@svl200:~/projet2$ sudo vim hosts.yml
ansadmin@svl200:~/projet2$ sudo vim site.yml
ansadmin@svl200:~/projet2$ sudo vim roles/users/vars/main.yml
*ansadmin@svl200:~/projet2$ansible-playbook -i hosts.yml site.yml
usage: ansible-playbook [-h] [--version] [-v] [-k] [--private-key PRIVATE_KEY_FILE]
[-u REMOTE_U
[-c CONNECTION] [-T TIMEOUT] [--ssh-
common-args SSH_COMMON_ARGS]
[--sftp-extra-args SFTP_EXTRA_ARGS]
[--scp-extra-args SCP_EXTRA_ARGS]
[--ssh-extra-args SSH_EXTRA_ARGS] [--
force-handlers] [--flush-cache] [-b
[--become-method BECOME_METHOD] [--
become-user BECOME_USER] [-K] [-t TAG
[--skip-tags SKIP_TAGS] [-C] [--
syntax-check] [-D] [-i INVENTORY] [--lis
[-l SUBSET] [-e EXTRA_VARS] [--vault-
id VAULT_IDS]
[--ask-vault-pass | --vault-password-
file VAULT_PASSWORD_FILES] [-f FORK
[-M MODULE_PATH] [--list-tasks] [--
list-tags] [--step]
[--start-at-task START_AT_TASK]
playbook [playbook ...]
ansible-playbook: error: the following arguments are required: playbook
ansadmin@svl200:~/projet2$
ansadmin@svl200:~/projet2$ ansible-playbook -i hosts.ymlsite.yml
usage: ansible-playbook [-h] [--version] [-v] [-k] [--private-key PRIVATE_KEY_FILE]
[-u REMOTE_U
[-c CONNECTION] [-T TIMEOUT] [--ssh-
common-args SSH_COMMON_ARGS]
[--sftp-extra-args SFTP_EXTRA_ARGS]
[--scp-extra-args SCP_EXTRA_ARGS]
[--ssh-extra-args SSH_EXTRA_ARGS] [--
force-handlers] [--flush-cache] [-b
[--become-method BECOME_METHOD] [--
become-user BECOME_USER] [-K] [-t TAG
[--skip-tags SKIP_TAGS] [-C] [--
syntax-check] [-D] [-i INVENTORY] [--lis
[-l SUBSET] [-e EXTRA_VARS] [--vault-
id VAULT_IDS]
[--ask-vault-pass | --vault-password-
file VAULT_PASSWORD_FILES] [-f FORK
[-M MODULE_PATH] [--list-tasks] [--
list-tags] [--step]
[--start-at-task START_AT_TASK]
playbook [playbook ...]
ansible-playbook: error: the following arguments are required: playbook
ansadmin@svl200:~/projet2$
ansadmin@svl200:~/projet2$ ansible-playbook -i hosts.yml site.yml
[WARNING]: While constructing a mapping from /home/ansadmin/projet2/hosts.yml, line
3, column 7,
duplicate dict key (cible1). Using last defined value only.
ERROR! Syntax Error while loading YAML.
mapping values are not allowed in this context
PLAY RECAP
*************************************************************************************
client2 : ok=3 changed=2
unreachable=0 failed=1 skipped=0 rescred=0
ansadmin@svl200:~/projet2$
ansadmin@svl200:~/projet2$ tree
.
├── group_vars
│ └── all.yml
├── hosts.yml
├── hosts_vars
├── roles
│ └── users
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── site.yml
8 directories, 7 files
ansadmin@svl200:~/projet2$ ansible-playbook -i hosts.yml site.yml
[WARNING]: While constructing a mapping from /home/ansadmin/projet2/hosts.yml, line
3, column 7,
duplicate dict key (cible1). Using last defined value only.
PLAY RECAP
*************************************************************************************
client2 : ok=3 changed=0
unreachable=0 failed=1 skipped=0 rescred=0
PLAY RECAP
*************************************************************************************
client2 : ok=3 changed=0
unreachable=0 failed=1 skipped=0 rescred=0
PLAY RECAP
*************************************************************************************
client2 : ok=3 changed=0
unreachable=0 failed=1 skipped=0 rescred=0
PLAY RECAP
*************************************************************************************
client2 : ok=3 changed=0
unreachable=0 failed=1 skipped=0 rescred=0
ansadmin@svl200:~/projet2$
ansadmin@svl200:~/projet2$ sudo vim roles/users/tasks/main.yml
ansadmin@svl200:~/projet2$ ansible-playbook -i hosts.yml site.yml
[WARNING]: While constructing a mapping from /home/ansadmin/projet2/hosts.yml, line
3, column 7,
duplicate dict key (cible1). Using last defined value only.
PLAY RECAP
*************************************************************************************
client2 : ok=5 changed=2
unreachable=0 failed=0 skipped=1 rescred=0
ansadmin@svl200:~/projet2$
ansadmin@svl200:~/projet2$ cd
ansadmin@svl200:~$ ansible-galaxy init projet
projet/ projet1/ projet2/
ansadmin@svl200:~$ ansible-galaxy init projet3
- Role projet3 was created successfully
ansadmin@svl200:~$ cd projet3
ansadmin@svl200:~/projet3$ tree
.
├── README.md
├── defaults
│ └── main.yml
├── files
├── handlers
│ └── main.yml
├── meta
│ └── main.yml
├── tasks
│ └── main.yml
├── templates
├── tests
│ ├── inventory
│ └── test.yml
└── vars
└── main.yml
8 directories, 8 files
ansadmin@svl200:~/projet3$
ansadmin@svl200:~/projet3$ cd
ansadmin@svl200:~$ ansible-galaxy install projet3 geerlingguy.apache
- downloading role 'projet3', owned by
[WARNING]: - projet3 was NOT installed successfully: None (HTTP Code: 400, Message:
Bad Request)
ERROR! - you can use --ignore-errors to skip failed roles and finish processing the
list.
ansadmin@svl200:~$ ansible-galaxy install geerlingguy.apache
- downloading role 'apache', owned by geerlingguy
- downloading role from
https://github.com/geerlingguy/ansible-role-apache/archive/3.3.0.tar.gz
- extracting geerlingguy.apache to /home/ansadmin/.ansible/roles/geerlingguy.apache
- geerlingguy.apache (3.3.0) was installed successfully
ansadmin@svl200:~$ mkdir projet4
ansadmin@svl200:~$ ansible-galaxy install geerlingguy.apache -p projet4
- downloading role 'apache', owned by geerlingguy
- downloading role from
https://github.com/geerlingguy/ansible-role-apache/archive/3.3.0.tar.gz
- extracting geerlingguy.apache to /home/ansadmin/projet4/geerlingguy.apache
- geerlingguy.apache (3.3.0) was installed successfully
ansadmin@svl200:~$ cd projet4
ansadmin@svl200:~/projet4$ tree
.
└── geerlingguy.apache
├── LICENSE
├── README.md
├── defaults
│ └── main.yml
├── handlers
│ └── main.yml
├── meta
│ └── main.yml
├── molecule
│ └── default
│ ├── converge.yml
│ └── molecule.yml
├── tasks
│ ├── configure-Debian.yml
│ ├── configure-RedHat.yml
│ ├── configure-Solaris.yml
│ ├── configure-Suse.yml
│ ├── main.yml
│ ├── setup-Debian.yml
│ ├── setup-RedHat.yml
│ ├── setup-Solaris.yml
│ └── setup-Suse.yml
├── templates
│ └── vhosts.conf.j2
└── vars
├── AmazonLinux.yml
├── Debian.yml
├── RedHat.yml
├── Solaris.yml
├── Suse.yml
├── apache-22.yml
└── apache-24.yml
9 directories, 24 files
ansadmin@svl200:~/projet4$
ansadmin@svl200:~/projet4$ cd geerlingguy.apache/
.github/ defaults/ handlers/ meta/ molecule/ tasks/
templates/ vars/
ansadmin@svl200:~/projet4$ cd geerlingguy.apache
ansadmin@svl200:~/projet4/geerlingguy.apache$ ls -lrt
total 44
-rw-rw-r-- 1 ansadmin ansadmin 8359 May 23 05:41 README.md
-rw-rw-r-- 1 ansadmin ansadmin 1080 May 23 05:41 LICENSE
drwxrwxr-x 3 ansadmin ansadmin 4096 Oct 5 14:52 molecule
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 14:52 handlers
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 14:52 defaults
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 14:52 vars
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 14:52 templates
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 14:52 tasks
drwxrwxr-x 2 ansadmin ansadmin 4096 Oct 5 14:52 meta
ansadmin@svl200:~/projet4/geerlingguy.apache$ cd tasks/
ansadmin@svl200:~/projet4/geerlingguy.apache/tasks$ ls
configure-Debian.yml configure-Solaris.yml main.yml setup-
RedHat.yml setup-Suse.yml
configure-RedHat.yml configure-Suse.yml setup-Debian.yml setup-
Solaris.yml
ansadmin@svl200:~/projet4/geerlingguy.apache/tasks$ sudo vim main.yml
ansadmin@svl200:~/projet4/geerlingguy.apache/tasks$ sudo vim main.yml
ansadmin@svl200:~/projet4/geerlingguy.apache/tasks$ cd ..
ansadmin@svl200:~/projet4/geerlingguy.apache$ cd ..
ansadmin@svl200:~/projet4$ tree
.
└── geerlingguy.apache
├── LICENSE
├── README.md
├── defaults
│ └── main.yml
├── handlers
│ └── main.yml
├── meta
│ └── main.yml
├── molecule
│ └── default
│ ├── converge.yml
│ └── molecule.yml
├── tasks
│ ├── configure-Debian.yml
│ ├── configure-RedHat.yml
│ ├── configure-Solaris.yml
│ ├── configure-Suse.yml
│ ├── main.yml
│ ├── setup-Debian.yml
│ ├── setup-RedHat.yml
│ ├── setup-Solaris.yml
│ └── setup-Suse.yml
├── templates
│ └── vhosts.conf.j2
└── vars
├── AmazonLinux.yml
├── Debian.yml
├── RedHat.yml
├── Solaris.yml
├── Suse.yml
├── apache-22.yml
└── apache-24.yml
9 directories, 24 files
ansadmin@svl200:~/projet4$ cd
ansadmin@svl200:~$ tree
.
├── cible1.txt
├── copie.yaml
├── debug.yaml
├── debug1.yaml
├── exo2.yaml
├── exo3.yaml
├── exo4.yaml
├── fact.yaml
├── fact1.yaml
├── handler.yaml
├── hello.yaml
├── hello.yml
├── index.html
├── index.html.j2
├── index.html1.j2
├── ip.txt
├── item_users.yaml
├── items.yaml
├── items_users.yaml
├── list.yaml
├── locale.yml
├── nginx.yaml
├── play-vars.yaml
├── play-vars.yml
├── projet
│ ├── group_vars
│ │ ├── cible1.yaml
│ │ └── cible2.yaml
│ ├── host_vars
│ │ ├── client1.yaml
│ │ └── client2.yaml
│ ├── install.yaml
│ ├── inventory.yaml
│ └── vars_install.yaml
├── projet1
│ ├── group_vars
│ │ └── all.yml
│ ├── hosts.yml
│ ├── hosts_vars
│ ├── roles
│ │ └── apache
│ │ ├── handlers
│ │ │ └── main.yml
│ │ ├── tasks
│ │ │ └── main.yml
│ │ ├── templates
│ │ │ └── index.html.j2
│ │ └── vars
│ │ └── main.yml
│ └── site.yml
├── projet2
│ ├── group_vars
│ │ └── all.yml
│ ├── hosts.yml
│ ├── hosts_vars
│ ├── roles
│ │ └── users
│ │ ├── handlers
│ │ │ └── main.yml
│ │ ├── tasks
│ │ │ └── main.yml
│ │ ├── templates
│ │ │ └── index.html.j2
│ │ └── vars
│ │ └── main.yml
│ └── site.yml
├── projet3
│ ├── README.md
│ ├── defaults
│ │ └── main.yml
│ ├── files
│ ├── handlers
│ │ └── main.yml
│ ├── meta
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ ├── tests
│ │ ├── inventory
│ │ └── test.yml
│ └── vars
│ └── main.yml
├── projet4
│ └── geerlingguy.apache
│ ├── LICENSE
│ ├── README.md
│ ├── defaults
│ │ └── main.yml
│ ├── handlers
│ │ └── main.yml
│ ├── meta
│ │ └── main.yml
│ ├── molecule
│ │ └── default
│ │ ├── converge.yml
│ │ └── molecule.yml
│ ├── tasks
│ │ ├── configure-Debian.yml
│ │ ├── configure-RedHat.yml
│ │ ├── configure-Solaris.yml
│ │ ├── configure-Suse.yml
│ │ ├── main.yml
│ │ ├── setup-Debian.yml
│ │ ├── setup-RedHat.yml
│ │ ├── setup-Solaris.yml
│ │ └── setup-Suse.yml
│ ├── templates
│ │ └── vhosts.conf.j2
│ └── vars
│ ├── AmazonLinux.yml
│ ├── Debian.yml
│ ├── RedHat.yml
│ ├── Solaris.yml
│ ├── Suse.yml
│ ├── apache-22.yml
│ └── apache-24.yml
├── rep.yaml
├── seq.yaml
├── shell.yml
├── snap
│ └── tree
│ ├── 18
│ ├── common
│ └── current -> 18
├── template.yaml
├── template1.yaml
├── var_dic.yml
├── var_dic2.yml
├── var_dic_multi3.yml
├── vars.yml
├── vars2.yml
├── vars_multi.yml
├── when.yaml
└── when1.yaml
45 directories, 90 files
ansadmin@svl200:~$ ansible-playbook -i projet4
usage: ansible-playbook [-h] [--version] [-v] [-k] [--private-key PRIVATE_KEY_FILE]
[-u REMOTE_USER] [-c CONNECTION] [-T
TIMEOUT]
[--ssh-common-args SSH_COMMON_ARGS]
[--sftp-extra-args SFTP_EXTRA_ARGS]
[--scp-extra-args SCP_EXTRA_ARGS] [--
ssh-extra-args SSH_EXTRA_ARGS]
[--force-handlers] [--flush-cache] [-
b] [--become-method BECOME_METHOD]
[--become-user BECOME_USER] [-K] [-t
TAGS] [--skip-tags SKIP_TAGS] [-C]
[--syntax-check] [-D] [-i INVENTORY]
[--list-hosts] [-l SUBSET]
[-e EXTRA_VARS] [--vault-id
VAULT_IDS]
[--ask-vault-pass | --vault-password-
file VAULT_PASSWORD_FILES] [-f FORK
[-M MODULE_PATH] [--list-tasks] [--
list-tags] [--step]
[--start-at-task START_AT_TASK]
playbook [playbook ...]
ansible-playbook: error: the following arguments are required: playbook
ansadmin@svl200:~$
ansadmin@svl200:~$ cd projet4/geerlingguy.apache/
ansadmin@svl200:~/projet4/geerlingguy.apache$ sudo vim site.yml
ansadmin@svl200:~/projet4/geerlingguy.apache$ cd
ansadmin@svl200:~$ cd projet2
ansadmin@svl200:~/projet2$ ls
group_vars hosts.yml hosts_vars roles site.yml
ansadmin@svl200:~/projet2$ cp hosts.yml ../projet
projet/ projet1/ projet2/ projet3/ projet4/
ansadmin@svl200:~/projet2$ cp hosts.yml ../projet4/
ansadmin@svl200:~/projet2$ cd
ansadmin@svl200:~$ cd projet4
ansadmin@svl200:~/projet4$ ansible-playbook -i hosts.yml site.yml
ERROR! the playbook: site.yml could not be found
ansadmin@svl200:~/projet4$ tree
.
├── geerlingguy.apache
│ ├── LICENSE
│ ├── README.md
│ ├── defaults
│ │ └── main.yml
│ ├── handlers
│ │ └── main.yml
│ ├── meta
│ │ └── main.yml
│ ├── molecule
│ │ └── default
│ │ ├── converge.yml
│ │ └── molecule.yml
│ ├── site.yml
│ ├── tasks
│ │ ├── configure-Debian.yml
│ │ ├── configure-RedHat.yml
│ │ ├── configure-Solaris.yml
│ │ ├── configure-Suse.yml
│ │ ├── main.yml
│ │ ├── setup-Debian.yml
│ │ ├── setup-RedHat.yml
│ │ ├── setup-Solaris.yml
│ │ └── setup-Suse.yml
│ ├── templates
│ │ └── vhosts.conf.j2
│ └── vars
│ ├── AmazonLinux.yml
│ ├── Debian.yml
│ ├── RedHat.yml
│ ├── Solaris.yml
│ ├── Suse.yml
│ ├── apache-22.yml
│ └── apache-24.yml
└── hosts.yml
9 directories, 26 files
ansadmin@svl200:~/projet4$ :q
:q: command not found
ansadmin@svl200:~/projet4$
ansadmin@svl200:~/projet4$ cd
ansadmin@svl200:~$ cd projet2
ansadmin@svl200:~/projet2$ cp site.yml ../projet4/
ansadmin@svl200:~/projet2$ cd
ansadmin@svl200:~$ cd projet4
ansadmin@svl200:~/projet4$ ansible-playbook -i hosts.yml site.yml
[WARNING]: While constructing a mapping from /home/ansadmin/projet4/hosts.yml,
line 3, column 7, found a duplicate dict key (cible1). Using last defined value
only.
ERROR! the role 'users' was not found in /home/ansadmin/projet4/roles:/home/ansa
dmin/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/home/ansadmin/p
rojet4
roles:
- users
^ here
ansadmin@svl200:~/projet4$ tree
.
├── geerlingguy.apache
│ ├── LICENSE
│ ├── README.md
│ ├── defaults
│ │ └── main.yml
│ ├── handlers
│ │ └── main.yml
│ ├── meta
│ │ └── main.yml
│ ├── molecule
│ │ └── default
│ │ ├── converge.yml
│ │ └── molecule.yml
│ ├── site.yml
│ ├── tasks
│ │ ├── configure-Debian.yml
│ │ ├── configure-RedHat.yml
│ │ ├── configure-Solaris.yml
│ │ ├── configure-Suse.yml
│ │ ├── main.yml
│ │ ├── setup-Debian.yml
│ │ ├── setup-RedHat.yml
│ │ ├── setup-Solaris.yml
│ │ └── setup-Suse.yml
│ ├── templates
│ │ └── vhosts.conf.j2
│ └── vars
│ ├── AmazonLinux.yml
│ ├── Debian.yml
│ ├── RedHat.yml
│ ├── Solaris.yml
│ ├── Suse.yml
│ ├── apache-22.yml
│ └── apache-24.yml
├── hosts.yml
└── site.yml
9 directories, 27 files
ansadmin@svl200:~/projet4$ sudo vim site.yml
ansadmin@svl200:~/projet4$ geerlingguy.apache^C
ansadmin@svl200:~/projet4$ sudo vim site.yml
ansadmin@svl200:~/projet4$ ansible-playbook -i hosts.yml site.yml
[WARNING]: While constructing a mapping from /home/ansadmin/projet4/hosts.yml,
line 3, column 7, found a duplicate dict key (cible1). Using last defined value
only.
ansadmin@svl200:~/projet4$ tree
.
├── geerlingguy.apache
│ ├── LICENSE
│ ├── README.md
│ ├── defaults
│ │ └── main.yml
│ ├── handlers
│ │ └── main.yml
│ ├── meta
│ │ └── main.yml
│ ├── molecule
│ │ └── default
│ │ ├── converge.yml
│ │ └── molecule.yml
│ ├── site.yml
│ ├── tasks
│ │ ├── configure-Debian.yml
│ │ ├── configure-RedHat.yml
│ │ ├── configure-Solaris.yml
│ │ ├── configure-Suse.yml
│ │ ├── main.yml
│ │ ├── setup-Debian.yml
│ │ ├── setup-RedHat.yml
│ │ ├── setup-Solaris.yml
│ │ └── setup-Suse.yml
│ ├── templates
│ │ └── vhosts.conf.j2
│ └── vars
│ ├── AmazonLinux.yml
│ ├── Debian.yml
│ ├── RedHat.yml
│ ├── Solaris.yml
│ ├── Suse.yml
│ ├── apache-22.yml
│ └── apache-24.yml
├── hosts.yml
└── site.yml
9 directories, 27 files
ansadmin@svl200:~/projet4$ sudo vim site.yml
ansadmin@svl200:~/projet4$ sudo vim hosts.yml
ansadmin@svl200:~/projet4$ ansible-playbook -i hosts.yml site.yml
[WARNING]: While constructing a mapping from /home/ansadmin/projet4/hosts.yml,
line 3, column 7, found a duplicate dict key (cible1). Using last defined value
only.
ansadmin@svl200:~/projet4$ cd
ansadmin@svl200:~$ cd projet2
ansadmin@svl200:~/projet2$ ls
group_vars hosts.yml hosts_vars roles site.yml
ansadmin@svl200:~/projet2$ cp -r group_vars hosts_vars ../projet4/
ansadmin@svl200:~/projet2$
ansadmin@svl200:~/projet2$ cd
ansadmin@svl200:~$ cd projet4
ansadmin@svl200:~/projet4$ ansible-playbook -i hosts.yml site.yml
[WARNING]: While constructing a mapping from /home/ansadmin/projet4/hosts.yml,
line 3, column 7, found a duplicate dict key (cible1). Using last defined value
only.
TASK [geerlingguy.apache : Ensure Apache has selected state and enabled on boot.
] ***
ok: [client2]
ansadmin@svl200:~/projet4$ tree
.
├── geerlingguy.apache
│ ├── LICENSE
│ ├── README.md
│ ├── defaults
│ │ └── main.yml
│ ├── handlers
│ │ └── main.yml
│ ├── meta
│ │ └── main.yml
│ ├── molecule
│ │ └── default
│ │ ├── converge.yml
│ │ └── molecule.yml
│ ├── site.yml
│ ├── tasks
│ │ ├── configure-Debian.yml
│ │ ├── configure-RedHat.yml
│ │ ├── configure-Solaris.yml
│ │ ├── configure-Suse.yml
│ │ ├── main.yml
│ │ ├── setup-Debian.yml
│ │ ├── setup-RedHat.yml
│ │ ├── setup-Solaris.yml
│ │ └── setup-Suse.yml
│ ├── templates
│ │ └── vhosts.conf.j2
│ └── vars
│ ├── AmazonLinux.yml
│ ├── Debian.yml
│ ├── RedHat.yml
│ ├── Solaris.yml
│ ├── Suse.yml
│ ├── apache-22.yml
│ └── apache-24.yml
├── group_vars
│ └── all.yml
├── hosts.yml
├── hosts_vars
└── site.yml
11 directories, 28 files
ansadmin@svl200:~/projet4$
Network error: Software caused connection abort
────────────────────────────────────────────────────────────────────────────────
Session stopped
- Press <return> to exit tab
- Press R to restart session
- Press S to save terminal output to file
ofi03@146.59.156.114's password:
┌──────────────────────────────────────────────────────────────────────┐
│ • MobaXterm Personal Edition v22.0 •
│
│ (SSH client, X server and network tools)
│
│
│
│ → SSH session to ofi03@146.59.156.114
│
│ • Direct SSH : v
│
│ • SSH compression : v
│
│ • SSH-browser : v
│
│ • X11-forwarding : v (remote display is forwarded through
SSH) │
│
│
│ → For more info, ctrl+click on help or visit our website.
│
└──────────────────────────────────────────────────────────────────────┘
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information disabled due to load higher than 1.0
https://ubuntu.com/blog/microk8s-memory-optimisation
47 directories, 94 files
ansadmin@svl200:~$
ansadmin@svl200:~$ cd projet2
ansadmin@svl200:~/projet2$ tree
.
├── group_vars
│ └── all.yml
├── hosts.yml
├── hosts_vars
├── roles
│ └── users
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── site.yml
8 directories, 7 files
ansadmin@svl200:~/projet2$ sudo vim site.yml
ansadmin@svl200:~/projet2$ sudo vim roles/users/handlers/main.yml
ansadmin@svl200:~/projet2$ sudo vim roles/users/tasks/main.yml
ansadmin@svl200:~/projet2$ sudo vim roles/users/templates/index.html.j2
ansadmin@svl200:~/projet2$ sudo vim roles/users/vars/main.yml
ansadmin@svl200:~/projet2$ sudo vim site.yml
ansadmin@svl200:~/projet2$ sudo vim group_vars/all.yml
ansadmin@svl200:~/projet2$ sudo vim hosts.yml
ansadmin@svl200:~/projet2$
ansadmin@svl200:~/projet2$ cd
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo vim /etc/
Display all 201 possibilities? (y or n)
ansadmin@svl200:~$ sudo vim /etc/hosts
ansadmin@svl200:~$ sudo vim /etc/ansible/hosts
ansadmin@svl200:~$
ansadmin@svl200:~$ ssh
usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface]
[-b bind_address] [-c cipher_spec] [-D [bind_address:]port]
[-E log_file] [-e escape_char] [-F configfile] [-I pkcs11]
[-i identity_file] [-J [user@]host[:port]] [-L address]
[-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p
port]
[-Q query_option] [-R address] [-S ctl_path] [-W host:port]
[-w local_tun[:remote_tun]] destination [command]
ansadmin@svl200:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/ansadmin/.ssh/id_rsa):
/home/ansadmin/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/ansadmin/.ssh/id_rsa
Your public key has been saved in /home/ansadmin/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:JxwGhnJZfswUvx6gm7/XCGMXNUhKu+p80/p8jjTxJWw ansadmin@svl200
The key's randomart image is:
+---[RSA 3072]----+
| ++ +o.. |
| . +o * +. o |
| o . X .. . |
| = +.o |
| . S =.E . |
| +++.= o |
| +. =+o. |
| o .oo+oo |
| o.+*+o. |
+----[SHA256]-----+
ansadmin@svl200:~$ ssh
usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface]
[-b bind_address] [-c cipher_spec] [-D [bind_address:]port]
[-E log_file] [-e escape_char] [-F configfile] [-I pkcs11]
[-i identity_file] [-J [user@]host[:port]] [-L address]
[-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p
port]
[-Q query_option] [-R address] [-S ctl_path] [-W host:port]
[-w local_tun[:remote_tun]] destination [command]
ansadmin@svl200:~$ copy id
ansadmin@svl200:~$ ssh-copy-id -i /home/ansadmin/.ssh/id_rsa.pub
ansadmin@141.95.160.128 -p 55600
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed:
"/home/ansadmin/.ssh/id_rs a.pub"
The authenticity of host '[141.95.160.128]:55600 ([141.95.160.128]:55600)' can't be
esta blished.
ECDSA key fingerprint is SHA256:Asg9qJaW9YQpni0qR69B2dHbik3PNd4RsVKxzOkb1vo.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out
any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted
now i t is to install the new keys
ansadmin@141.95.160.128's password:
Permission denied, please try again.
ansadmin@141.95.160.128's password:
Permission denied, please try again.
ansadmin@141.95.160.128's password:
ansadmin@141.95.160.128: Permission denied (publickey,password).
ansadmin@svl200:~$
ansadmin@svl200:~$ sudo mkdir TP3
ansadmin@svl200:~$ cd TP3/
ansadmin@svl200:~/TP3$ sudo vim exo1.yaml
ansadmin@svl200:~/TP3$ ansible-playbook exo1.yaml
PLAY RECAP
*****************************************************************************
146.59.158.16 : ok=0 changed=0 unreachable=1
failed=0 skipped=0 rescued=0 ignored=0
ansadmin@svl200:~/TP3$
ansadmin@svl200:~/TP3$ sudo vim exo1.yaml
ansadmin@svl200:~/TP3$ ansible-playbook exo1.yaml
PLAY RECAP
*****************************************************************************
146.59.158.16 : ok=0 changed=0 unreachable=1
failed=0 skipped=0 rescued=0 ignored=0
PLAY RECAP
*****************************************************************************
141.95.160.128 : ok=0 changed=0 unreachable=1
failed=0 skipped=0 rescued=0 ignored=0
141.95.160.133 : ok=0 changed=0 unreachable=1
failed=0 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=0 changed=0 unreachable=1
failed=0 skipped=0 rescued=0 ignored=0
ansadmin@svl200:~/TP3$
ansadmin@svl200:~/TP3$ sudo vim exo1.yaml
ansadmin@svl200:~/TP3$ ansible-playbook exo1.yaml
PLAY RECAP
*****************************************************************************
141.95.160.128 : ok=0 changed=0 unreachable=1
failed=0 skipped=0 rescued=0 ignored=0
141.95.160.133 : ok=0 changed=0 unreachable=1
failed=0 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=0 changed=0 unreachable=1
failed=0 skipped=0 rescued=0 ignored=0
PLAY RECAP
*****************************************************************************
141.95.160.128 : ok=0 changed=0 unreachable=1
failed=0 skipped=0 rescued=0 ignored=0
141.95.160.133 : ok=0 changed=0 unreachable=1
failed=0 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=0 changed=0 unreachable=1
failed=0 skipped=0 rescued=0 ignored=0
ansadmin@svl200:~/TP3$
ansadmin@svl200:~/TP3$ ssh-copy-id -i /home/ansadmin/.ssh/id_rsa.pub
ansadmin@141.95.160 .16 -p 55600
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed:
"/home/ansadmin/.ssh/id_rs a.pub"
^C
ansadmin@svl200:~/TP3$ ssh-copy-id -i /home/ansadmin/.ssh/id_rsa.pub
ansadmin@141.95.160 .133 -p 55600
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed:
"/home/ansadmin/.ssh/id_rs a.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out
any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted
now i t is to install the new keys
ansadmin@141.95.160.133's password:
TASK [partition]
***********************************************************************
fatal: [141.95.160.133]: FAILED! => {"changed": false, "msg": "missing required
argument s: device"}
PLAY RECAP
*****************************************************************************
141.95.160.128 : ok=0 changed=0 unreachable=1
failed=0 skipped=0 rescued=0 ignored=0
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=0 changed=0 unreachable=1
failed=0 skipped=0 rescued=0 ignored=0
ansadmin@svl200:~/TP3$
ansadmin@svl200:~/TP3$ ansible-playbook exo1.yaml
PLAY [creation de partition]
***********************************************************
TASK [partition]
***********************************************************************
fatal: [146.59.158.16]: FAILED! => {"changed": false, "msg": "missing required
arguments : device"}
fatal: [141.95.160.133]: FAILED! => {"changed": false, "msg": "missing required
argument s: device"}
PLAY RECAP
*****************************************************************************
141.95.160.128 : ok=0 changed=0 unreachable=1
failed=0 skipped=0 rescued=0 ignored=0
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
ansadmin@svl200:~/TP3$
ansadmin@svl200:~/TP3$ ansible-playbook exo1.yaml
PLAY [creation de partition]
***********************************************************
TASK [Gathering Facts]
*****************************************************************
fatal: [141.95.160.128]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect
to the host via ssh: ansadmin@141.95.160.128: Permission denied
(publickey,password).", "u nreachable": true}
ok: [146.59.158.16]
ok: [141.95.160.133]
TASK [partition]
***********************************************************************
^Lfatal: [146.59.158.16]: FAILED! => {"changed": false, "msg": "missing required
argumen ts: device"}
fatal: [141.95.160.133]: FAILED! => {"changed": false, "msg": "missing required
argument s: device"}
PLAY RECAP
*****************************************************************************
141.95.160.128 : ok=0 changed=0 unreachable=1
failed=0 skipped=0 rescued=0 ignored=0
141.95.160.133 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
ansadmin@svl200:~/TP3$
ansadmin@svl200:~/TP3$ sudo vim exo1.yaml
ansadmin@svl200:~/TP3$ ansible-playbook exo1.yaml
TASK [partition]
***********************************************************************
fatal: [146.59.158.16]: FAILED! => {"changed": false, "msg": "missing required
arguments : device"}
PLAY RECAP
*****************************************************************************
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
TASK [partition]
***********************************************************************
fatal: [146.59.158.16]: FAILED! => {"changed": false, "msg": "state is present but
all o f the following are missing: number"}
PLAY RECAP
*****************************************************************************
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
TASK [partition]
***********************************************************************
fatal: [146.59.158.16]: FAILED! => {"changed": false, "err": [250.0, "M"], "msg":
"The a rgument 'part_end' doesn't respect required format.The size
unit is case sensitive."}
PLAY RECAP
*****************************************************************************
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
TASK [partition]
***********************************************************************
fatal: [146.59.158.16]: FAILED! => {"changed": false, "err": [250.0, "m"], "msg":
"The a rgument 'part_end' doesn't respect required format.The size
unit is case sensitive."}
PLAY RECAP
*****************************************************************************
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
TASK [partition]
***********************************************************************
fatal: [146.59.158.16]: FAILED! => {"changed": false, "err": [250.0, "mb"], "msg":
"The argument 'part_end' doesn't respect required format.The size
unit is case sensitive."}
PLAY RECAP
*****************************************************************************
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
TASK [partition]
***********************************************************************
fatal: [146.59.158.16]: FAILED! => {"changed": false, "err": "Error: Could not stat
devi ce /tp3_ansible/exo1 - No such file or directory.\n", "msg":
"Error while getting device information with parted script:
'/usr/sbin/parted -s -m /tp3_ansible/exo1 -- unit 'KiB' print'",
"out": "", "rc": 1}
PLAY RECAP
*****************************************************************************
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
ansadmin@svl200:~/TP3$
ansadmin@svl200:~/TP3$ sudo vim exo1.yaml
ansadmin@svl200:~/TP3$ ansible-playbook exo1.yaml
PLAY RECAP
*****************************************************************************
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
ansadmin@svl200:~/TP3$ ^C
ansadmin@svl200:~/TP3$
ansadmin@svl200:~/TP3$ sudo vim exo1.yaml
ansadmin@svl200:~/TP3$ ansible-playbook exo1.yaml
TASK [partition]
***********************************************************************
[WARNING]: The value [250.0, 'M'] (type list) in a string field was converted to
"[250.0, 'M']" (type string). If this does not look like what you expect, quote the
entire value to ensure it does not change.
fatal: [146.59.158.16]: FAILED! => {"changed": false, "msg": "Error interpreting
parted size output: '[250.0, 'M']'"}
PLAY RECAP
*****************************************************************************
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
ansadmin@svl200:~/TP3$
ansadmin@svl200:~/TP3$ sudo vim exo1.yaml
ansadmin@svl200:~/TP3$ ansible-playbook exo1.yaml
TASK [partition]
***********************************************************************
fatal: [146.59.158.16]: FAILED! => {"changed": false, "err": "Error: Could not stat
devi ce /tp3_ansible/exo1 - No such file or directory.\n", "msg":
"Error while getting device information with parted script:
'/usr/sbin/parted -s -m /tp3_ansible/exo1 -- unit 'KiB' print'",
"out": "", "rc": 1}
PLAY RECAP
*****************************************************************************
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
TASK [partition]
***********************************************************************
fatal: [146.59.158.16]: FAILED! => {"changed": false, "err": "Error: Could not stat
devi ce /tp3_ansible/exo1 - No such file or directory.\n", "msg":
"Error while getting device information with parted script:
'/usr/sbin/parted -s -m /tp3_ansible/exo1 -- unit 'KiB' print'",
"out": "", "rc": 1}
PLAY RECAP
*****************************************************************************
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
TASK [partition]
***********************************************************************
fatal: [146.59.158.16]: FAILED! => {"changed": false, "err": "Error: Could not stat
devi ce /dev/aaw - No such file or directory.\n", "msg": "Error while
getting device informat ion with parted script: '/usr/sbin/parted -s -
m /dev/aaw -- unit 'KiB' print'", "out": " ", "rc": 1}
PLAY RECAP
*****************************************************************************
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
ansadmin@svl200:~/TP3$ ^C
ansadmin@svl200:~/TP3$
ansadmin@svl200:~/TP3$ sudo vim exo1.yaml
ansadmin@svl200:~/TP3$ ansible-playbook exo1.yaml
PLAY [creation de partition]
***********************************************************
TASK [partition]
***********************************************************************
fatal: [146.59.158.16]: FAILED! => {"changed": false, "err": "Warning: Unable to open
/u sr/sbin/parted read-write (Text file busy). /usr/sbin/parted has
been opened read-only. \nError: Can't write to /usr/sbin/parted,
because it is opened read-only.\n", "msg": "Er ror while running
parted script: /usr/sbin/parted -s -m -a optimal /usr/sbin/parted -- u
nit KiB mklabel msdos mkpart primary 0% 100%", "out": "", "rc": 1}
PLAY RECAP
*****************************************************************************
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
ansadmin@svl200:~/TP3$ tree
ansadmin@svl200:~/TP3$ ansible cible1 -bm shell -a "mkdir tp3"
[WARNING]: Consider using the file module with state=directory rather than running
'mkdir'. If
false' to this command task or set 'command_warnings=False' in ansible.cfg to get rid
of this me
146.59.158.16 | CHANGED | rc=0 >>
ansadmin@svl200:~/TP3$
ansadmin@svl200:~/TP3$ ansible cible1 -bm shell -a "mkdir /tp3"
[WARNING]: Consider using the file module with state=directory rather than running
'mkdir'. If
false' to this command task or set 'command_warnings=False' in ansible.cfg to get rid
of this me
146.59.158.16 | FAILED | rc=1 >>
mkdir: cannot create directory ‘/tp3’: File existsnon-zero return code
ansadmin@svl200:~/TP3$
ansadmin@svl200:~/TP3$ sudo vim exo1.yaml
ansadmin@svl200:~/TP3$ ansible-playbook exo1.yaml
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc
TASK [partition]
*******************************************************************************
[WARNING]: The value 250 (type int) in a string field was converted to '250' (type
string). If t
ensure it does not change.
fatal: [146.59.158.16]: FAILED! => {"changed": false, "err": [250.0, ""], "msg": "The
argument 'e."}
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc
ansadmin@svl200:~/TP3$
ansadmin@svl200:~/TP3$ sudo vim exo1.yaml
ansadmin@svl200:~/TP3$
ansadmin@svl200:~/TP3$ ls
exo1.yaml
ansadmin@svl200:~/TP3$ mkdir roles
mkdir: cannot create directory ‘roles’: Permission denied
ansadmin@svl200:~/TP3$ sudo mkdir roles
ansadmin@svl200:~/TP3$
ansadmin@svl200:~/TP3$ ll
total 16
drwxr-xr-x 3 root root 4096 Oct 6 09:27 ./
drwxr-xr-x 11 ansadmin ansadmin 4096 Oct 6 07:59 ../
-rw-r--r-- 1 root root 209 Oct 6 09:23 exo1.yaml
drwxr-xr-x 2 root root 4096 Oct 6 09:27 roles/
ansadmin@svl200:~/TP3$ cd
ansadmin@svl200:~$
ansadmin@svl200:~$ cd projet2
ansadmin@svl200:~/projet2$ ls
group_vars hosts.yml hosts_vars roles site.yml
ansadmin@svl200:~/projet2$ cd
ansadmin@svl200:~$ cp projet2 TPansible
cp: -r not specified; omitting directory 'projet2'
ansadmin@svl200:~$ cp -r projet2 TPansible
ansadmin@svl200:~$
ansadmin@svl200:~$ cd TP
TP3/ TPansible/
ansadmin@svl200:~$ cd TPansible/
ansadmin@svl200:~/TPansible$ ls
group_vars hosts.yml hosts_vars roles site.yml
ansadmin@svl200:~/TPansible$ tree
.
├── group_vars
│ └── all.yml
├── hosts.yml
├── hosts_vars
├── roles
│ └── users
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── site.yml
8 directories, 7 files
ansadmin@svl200:~/TPansible$ cd
ansadmin@svl200:~$ cd TP3
ansadmin@svl200:~/TP3$ ls -lrt
total 8
-rw-r--r-- 1 root root 209 Oct 6 09:23 exo1.yaml
drwxr-xr-x 2 root root 4096 Oct 6 09:27 roles
ansadmin@svl200:~/TP3$
ansadmin@svl200:~/TP3$ cd
ansadmin@svl200:~$ cd TP
TP3/ TPansible/
ansadmin@svl200:~$ cd TPan
-bash: cd: TPan: No such file or directory
ansadmin@svl200:~$ cd TPansible/
ansadmin@svl200:~/TPansible$ ls
group_vars hosts.yml hosts_vars roles site.yml
ansadmin@svl200:~/TPansible$ tree
.
├── group_vars
│ └── all.yml
├── hosts.yml
├── hosts_vars
├── roles
│ └── users
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── site.yml
8 directories, 7 files
ansadmin@svl200:~/TPansible$ sudo vim
group_vars/ hosts.yml hosts_vars/ roles/ site.yml
ansadmin@svl200:~/TPansible$ sudo vim
group_vars/ hosts.yml hosts_vars/ roles/ site.yml
ansadmin@svl200:~/TPansible$ sudo vim roles/users/tasks/main.yml
ansadmin@svl200:~/TPansible$ sudo vim roles/users/templates/index.html.j2
ansadmin@svl200:~/TPansible$ sudo vim roles/users/vars/main.yml
ansadmin@svl200:~/TPansible$ sudo vim group_vars/all.yml
ansadmin@svl200:~/TPansible$ sudo vim site.yml
ansadmin@svl200:~/TPansible$ sudo vim group_vars/all.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml site.yml
[WARNING]: While constructing a mapping from /home/ansadmin/TPansible/hosts.yml, line
3, column
(cible1). Using last defined value only.
ERROR! conflicting action statements: hosts, tasks
---
- name: utilisation de LVM
^ here
ansadmin@svl200:~/TPansible$ sudo vim roles/users/tasks/main.yml
ansadmin@svl200:~/TPansible$ sudo vim roles/users/tasks/main.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml site.yml
[WARNING]: While constructing a mapping from /home/ansadmin/TPansible/hosts.yml, line
3, column
(cible1). Using last defined value only.
ERROR! conflicting action statements: hosts, tasks
---
- name: utilisation de LVM
^ here
ansadmin@svl200:~/TPansible$ sudo vim roles/users/tasks/main.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml site.yml
[WARNING]: While constructing a mapping from /home/ansadmin/TPansible/hosts.yml, line
3, column
(cible1). Using last defined value only.
ERROR! conflicting action statements: hosts, tasks
---
- name: utilisation de LVM
^ here
ansadmin@svl200:~/TPansible$ sudo vim roles/users/tasks/main.yml
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml site.yml -kk -u apx28
SSH password:
[WARNING]: While constructing a mapping from /home/ansadmin/TPansible/hosts.yml, line
3, column
(cible1). Using last defined value only.
ERROR! conflicting action statements: hosts, tasks
---
- name: partition lvm
^ here
ansadmin@svl200:~/TPansible$ sudo vim roles/users/tasks/main.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml site.yml -kk -u apx28
SSH password:
[WARNING]: While constructing a mapping from /home/ansadmin/TPansible/hosts.yml, line
3, column
(cible1). Using last defined value only.
ERROR! conflicting action statements: hosts, tasks
---
- name: partition lvm
^ here
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ sudo vim roles/users/tasks/main.yml
ansadmin@svl200:~/TPansible$ tree
.
├── group_vars
│ └── all.yml
├── hosts.yml
├── hosts_vars
├── roles
│ └── users
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── site.yml
8 directories, 7 files
ansadmin@svl200:~/TPansible$ sudo vim hosts.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml site.yml -kk -u apx28
SSH password:
ERROR! conflicting action statements: hosts, tasks
---
- name: partition lvm
^ here
ansadmin@svl200:~/TPansible$ sudo vim roles/users/tasks/main.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml site.yml -kk -u apx28
SSH password:
ERROR! conflicting action statements: hosts, tasks
---
- name: partition lvm
^ here
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml site.yml -kk -u apx28
SSH password:
ERROR! conflicting action statements: hosts, tasks
---
- name: partition lvm
^ here
ansadmin@svl200:~/TPansible$ sudo vim hosts.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml site.yml -kk -u apx28
SSH password:
ERROR! conflicting action statements: hosts, tasks
---
- name: partition lvm
^ here
ansadmin@svl200:~/TPansible$ sudo vim roles/users/tasks/main.yml
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml site.yml -kk -u apx28
SSH password:
ERROR! conflicting action statements: hosts, tasks
---
- name: partition lvm
^ here
ansadmin@svl200:~/TPansible$ cd ..
ansadmin@svl200:~$ tree
.
├── TP3 [error opening dir]
├── TPansible
│ ├── group_vars
│ │ └── all.yml
│ ├── hosts.yml
│ ├── hosts_vars
│ ├── roles
│ │ └── users
│ │ ├── handlers
│ │ │ └── main.yml
│ │ ├── tasks
│ │ │ └── main.yml
│ │ ├── templates
│ │ │ └── index.html.j2
│ │ └── vars
│ │ └── main.yml
│ └── site.yml
├── cible1.txt
├── copie.yaml
├── debug.yaml
├── debug1.yaml
├── exo2.yaml
├── exo3.yaml
├── exo4.yaml
├── fact.yaml
├── fact1.yaml
├── handler.yaml
├── hello.yaml
├── hello.yml
├── index.html
├── index.html.j2
├── index.html1.j2
├── ip.txt
├── item_users.yaml
├── items.yaml
├── items_users.yaml
├── list.yaml
├── locale.yml
├── nginx.yaml
├── play-vars.yaml
├── play-vars.yml
├── projet
│ ├── group_vars
│ │ ├── cible1.yaml
│ │ └── cible2.yaml
│ ├── host_vars
│ │ ├── client1.yaml
│ │ └── client2.yaml
│ ├── install.yaml
│ ├── inventory.yaml
│ └── vars_install.yaml
├── projet1
│ ├── group_vars
│ │ └── all.yml
│ ├── hosts.yml
│ ├── hosts_vars
│ ├── roles
│ │ └── apache
│ │ ├── handlers
│ │ │ └── main.yml
│ │ ├── tasks
│ │ │ └── main.yml
│ │ ├── templates
│ │ │ └── index.html.j2
│ │ └── vars
│ │ └── main.yml
│ └── site.yml
├── projet2
│ ├── group_vars
│ │ └── all.yml
│ ├── hosts.yml
│ ├── hosts_vars
│ ├── roles
│ │ └── users
│ │ ├── handlers
│ │ │ └── main.yml
│ │ ├── tasks
│ │ │ └── main.yml
│ │ ├── templates
│ │ │ └── index.html.j2
│ │ └── vars
│ │ └── main.yml
│ └── site.yml
├── projet3
│ ├── README.md
│ ├── defaults
│ │ └── main.yml
│ ├── files
│ ├── handlers
│ │ └── main.yml
│ ├── meta
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ ├── tests
│ │ ├── inventory
│ │ └── test.yml
│ └── vars
│ └── main.yml
├── projet4
│ ├── geerlingguy.apache
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── defaults
│ │ │ └── main.yml
│ │ ├── handlers
│ │ │ └── main.yml
│ │ ├── meta
│ │ │ └── main.yml
│ │ ├── molecule
│ │ │ └── default
│ │ │ ├── converge.yml
│ │ │ └── molecule.yml
│ │ ├── site.yml
│ │ ├── tasks
│ │ │ ├── configure-Debian.yml
│ │ │ ├── configure-RedHat.yml
│ │ │ ├── configure-Solaris.yml
│ │ │ ├── configure-Suse.yml
│ │ │ ├── main.yml
│ │ │ ├── setup-Debian.yml
│ │ │ ├── setup-RedHat.yml
│ │ │ ├── setup-Solaris.yml
│ │ │ └── setup-Suse.yml
│ │ ├── templates
│ │ │ └── vhosts.conf.j2
│ │ └── vars
│ │ ├── AmazonLinux.yml
│ │ ├── Debian.yml
│ │ ├── RedHat.yml
│ │ ├── Solaris.yml
│ │ ├── Suse.yml
│ │ ├── apache-22.yml
│ │ └── apache-24.yml
│ ├── group_vars
│ │ └── all.yml
│ ├── hosts.yml
│ ├── hosts_vars
│ └── site.yml
├── rep.yaml
├── seq.yaml
├── shell.yml
├── snap
│ └── tree
│ ├── 18
│ ├── common
│ └── current -> 18
├── template.yaml
├── template1.yaml
├── var_dic.yml
├── var_dic2.yml
├── var_dic_multi3.yml
├── vars.yml
├── vars2.yml
├── vars_multi.yml
├── when.yaml
└── when1.yaml
---
- name: partition lvm
^ here
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ sudo vim roles/users/tasks/main.yml
ansadmin@svl200:~/TPansible$ tree
.
├── group_vars
│ └── all.yml
├── hosts.yml
├── hosts_vars
├── roles
│ └── users
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── site.yml
8 directories, 7 files
ansadmin@svl200:~/TPansible$ sudo vim hosts.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml site.yml -kk -u apx28
SSH password:
ERROR! conflicting action statements: hosts, tasks
---
- name: partition lvm
^ here
ansadmin@svl200:~/TPansible$ sudo vim roles/users/tasks/main.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml site.yml -kk -u apx28
SSH password:
ERROR! conflicting action statements: hosts, tasks
---
- name: partition lvm
^ here
ansadmin@svl200:~/TPansible$ sudo vim roles/users/tasks/main.yml
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml site.yml -kk -u apx28
SSH password:
ERROR! conflicting action statements: hosts, tasks
---
- name: partition lvm
^ here
ansadmin@svl200:~/TPansible$ tree
.
├── group_vars
│ └── all.yml
├── hosts.yml
├── hosts_vars
├── roles
│ └── users
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── site.yml
8 directories, 7 files
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml site.yml -kk -u apx28
SSH password:
ERROR! conflicting action statements: hosts, tasks
---
- name: partition lvm
^ here
ansadmin@svl200:~/TPansible$ sudo vim hosts.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml site.yml -kk -u apx28
SSH password:
[DEPRECATION WARNING]: The TRANSFORM_INVALID_GROUP_CHARS settings is set to allow bad
characters
will change, but still be user configurable on deprecation. This feature will be
removed in vers
be disabled by setting deprecation_warnings=False in ansible.cfg.
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv
to see detai
ERROR! conflicting action statements: hosts, tasks
---
- name: partition lvm
^ here
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml site.yml -kk -u apx28
SSH password:
[DEPRECATION WARNING]: The TRANSFORM_INVALID_GROUP_CHARS settings is set to allow bad
characters
will change, but still be user configurable on deprecation. This feature will be
removed in vers
be disabled by setting deprecation_warnings=False in ansible.cfg.
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv
to see detai
ERROR! conflicting action statements: hosts, tasks
---
- name: partition lvm
^ here
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ cd
ansadmin@svl200:~$
ansadmin@svl200:~$ cd
.ansible/ .ssh/ TP3/ TPansible/ projet/ projet1/
projet2/ projet3/ projet4/
ansadmin@svl200:~$ cd TPansible/
ansadmin@svl200:~/TPansible$ ls
group_vars hosts.yml hosts_vars roles site.yml
ansadmin@svl200:~/TPansible$ tree
.
├── group_vars
│ └── all.yml
├── hosts.yml
├── hosts_vars
├── roles
│ └── users
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── site.yml
8 directories, 7 files
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml site.yml -kk -u apx28
SSH password:
[DEPRECATION WARNING]: The TRANSFORM_INVALID_GROUP_CHARS settings is set to allow bad
characters
will change, but still be user configurable on deprecation. This feature will be
removed in vers
be disabled by setting deprecation_warnings=False in ansible.cfg.
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv
to see detai
ERROR! conflicting action statements: hosts, tasks
---
- name: partition lvm
^ here
ansadmin@svl200:~/TPansible$ sudo vim hosts.yml
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml site.yml -kk -u apx28
SSH password:
ERROR! conflicting action statements: hosts, tasks
---
- name: partition lvm
^ here
ansadmin@svl200:~/TPansible$ ls
group_vars hosts.yml hosts_vars roles site.yml
ansadmin@svl200:~/TPansible$ cd roles/
ansadmin@svl200:~/TPansible/roles$ ls
users
ansadmin@svl200:~/TPansible/roles$ cd users/$
-bash: cd: users/$: No such file or directory
ansadmin@svl200:~/TPansible/roles$ cd users/
ansadmin@svl200:~/TPansible/roles/users$ ls
handlers tasks templates vars
ansadmin@svl200:~/TPansible/roles/users$ cp tasks/main.yml ../../
ansadmin@svl200:~/TPansible/roles/users$ cd ../../
ansadmin@svl200:~/TPansible$ ls
group_vars hosts.yml hosts_vars main.yml roles site.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml main.yml -kk -u apx28
SSH password:
PLAY RECAP
*************************************************************************************
141.95.160.128 : ok=0 changed=0 unreachable=1
failed=0 skipped=0 resc
client1 : ok=0 changed=0
unreachable=1 failed=0 skipped=0 resc
client2 : ok=0 changed=0
unreachable=1 failed=0 skipped=0 resc
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ ssh-copy-id -i /home/ansadmin/.ssh/id_rsa.pub
ansadmin@141.95.160.1
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed:
"/home/ansadmin/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out
any that are
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted
now it is to
ansadmin@141.95.160.128's password:
Permission denied, please try again.
ansadmin@141.95.160.128's password:
Now try logging into the machine, with: "ssh -p '55600' 'apx28@141.95.160.128'"
and check to make sure that only the key(s) you wanted were added.
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml site.yml -kk -u apx28
SSH password:
ERROR! conflicting action statements: hosts, tasks
---
- name: partition lvm
^ here
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml main.yml -kk -u apx28
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml main.yml -kk -u apx28
SSH password:
PLAY RECAP
*************************************************************************************
141.95.160.128 : ok=0 changed=0 unreachable=0
failed=1 skipped=0 resc
client1 : ok=0 changed=0
unreachable=0 failed=1 skipped=0 resc
client2 : ok=0 changed=0
unreachable=0 failed=1 skipped=0 resc
TASK [partition1]
******************************************************************************
changed: [141.95.160.128]
TASK [creation de fichier]
*********************************************************************
changed: [141.95.160.128]
TASK [filesystem]
******************************************************************************
changed: [141.95.160.128]
TASK [montage]
*********************************************************************************
changed: [141.95.160.128]
PLAY RECAP
*************************************************************************************
141.95.160.128 : ok=5 changed=4 unreachable=0
failed=0 skipped=0 resc
client1 : ok=0 changed=0
unreachable=1 failed=0 skipped=0 resc
client2 : ok=0 changed=0
unreachable=1 failed=0 skipped=0 resc
ansadmin@svl200:~/TPansible$ ls
ansadmin@svl200:~/TPansible$ sudo vim hosts.yml
ansadmin@svl200:~/TPansible$ sudo vim roles/users/tasks/main.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml main.yml -u apx28
TASK [partition1]
******************************************************************************
ok: [141.95.160.128]
TASK [filesystem]
******************************************************************************
ok: [141.95.160.128]
TASK [montage]
*********************************************************************************
ok: [141.95.160.128]
PLAY RECAP
*************************************************************************************
141.95.160.128 : ok=5 changed=1 unreachable=0
failed=0 skipped=0 resc
client1 : ok=0 changed=0
unreachable=1 failed=0 skipped=0 resc
client2 : ok=0 changed=0
unreachable=1 failed=0 skipped=0 resc
TASK [partition1]
******************************************************************************
ok: [141.95.160.128]
TASK [filesystem]
******************************************************************************
ok: [141.95.160.128]
TASK [montage]
*********************************************************************************
ok: [141.95.160.128]
PLAY RECAP
*************************************************************************************
141.95.160.128 : ok=5 changed=0 unreachable=0
failed=0 skipped=0 resc
TASK [partition1]
******************************************************************************
ok: [141.95.160.128]
TASK [filesystem]
******************************************************************************
ok: [141.95.160.128]
TASK [montage]
*********************************************************************************
ok: [141.95.160.128]
PLAY RECAP
*************************************************************************************
141.95.160.128 : ok=5 changed=0 unreachable=0
failed=0 skipped=0 resc
tasks:
- name: partition1
lvol:
vg: datavg
lv: ansible_lv1_aaw
size: 250M
force: yes
- name: filesystem
filesystem:
fstype: xfs
dev: /dev/datavg/ansible_lv1_aaw
- name: montage
mount:
path: /tp3_aaw
src: /dev/datavg/ansible_lv1_aaw
fstype: xfs
state: mounted
- name: partition1
lvol:
vg: datavg
lv: ansible_lv2_aaw
size: 250M
force: yes
- name: filesystem
filesystem:
fstype: xfs
dev: /dev/datavg/ansible_lv2_aaw
- name: montage
mount:
path: /tp3_aaw
src: /dev/datavg/ansible_lv2_aaw
fstype: xfs
state: mounted
ansadmin@svl200:~/TPansible$ ^C
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml main.yml -u apx28
TASK [partition1]
******************************************************************************
ok: [141.95.160.128]
TASK [filesystem]
******************************************************************************
ok: [141.95.160.128]
TASK [montage]
*********************************************************************************
ok: [141.95.160.128]
PLAY RECAP
*************************************************************************************
141.95.160.128 : ok=5 changed=0 unreachable=0
failed=0 skipped=0 resc
ansadmin@svl200:~/TPansible$ cd
ansadmin@svl200:~$ ansible 141.95.160.128 -bm shell -a "df -h /dev/datavg"
141.95.160.128 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ansadmin@141.95.160.128:
Permission denied (p
"unreachable": true
}
ansadmin@svl200:~$ cd TPansible/
ansadmin@svl200:~/TPansible$ tree
.
├── group_vars
│ └── all.yml
├── hosts.yml
├── hosts_vars
├── main.yml
├── roles
│ └── users
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── site.yml
8 directories, 8 files
ansadmin@svl200:~/TPansible$ cd
ansadmin@svl200:~$ ls
TP3 exo2.yaml hello.yaml item_users.yaml
play-vars.yaml projet4 temp
TPansible exo3.yaml hello.yml items.yaml
play-vars.yml rep.yaml var_
cible1.txt exo4.yaml index.html items_users.yaml projet
seq.yaml var_
copie.yaml fact.yaml index.html.j2 list.yaml
projet1 shell.yml var_
debug.yaml fact1.yaml index.html1.j2 locale.yml projet2
snap vars
debug1.yaml handler.yaml ip.txt nginx.yaml
projet3 template.yaml vars
ansadmin@svl200:~$
lv: ansible_lv1_aaw
size: 250M
force: yes
- name: filesystem
filesystem:
fstype: xfs
dev: /dev/datavg/ansible_lv1_aaw
- name: montage
mount:
path: /tp3_aaw
src: /dev/datavg/ansible_lv1_aaw
fstype: xfs
state: mounted
:
Network error: Software caused connection abort
─────────────────────────────────────────────────────────────────────────────────────
───────────
Session stopped
- Press <return> to exit tab
- Press R to restart session
- Press S to save terminal output to file
ofi03@146.59.156.114's password:
┌──────────────────────────────────────────────────────────────────────┐
│ • MobaXterm Personal Edition v22.0 •
│
│ (SSH client, X server and network tools)
│
│
│
│ → SSH session to ofi03@146.59.156.114
│
│ • Direct SSH : v
│
│ • SSH compression : v
│
│ • SSH-browser : v
│
│ • X11-forwarding : v (remote display is forwarded through
SSH) │
│
│
│ → For more info, ctrl+click on help or visit our website.
│
└──────────────────────────────────────────────────────────────────────┘
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
https://ubuntu.com/blog/microk8s-memory-optimisation
10 updates can be applied immediately.
To see these additional updates run: apt list --upgradable
TASK [partition1]
******************************************************************************
ok: [141.95.160.128]
TASK [filesystem]
******************************************************************************
ok: [141.95.160.128]
TASK [montage]
*********************************************************************************
ok: [141.95.160.128]
PLAY RECAP
*************************************************************************************
141.95.160.128 : ok=5 changed=0 unreachable=0
failed=0 skipped=0 resc
TASK [partition1]
******************************************************************************
ok: [141.95.160.128]
TASK [filesystem]
******************************************************************************
ok: [141.95.160.128]
TASK [montage]
*********************************************************************************
ok: [141.95.160.128]
PLAY RECAP
*************************************************************************************
141.95.160.128 : ok=5 changed=0 unreachable=0
failed=0 skipped=0 resc
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ ls
group_vars hosts.yml hosts_vars main.yml roles site.yml
ansadmin@svl200:~/TPansible$ sudo vim main.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml main.yml -u apx28
TASK [partition1]
******************************************************************************
ok: [141.95.160.128]
TASK [creation de fichier]
*********************************************************************
ok: [141.95.160.128]
TASK [filesystem]
******************************************************************************
changed: [141.95.160.128]
TASK [montage]
*********************************************************************************
changed: [141.95.160.128]
TASK [partition2]
******************************************************************************
changed: [141.95.160.128]
TASK [filesystem]
******************************************************************************
changed: [141.95.160.128]
TASK [montage]
*********************************************************************************
changed: [141.95.160.128]
PLAY RECAP
*************************************************************************************
141.95.160.128 : ok=9 changed=5 unreachable=0
failed=0 skipped=0 resc
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ ls
group_vars hosts.yml hosts_vars main.yml roles site.yml
ansadmin@svl200:~/TPansible$ sudo vim main_base.yml
ansadmin@svl200:~/TPansible$ cat main.yml
---
- name: partition lvm
hosts: all
become: true
tasks:
- name: partition1
lvol:
vg: datavg
lv: ansible_lv1_aaw
size: 250M
force: yes
- name: filesystem
filesystem:
fstype: xfs
dev: /dev/datavg/ansible_lv1_aaw
- name: montage
mount:
path: /tp3_aaw
src: /dev/datavg/ansible_lv1_aaw
fstype: xfs
state: mounted
- name: partition2
lvol:
vg: datavg
lv: ansible_lv2_aaw
size: 250M
force: yes
- name: filesystem
filesystem:
fstype: xfs
dev: /dev/datavg/ansible_lv2_aaw
- name: montage
mount:
path: /tp3_aaw
src: /dev/datavg/ansible_lv2_aaw
fstype: xfs
state: mounted
ansadmin@svl200:~/TPansible$ ^C
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ sudo vim main_base.yml
ansadmin@svl200:~/TPansible$ sudo vim main_postgres.yml
ansadmin@svl200:~/TPansible$ sudo vim hosts.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml main_.yml -u apx28
main_base.yml main_postgres.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml main_postgres.yml -u apx28
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=0 changed=0 unreachable=1
failed=0 skipped=0 resc
TASK [debug]
***********************************************************************************
ok: [146.59.158.16] => {
"msg": "play_hosts=['146.59.158.16']"
}
TASK [debug]
***********************************************************************************
ok: [146.59.158.16] => {
"msg": "ansible_distribution=Ubuntu"
}
TASK [debug]
***********************************************************************************
ok: [146.59.158.16] => {
"msg": "deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main"
}
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=7 changed=3 unreachable=0
failed=1 skipped=0 resc
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ sudo vim main_postgres.yml
ansadmin@svl200:~/TPansible$ sudo vim main_base.yml
ansadmin@svl200:~/TPansible$ ls
group_vars hosts.yml hosts_vars main.yml main_base.yml
main_postgres.yml roles site.yml
ansadmin@svl200:~/TPansible$ sudo vim main_postgres.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml main_postgres.yml
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=2 changed=0 unreachable=0
failed=0 skipped=0 resc
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 resc
TASK [package_python]
**************************************************************************
changed: [146.59.158.16]
TASK [acl]
*************************************************************************************
changed: [146.59.158.16]
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=4 changed=3 unreachable=0
failed=1 skipped=0 resc
TASK [package_python]
**************************************************************************
ok: [146.59.158.16]
TASK [acl]
*************************************************************************************
ok: [146.59.158.16]
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=6 changed=1 unreachable=0
failed=0 skipped=0 resc
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ sudo vim main_postgres.yml
ansadmin@svl200:~/TPansible$ sudo vim main_houcem.yml
ansadmin@svl200:~/TPansible$ sudo vim main_postgres.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml main_postgres.yml
TASK [package_python]
**************************************************************************
ok: [146.59.158.16]
TASK [acl]
*************************************************************************************
ok: [146.59.158.16]
TASK [BD]
*************************************************************************************
*
changed: [146.59.158.16]
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=8 changed=2 unreachable=0
failed=0 skipped=0 resc
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ cp /home/ofi03/psql.yml /home/ofi03/dump.sql .
ansadmin@svl200:~/TPansible$ ls
dump.sql hosts.yml main.yml main_houcem.yml psql.yml
site.yml
group_vars hosts_vars main_base.yml main_postgres.yml roles
ansadmin@svl200:~/TPansible$ sudo vim psql.yml
ansadmin@svl200:~/TPansible$ sudo vim dump.sql
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml psql.yml
ERROR! Syntax Error while loading YAML.
did not find expected key
The error appears to be in '/home/ansadmin/TPansible/psql.yml': line 3, column 6, but
may
be elsewhere in the file depending on the exact syntax problem.
with_items:
- {{ foo }}
with_items:
- "{{ foo }}"
ansadmin@svl200:~/TPansible$ sudo vim psql.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml psql.yml
ERROR! A playbook must be a list of plays, got a <class
'ansible.parsing.yaml.objects.AnsibleMap
tasks:
^ here
ansadmin@svl200:~/TPansible$ sudo vim main_postgres.yml
ansadmin@svl200:~/TPansible$ sudo vim psql.yml
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml psql.yml
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=4 changed=2 unreachable=0
failed=1 skipped=0 resc
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=4 changed=0 unreachable=0
failed=1 skipped=0 resc
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=4 changed=0 unreachable=0
failed=1 skipped=0 resc
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=4 changed=0 unreachable=0
failed=1 skipped=0 resc
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=4 changed=0 unreachable=0
failed=1 skipped=0 resc
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml main_postgres.yml
TASK [package_python]
**************************************************************************
ok: [146.59.158.16]
TASK [acl]
*************************************************************************************
ok: [146.59.158.16]
TASK [BD]
*************************************************************************************
*
ok: [146.59.158.16]
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ sudo vim psql.yml
ansadmin@svl200:~/TPansible$ sudo vim main_postgres.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml main_postgres.yml dump.sql
TASK [package_python]
**************************************************************************
ok: [146.59.158.16]
TASK [acl]
*************************************************************************************
ok: [146.59.158.16]
TASK [BD]
*************************************************************************************
*
ok: [146.59.158.16]
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=8 changed=1 unreachable=0
failed=1 skipped=0 resc
TASK [package_python]
**************************************************************************
ok: [146.59.158.16]
TASK [acl]
*************************************************************************************
ok: [146.59.158.16]
TASK [BD]
*************************************************************************************
*
ok: [146.59.158.16]
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=8 changed=1 unreachable=0
failed=1 skipped=0 resc
TASK [package_python]
**************************************************************************
ok: [146.59.158.16]
TASK [acl]
*************************************************************************************
ok: [146.59.158.16]
TASK [BD]
*************************************************************************************
*
ok: [146.59.158.16]
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=8 changed=1 unreachable=0
failed=1 skipped=0 resc
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml main_postgres.yml
TASK [package_python]
**************************************************************************
ok: [146.59.158.16]
TASK [acl]
*************************************************************************************
ok: [146.59.158.16]
TASK [BD]
*************************************************************************************
*
ok: [146.59.158.16]
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=8 changed=1 unreachable=0
failed=1 skipped=0 resc
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ sudo vim main_postgres.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml main_postgres.yml
PLAY [install postgresql and BD]
***************************************************************
TASK [package_python]
**************************************************************************
ok: [146.59.158.16]
TASK [acl]
*************************************************************************************
ok: [146.59.158.16]
TASK [BD]
*************************************************************************************
*
ok: [146.59.158.16]
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=8 changed=1 unreachable=0
failed=1 skipped=0 resc
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ sudo vim main_postgres.yml
ansadmin@svl200:~/TPansible$ ls
dump.sql hosts.yml main.yml main_houcem.yml psql.yml
site.yml
group_vars hosts_vars main_base.yml main_postgres.yml roles
ansadmin@svl200:~/TPansible$ pwd
/home/ansadmin/TPansible
ansadmin@svl200:~/TPansible$ ^C
ansadmin@svl200:~/TPansible$ sudo vim main_postgres.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml main_postgres.yml
TASK [package_python]
**************************************************************************
ok: [146.59.158.16]
TASK [acl]
*************************************************************************************
ok: [146.59.158.16]
TASK [BD]
*************************************************************************************
*
ok: [146.59.158.16]
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=8 changed=1 unreachable=0
failed=1 skipped=0 resc
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ ls
dump.sql hosts.yml main.yml main_houcem.yml psql.yml
site.yml
group_vars hosts_vars main_base.yml main_postgres.yml roles
ansadmin@svl200:~/TPansible$ mv dump.sql dump.yml
ansadmin@svl200:~/TPansible$ ls
dump.yml hosts.yml main.yml main_houcem.yml psql.yml
site.yml
group_vars hosts_vars main_base.yml main_postgres.yml roles
ansadmin@svl200:~/TPansible$ sudo vim main_postgres.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml main_postgres.yml
TASK [package_python]
**************************************************************************
ok: [146.59.158.16]
TASK [acl]
*************************************************************************************
ok: [146.59.158.16]
TASK [BD]
*************************************************************************************
*
ok: [146.59.158.16]
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=8 changed=1 unreachable=0
failed=1 skipped=0 resc
ansadmin@svl200:~/TPansible$ ^C
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ sudo vim main_postgres.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml main_postgres.yml
TASK [package_python]
**************************************************************************
ok: [146.59.158.16]
TASK [acl]
*************************************************************************************
ok: [146.59.158.16]
TASK [BD]
*************************************************************************************
*
ok: [146.59.158.16]
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ sudo vim main_postgres.yml
ansadmin@svl200:~/TPansible$ sudo vim /etc/ansible/ansible.cfg
ansadmin@svl200:~/TPansible$ sudo vim /etc/ansible/ansible.cfg
ansadmin@svl200:~/TPansible$ sudo vim main_postgres.yml
ansadmin@svl200:~/TPansible$ sudo vim main_postgres.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml main_postgres.yml
TASK [package_python]
**************************************************************************
ok: [146.59.158.16]
TASK [acl]
*************************************************************************************
ok: [146.59.158.16]
TASK [BD]
*************************************************************************************
*
ok: [146.59.158.16]
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=9 changed=2 unreachable=0
failed=0 skipped=0 resc
TASK [package_python]
**************************************************************************
ok: [146.59.158.16]
TASK [acl]
*************************************************************************************
ok: [146.59.158.16]
TASK [BD]
*************************************************************************************
*
ok: [146.59.158.16]
TASK [sauvegarde]
******************************************************************************
fatal: [146.59.158.16]: FAILED! => {"changed": false, "cmd": "/usr/bin/pg_dump dbofi
--port=5432es > /tmp/dbofi.sql", "msg": "pg_dump: error: connection to server on
socket \"/var/run/postgres failed: FATAL: Peer authentication failed for
user \"postgres\"\n", "rc": 1, "stdout": "", "st
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=9 changed=2 unreachable=0
failed=1 skipped=0 resc
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ sudo vim main_postgres.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml main_postgres.yml
ERROR! Syntax Error while loading YAML.
mapping values are not allowed in this context
- name: package_python
target: /tmp/dbofi.sql
^ here
ansadmin@svl200:~/TPansible$ sudo vim main_postgres.yml
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml main_postgres.yml
ERROR! this task 'target' has extra params, which is only allowed in the following
modules: incl set_fact, raw, shell, include, add_host, import_role, win_command,
meta, include_vars, command,ort_tasks, win_shell, group_by
state: pg_dump
- name: package_python
^ here
ansadmin@svl200:~/TPansible$ sudo vim main_postgres.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml main_postgres.yml
TASK [package_python]
**************************************************************************
ok: [146.59.158.16]
TASK [acl]
*************************************************************************************
ok: [146.59.158.16]
TASK [BD]
*************************************************************************************
*
ok: [146.59.158.16]
TASK [sauvegarde]
******************************************************************************
fatal: [146.59.158.16]: FAILED! => {"changed": false, "msg": "value of state must be
one of: abs, restore, got: pg_dump"}
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=9 changed=2 unreachable=0
failed=1 skipped=0 resc
TASK [package_python]
**************************************************************************
ok: [146.59.158.16]
TASK [acl]
*************************************************************************************
ok: [146.59.158.16]
TASK [BD]
*************************************************************************************
*
ok: [146.59.158.16]
TASK [sauvegarde]
******************************************************************************
fatal: [146.59.158.16]: FAILED! => {"changed": false, "cmd": "/usr/bin/pg_dump dbofi
--port=5432es > /tmp/dbofi.sql", "msg": "pg_dump: error: connection to server on
socket \"/var/run/postgres failed: FATAL: Peer authentication failed for
user \"postgres\"\n", "rc": 1, "stdout": "", "st
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=9 changed=2 unreachable=0
failed=1 skipped=0 resc
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ sudo vim main_postgres.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml main_postgres.yml
TASK [package_python]
**************************************************************************
ok: [146.59.158.16]
TASK [acl]
*************************************************************************************
ok: [146.59.158.16]
TASK [BD]
*************************************************************************************
*
ok: [146.59.158.16]
TASK [sauvegarde]
******************************************************************************
changed: [146.59.158.16]
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=10 changed=3 unreachable=0
failed=0 skipped=0 resc
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ cat
dump.yml hosts_vars/ main_houcem.yml
roles/
group_vars/ main.yml main_postgres.yml
site.yml
hosts.yml main_base.yml psql.yml
ansadmin@svl200:~/TPansible$ cat main_postgres.yml
- name: install postgresql and BD
hosts: cible1
become: yes
become_method: sudo
gather_facts: yes
tasks:
- name: installation postgresql-contrib
apt:
name: postgresql-contrib
state: latest
- name: package_python
apt:
name: python3-psycopg2
state: latest
- name: acl
apt:
name: acl
state: latest
- name: BD
postgresql_db:
state: present
name: dbofi
become: true
become_user: postgres
- name: sauvegarde
postgresql_db:
name: dbofi
state: dump
target: /tmp/dbofi_aaw.sql
become: true
become_user: postgres
tags: dump
ansadmin@svl200:~/TPansible$ ^C
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ sudo vim main_postgres.yml
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ sudo vim main_postgres.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml main_postgres.yml
TASK [package_python]
**************************************************************************
ok: [146.59.158.16]
TASK [acl]
*************************************************************************************
ok: [146.59.158.16]
TASK [BD]
*************************************************************************************
*
ok: [146.59.158.16]
TASK [sauvegarde]
******************************************************************************
changed: [146.59.158.16]
TASK [BD]
*************************************************************************************
*
changed: [146.59.158.16]
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=12 changed=5 unreachable=0
failed=0 skipped=0 resc
ansadmin@svl200:~/TPansible$ sudo vim main_postgres.yml
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml main_postgres.yml
TASK [package_python]
**************************************************************************
ok: [146.59.158.16]
TASK [acl]
*************************************************************************************
ok: [146.59.158.16]
TASK [BD]
*************************************************************************************
*
ok: [146.59.158.16]
TASK [sauvegarde]
******************************************************************************
changed: [146.59.158.16]
TASK [BD]
*************************************************************************************
*
ok: [146.59.158.16]
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=12 changed=4 unreachable=0
failed=0 skipped=0 resc
TASK [package_python]
**************************************************************************
ok: [146.59.158.16]
TASK [acl]
*************************************************************************************
ok: [146.59.158.16]
TASK [BD]
*************************************************************************************
*
ok: [146.59.158.16]
TASK [sauvegarde]
******************************************************************************
changed: [146.59.158.16]
TASK [BD]
*************************************************************************************
*
ok: [146.59.158.16]
PLAY RECAP
*************************************************************************************
146.59.158.16 : ok=13 changed=5 unreachable=0
failed=0 skipped=0 resc
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ sudo vim main_postgres.yml
ansadmin@svl200:~/TPansible$ ls
dump.yml hosts.yml main.yml main_houcem.yml psql.yml
site.yml
group_vars hosts_vars main_base.yml main_postgres.yml roles
ansadmin@svl200:~/TPansible$ cd roles
ansadmin@svl200:~/TPansible/roles$ ls
users
ansadmin@svl200:~/TPansible/roles$
ansadmin@svl200:~/TPansible/roles$ ls
users
ansadmin@svl200:~/TPansible/roles$ cp -r users postgres
ansadmin@svl200:~/TPansible/roles$
ansadmin@svl200:~/TPansible/roles$ ls
postgres users
ansadmin@svl200:~/TPansible/roles$ - name: BD
- name: Import BD
become: true
become_user: postgres
shell: psql dbapx < /tmp/dbofi_aaw.sql
8 directories, 8 files
ansadmin@svl200:~/TPansible/roles/TPpostgres$ cd ..
ansadmin@svl200:~/TPansible/roles$ tree
.
├── TPpostgres
│ ├── README.md
│ ├── defaults
│ │ └── main.yml
│ ├── files
│ ├── handlers
│ │ └── main.yml
│ ├── meta
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ ├── tests
│ │ ├── inventory
│ │ └── test.yml
│ └── vars
│ └── main.yml
├── postgres
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── users
├── handlers
│ └── main.yml
├── tasks
│ └── main.yml
├── templates
│ └── index.html.j2
└── vars
└── main.yml
19 directories, 16 files
ansadmin@svl200:~/TPansible/roles$ cd ..
ansadmin@svl200:~/TPansible$ tree
.
├── dump.yml
├── group_vars
│ └── all.yml
├── hosts.yml
├── hosts_vars
├── main.yml
├── main_base.yml
├── main_houcem.yml
├── main_postgres.yml
├── psql.yml
├── roles
│ ├── TPpostgres
│ │ ├── README.md
│ │ ├── defaults
│ │ │ └── main.yml
│ │ ├── files
│ │ ├── handlers
│ │ │ └── main.yml
│ │ ├── meta
│ │ │ └── main.yml
│ │ ├── tasks
│ │ │ └── main.yml
│ │ ├── templates
│ │ ├── tests
│ │ │ ├── inventory
│ │ │ └── test.yml
│ │ └── vars
│ │ └── main.yml
│ ├── postgres
│ │ ├── handlers
│ │ │ └── main.yml
│ │ ├── tasks
│ │ │ └── main.yml
│ │ ├── templates
│ │ │ └── index.html.j2
│ │ └── vars
│ │ └── main.yml
│ └── users
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── site.yml
22 directories, 25 files
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ ls
dump.yml hosts_vars main_houcem.yml roles
group_vars main.yml main_postgres.yml site.yml
hosts.yml main_base.yml psql.yml
ansadmin@svl200:~/TPansible$ cd roles
ansadmin@svl200:~/TPansible/roles$ ls
TPpostgres postgres users
ansadmin@svl200:~/TPansible/roles$ mv TPpostgres/ ../
ansadmin@svl200:~/TPansible/roles$ cd..
cd..: command not found
ansadmin@svl200:~/TPansible/roles$ cd ..
ansadmin@svl200:~/TPansible$ ls
TPpostgres hosts.yml main_base.yml psql.yml
dump.yml hosts_vars main_houcem.yml roles
group_vars main.yml main_postgres.yml site.yml
ansadmin@svl200:~/TPansible$ tree
.
├── TPpostgres
│ ├── README.md
│ ├── defaults
│ │ └── main.yml
│ ├── files
│ ├── handlers
│ │ └── main.yml
│ ├── meta
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ ├── tests
│ │ ├── inventory
│ │ └── test.yml
│ └── vars
│ └── main.yml
├── dump.yml
├── group_vars
│ └── all.yml
├── hosts.yml
├── hosts_vars
├── main.yml
├── main_base.yml
├── main_houcem.yml
├── main_postgres.yml
├── psql.yml
├── roles
│ ├── postgres
│ │ ├── handlers
│ │ │ └── main.yml
│ │ ├── tasks
│ │ │ └── main.yml
│ │ ├── templates
│ │ │ └── index.html.j2
│ │ └── vars
│ │ └── main.yml
│ └── users
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── site.yml
22 directories, 25 files
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ cd TPpostgres/
ansadmin@svl200:~/TPansible/TPpostgres$ tree
.
├── README.md
├── defaults
│ └── main.yml
├── files
├── handlers
│ └── main.yml
├── meta
│ └── main.yml
├── tasks
│ └── main.yml
├── templates
├── tests
│ ├── inventory
│ └── test.yml
└── vars
└── main.yml
8 directories, 8 files
ansadmin@svl200:~/TPansible/TPpostgres$ cd ..
ansadmin@svl200:~/TPansible$ ls
TPpostgres hosts.yml main_base.yml psql.yml
dump.yml hosts_vars main_houcem.yml roles
group_vars main.yml main_postgres.yml site.yml
ansadmin@svl200:~/TPansible$ cp main_postgres.yml ./
TPpostgres/ hosts_vars/ main_postgres.yml
dump.yml main.yml psql.yml
group_vars/ main_base.yml roles/
hosts.yml main_houcem.yml site.yml
ansadmin@svl200:~/TPansible$ cp main_postgres.yml ./TPpostgres/
.travis.yml defaults/ handlers/ tasks/ tests/
README.md files/ meta/ templates/ vars/
ansadmin@svl200:~/TPansible$ cp main_postgres.yml ./TPpostgres/tasks/mai
n.yml
ansadmin@svl200:~/TPansible$ cd TPpostgres/
ansadmin@svl200:~/TPansible/TPpostgres$ tree
.
├── README.md
├── defaults
│ └── main.yml
├── files
├── handlers
│ └── main.yml
├── meta
│ └── main.yml
├── tasks
│ └── main.yml
├── templates
├── tests
│ ├── inventory
│ └── test.yml
└── vars
└── main.yml
8 directories, 8 files
ansadmin@svl200:~/TPansible/TPpostgres$ mkdir group_vars
ansadmin@svl200:~/TPansible/TPpostgres$ mkdir hosts_vars
ansadmin@svl200:~/TPansible/TPpostgres$ mkdir group_vars/all.yml
ansadmin@svl200:~/TPansible/TPpostgres$ cd
ansadmin@svl200:~$ ls
TP3 hello.yaml play-vars.yaml template1.yaml
TPansible hello.yml play-vars.yml var_dic.yml
cible1.txt index.html projet var_dic2.yml
copie.yaml index.html.j2 projet1 var_dic_multi3.yml
debug.yaml index.html1.j2 projet2 vars.yml
debug1.yaml ip.txt projet3 vars2.yml
exo2.yaml item_users.yaml projet4 vars_multi.yml
exo3.yaml items.yaml rep.yaml when.yaml
exo4.yaml items_users.yaml seq.yaml when1.yaml
fact.yaml list.yaml shell.yml
fact1.yaml locale.yml snap
handler.yaml nginx.yaml template.yaml
ansadmin@svl200:~$ cd projet4
ansadmin@svl200:~/projet4$ ls
geerlingguy.apache group_vars hosts.yml hosts_vars site.yml
ansadmin@svl200:~/projet4$ sudo vim geerlingguy.apache/
.ansible-lint LICENSE meta/ templates/
.github/ README.md molecule/ vars/
.gitignore defaults/ site.yml
.yamllint handlers/ tasks/
ansadmin@svl200:~/projet4$ sudo vim geerlingguy.apache/tasks/
configure-Debian.yml configure-Suse.yml setup-RedHat.yml
configure-RedHat.yml main.yml setup-Solaris.yml
configure-Solaris.yml setup-Debian.yml setup-Suse.yml
ansadmin@svl200:~/projet4$ sudo vim geerlingguy.apache/tasks/main.yml
ansadmin@svl200:~/projet4$ cd
ansadmin@svl200:~$ cd projet4
ansadmin@svl200:~/projet4$ ls
geerlingguy.apache group_vars hosts.yml hosts_vars site.yml
ansadmin@svl200:~/projet4$ tree
.
├── geerlingguy.apache
│ ├── LICENSE
│ ├── README.md
│ ├── defaults
│ │ └── main.yml
│ ├── handlers
│ │ └── main.yml
│ ├── meta
│ │ └── main.yml
│ ├── molecule
│ │ └── default
│ │ ├── converge.yml
│ │ └── molecule.yml
│ ├── site.yml
│ ├── tasks
│ │ ├── configure-Debian.yml
│ │ ├── configure-RedHat.yml
│ │ ├── configure-Solaris.yml
│ │ ├── configure-Suse.yml
│ │ ├── main.yml
│ │ ├── setup-Debian.yml
│ │ ├── setup-RedHat.yml
│ │ ├── setup-Solaris.yml
│ │ └── setup-Suse.yml
│ ├── templates
│ │ └── vhosts.conf.j2
│ └── vars
│ ├── AmazonLinux.yml
│ ├── Debian.yml
│ ├── RedHat.yml
│ ├── Solaris.yml
│ ├── Suse.yml
│ ├── apache-22.yml
│ └── apache-24.yml
├── group_vars
│ └── all.yml
├── hosts.yml
├── hosts_vars
└── site.yml
11 directories, 28 files
ansadmin@svl200:~/projet4$ cd
ansadmin@svl200:~$ cd
.ansible/ TP3/ projet/ projet2/ projet4/
.ssh/ TPansible/ projet1/ projet3/ snap/
ansadmin@svl200:~$ cd TPansible/
TPpostgres/ group_vars/ hosts_vars/ roles/
ansadmin@svl200:~$ cd TPansible/TPpostgres/
defaults/ group_vars/ hosts_vars/ tasks/ tests/
files/ handlers/ meta/ templates/ vars/
ansadmin@svl200:~$ sudo vim TPansible/TPpostgres/vars/main.yml
ansadmin@svl200:~$ cd TP
TP3/ TPansible/
ansadmin@svl200:~$ cd TPansible/TPpostgres/
ansadmin@svl200:~/TPansible/TPpostgres$ tree
.
├── README.md
├── defaults
│ └── main.yml
├── files
├── group_vars
│ └── all.yml
├── handlers
│ └── main.yml
├── hosts_vars
├── meta
│ └── main.yml
├── tasks
│ └── main.yml
├── templates
├── tests
│ ├── inventory
│ └── test.yml
└── vars
└── main.yml
11 directories, 8 files
ansadmin@svl200:~/TPansible/TPpostgres$ ls
README.md files handlers meta templates vars
defaults group_vars hosts_vars tasks tests
ansadmin@svl200:~/TPansible/TPpostgres$ cd ..
ansadmin@svl200:~/TPansible$ ls
TPpostgres hosts.yml main_base.yml psql.yml
dump.yml hosts_vars main_houcem.yml roles
group_vars main.yml main_postgres.yml site.yml
ansadmin@svl200:~/TPansible$ cd group_vars/
ansadmin@svl200:~/TPansible/group_vars$ ls
all.yml
ansadmin@svl200:~/TPansible/group_vars$ cp all.yml ../TPpostgres/
.travis.yml files/ hosts_vars/ templates/
README.md group_vars/ meta/ tests/
defaults/ handlers/ tasks/ vars/
ansadmin@svl200:~/TPansible/group_vars$ cp all.yml ../TPpostgres/group_v
ars/
cp: cannot overwrite directory '../TPpostgres/group_vars/all.yml' with n
on-directory
ansadmin@svl200:~/TPansible/group_vars$ cp all.yml ../TPpostgres/group_v
ars/all.yml
ansadmin@svl200:~/TPansible/group_vars$
ansadmin@svl200:~/TPansible/group_vars$ cd ..
ansadmin@svl200:~/TPansible$ tree
.
├── TPpostgres
│ ├── README.md
│ ├── defaults
│ │ └── main.yml
│ ├── files
│ ├── group_vars
│ │ └── all.yml
│ │ └── all.yml
│ ├── handlers
│ │ └── main.yml
│ ├── hosts_vars
│ ├── meta
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ ├── tests
│ │ ├── inventory
│ │ └── test.yml
│ └── vars
│ └── main.yml
├── dump.yml
├── group_vars
│ └── all.yml
├── hosts.yml
├── hosts_vars
├── main.yml
├── main_base.yml
├── main_houcem.yml
├── main_postgres.yml
├── psql.yml
├── roles
│ ├── postgres
│ │ ├── handlers
│ │ │ └── main.yml
│ │ ├── tasks
│ │ │ └── main.yml
│ │ ├── templates
│ │ │ └── index.html.j2
│ │ └── vars
│ │ └── main.yml
│ └── users
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── site.yml
25 directories, 26 files
ansadmin@svl200:~/TPansible$ cd TPpostgres/
ansadmin@svl200:~/TPansible/TPpostgres$ ls
README.md files handlers meta templates vars
defaults group_vars hosts_vars tasks tests
ansadmin@svl200:~/TPansible/TPpostgres$ cd ..
ansadmin@svl200:~/TPansible$ ls
TPpostgres hosts.yml main_base.yml psql.yml
dump.yml hosts_vars main_houcem.yml roles
group_vars main.yml main_postgres.yml site.yml
ansadmin@svl200:~/TPansible$ sudo vim site.yml
ansadmin@svl200:~/TPansible$
ansadmin@svl200:~/TPansible$ TPpostgres/
-bash: TPpostgres/: Is a directory
ansadmin@svl200:~/TPansible$ cd TPpostgres/
ansadmin@svl200:~/TPansible/TPpostgres$ tree
.
├── README.md
├── defaults
│ └── main.yml
├── files
├── group_vars
│ └── all.yml
│ └── all.yml
├── handlers
│ └── main.yml
├── hosts_vars
├── meta
│ └── main.yml
├── tasks
│ └── main.yml
├── templates
├── tests
│ ├── inventory
│ └── test.yml
└── vars
└── main.yml
11 directories, 9 files
ansadmin@svl200:~/TPansible/TPpostgres$ ansible-playbook -i hosts.yml site.yml
ERROR! the playbook: site.yml could not be found
ansadmin@svl200:~/TPansible/TPpostgres$ cd ..
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml site.yml
ERROR! conflicting action statements: hosts, gather_facts
11 directories, 9 files
ansadmin@svl200:~/TPansible/TPpostgres$ cd ..
ansadmin@svl200:~/TPansible$ tree
.
├── TPpostgres
│ ├── README.md
│ ├── defaults
│ │ └── main.yml
│ ├── files
│ ├── group_vars
│ │ └── all.yml
│ │ └── all.yml
│ ├── handlers
│ │ └── main.yml
│ ├── hosts_vars
│ ├── meta
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ ├── tests
│ │ ├── inventory
│ │ └── test.yml
│ └── vars
│ └── main.yml
├── dump.yml
├── group_vars
│ └── all.yml
├── hosts.yml
├── hosts_vars
├── main.yml
├── main_base.yml
├── main_houcem.yml
├── main_postgres.yml
├── psql.yml
├── roles
│ ├── postgres
│ │ ├── handlers
│ │ │ └── main.yml
│ │ ├── tasks
│ │ │ └── main.yml
│ │ ├── templates
│ │ │ └── index.html.j2
│ │ └── vars
│ │ └── main.yml
│ └── users
│ ├── handlers
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml
│ ├── templates
│ │ └── index.html.j2
│ └── vars
│ └── main.yml
└── site.yml
25 directories, 26 files
ansadmin@svl200:~/TPansible$ ansible-playbook -i hosts.yml site.yml
ERROR! conflicting action statements: hosts, gather_facts
tasks:
- name: installation postgresql-contrib
apt:
name: postgresql-contrib
state: latest
- name: package_python
apt:
name: python3-psycopg2
state: latest
- name: acl
apt:
name: acl
state: latest
- name: BD
Network error: Software caused connection abort
state: present
─────────────────────────────────────────────────────────────────────────────────────
───────────
become: true
Session stopped: postgres
- Press <return> to exit tab
- Press R to restart session
- Press S to save terminal output to file
ofi03@146.59.156.114's password:
┌──────────────────────────────────────────────────────────────────────┐
│ • MobaXterm Personal Edition v22.0 •
│
│ (SSH client, X server and network tools)
│
│
│
│ → SSH session to ofi03@146.59.156.114
│
│ • Direct SSH : v
│
│ • SSH compression : v
│
│ • SSH-browser : v
│
│ • X11-forwarding : v (remote display is forwarded through
SSH) │
│
│
│ → For more info, ctrl+click on help or visit our website.
│
└──────────────────────────────────────────────────────────────────────┘
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
https://ubuntu.com/blog/microk8s-memory-optimisation
─────────────────────────────────────────────────────────────────────────────────────
───────────
Session stopped
- Press <return> to exit tab
- Press R to restart session
- Press S to save terminal output to file
ofi03@146.59.156.114's password:
┌──────────────────────────────────────────────────────────────────────┐
│ • MobaXterm Personal Edition v22.0 •
│
│ (SSH client, X server and network tools)
│
│
│
│ → SSH session to ofi03@146.59.156.114
│
│ • Direct SSH : v
│
│ • SSH compression : v
│
│ • SSH-browser : v
│
│ • X11-forwarding : v (remote display is forwarded through
SSH) │
│
│
│ → For more info, ctrl+click on help or visit our website.
│
└──────────────────────────────────────────────────────────────────────┘
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
https://ubuntu.com/blog/microk8s-memory-optimisation
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: fichier.html
examine the history and state (see also: git help revisions)
bisect Use binary search to find the commit that
introduced a bug
diff Show changes between commits, commit and
working tree, etc
grep Print lines matching a pattern
log Show commit logs
show Show various types of objects
status Show the working tree status
'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.
See 'git help git' for an overview of the system.
ofi03@svl200:~/projetgit$ git --help -r
error: unknown switch `r'
usage: git help [--all] [--guides] [--man | --web | --info] [<command>]
ofi03@svl200:~/projetgit$
ofi03@svl200:~/projetgit$ git mv rename fichier.html fichier1.html
fatal: destination 'fichier1.html' is not a directory
ofi03@svl200:~/projetgit$ git mv rename fichier.html
fatal: bad source, source=rename, destination=fichier.html
ofi03@svl200:~/projetgit$ git ls-tree -r HEAD
fatal: Not a valid object name HEAD
ofi03@svl200:~/projetgit$ ll
total 12
drwxrwxr-x 3 ofi03 ofi03 4096 Oct 7 08:50 ./
drwxr-xr-x 23 ofi03 ofi03 4096 Oct 7 08:48 ../
drwxrwxr-x 7 ofi03 ofi03 4096 Oct 7 08:56 .git/
-rw-rw-r-- 1 ofi03 ofi03 0 Oct 7 08:50 fichier.html
ofi03@svl200:~/projetgit$ git status
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: fichier.html
Untracked files:
(use "git add <file>..." to include in what will be committed)
.gitignore
ofi03@svl200:~/projetgit$ ll
total 16
drwxrwxr-x 3 ofi03 ofi03 4096 Oct 7 09:08 ./
drwxr-xr-x 23 ofi03 ofi03 4096 Oct 7 08:48 ../
drwxrwxr-x 8 ofi03 ofi03 4096 Oct 7 09:08 .git/
-rw-r--r-- 1 root root 17 Oct 7 09:08 .gitignore
-rw-rw-r-- 1 ofi03 ofi03 0 Oct 7 08:50 fichier.html
-rw-rw-r-- 1 ofi03 ofi03 0 Oct 7 09:06 index.html
-rw-rw-r-- 1 ofi03 ofi03 0 Oct 7 09:06 readme.md
-rw-rw-r-- 1 ofi03 ofi03 0 Oct 7 09:07 tuto.pdf
ofi03@svl200:~/projetgit$ git add .gitignore
ofi03@svl200:~/projetgit$ git status
On branch master
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: .gitignore
new file: index.html
new file: readme.md
new file: tuto.pdf
ajout .gitignore
commit 38d2f37b1b0470a41d74e1d9679dd2d7a4694a7a
Author: aaw <ahmadoudiaaw@gmail.com>
Date: Fri Oct 7 08:58:37 2022 +0000
aaw
ofi03@svl200:~/projetgit$ git log -1 --stat
commit 73cde3eb6d731ca5c67f032bdc18190b4b78ef35 (HEAD -> master)
Author: aaw <ahmadoudiaaw@gmail.com>
Date: Fri Oct 7 09:12:35 2022 +0000
ajout .gitignore
.gitignore | 3 +++
index.html | 0
readme.md | 0
tuto.pdf | 0
4 files changed, 3 insertions(+)
ofi03@svl200:~/projetgit$ git log -1 --oneline
73cde3e (HEAD -> master) ajout .gitignore
ofi03@svl200:~/projetgit$ git log -2 index.html
commit 73cde3eb6d731ca5c67f032bdc18190b4b78ef35 (HEAD -> master)
Author: aaw <ahmadoudiaaw@gmail.com>
Date: Fri Oct 7 09:12:35 2022 +0000
ajout .gitignore
ofi03@svl200:~/projetgit$
ofi03@svl200:~/projetgit$ vim index.html
ofi03@svl200:~/projetgit$ vim index.html
ofi03@svl200:~/projetgit$ git diff
diff --git a/index.html b/index.html
index e69de29..a9a9b37 100644
--- a/index.html
+++ b/index.html
@@ -0,0 +1,3 @@
+<html> aaw </html>
+<html> aaw am </html>
+
ofi03@svl200:~/projetgit$ git add index.html
ofi03@svl200:~/projetgit$ git status
On branch master
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: index.html
─────────────────────────────────────────────────────────────────────────────────────
───────────
Session stopped
- Press <return> to exit tab
- Press R to restart session
- Press S to save terminal output to file