{"id":17040982,"url":"https://github.com/uggla/ansible_lab","last_synced_at":"2026-05-09T15:34:09.005Z","repository":{"id":148619977,"uuid":"319972382","full_name":"uggla/ansible_lab","owner":"uggla","description":"Lab Ansible","archived":false,"fork":false,"pushed_at":"2020-12-09T14:00:37.000Z","size":1,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-10T19:22:54.715Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uggla.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-09T13:56:04.000Z","updated_at":"2020-12-09T14:00:39.000Z","dependencies_parsed_at":"2023-05-20T17:30:33.417Z","dependency_job_id":null,"html_url":"https://github.com/uggla/ansible_lab","commit_stats":{"total_commits":2,"total_committers":1,"mean_commits":2.0,"dds":0.0,"last_synced_commit":"e16db059be37b49523ec9bde88486bb9bf328064"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/uggla/ansible_lab","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uggla%2Fansible_lab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uggla%2Fansible_lab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uggla%2Fansible_lab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uggla%2Fansible_lab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uggla","download_url":"https://codeload.github.com/uggla/ansible_lab/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uggla%2Fansible_lab/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32824381,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T09:11:02.328Z","updated_at":"2026-05-09T15:34:08.966Z","avatar_url":"https://github.com/uggla.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# WIP\n\n\n# Setup\n\n* 1 x VM target server par utilisateur + formateur  (Centos 8)\n* 1 x VM client pour installation Ansible           (Centos 8)\n\n* Setup AWS --\u003e template terraform\n* Voir pour un setup Katacoda.\n* Voir setup suivi du lab dans un navigateur\n\n## Objectif du lab\n\n* Installer nextcloud (google drive on premice) avec Ansible en automatique\n\n## Durée\n\n* 1h\n* 15mn pause\n* 30 mn\n* 15mn questions\n\n# Lab\n\n## Présentation Ansible\n\n* Présentation du produit etc...\n* Version act\n* Gestion parc machines importante (normalement)\n* Agent less\n* Parallelisation par host\n* Lent\n\n\n* Arbo https://docs.ansible.com/ansible/2.3/playbooks_best_practices.html#content-organization\n    * Inventaire et variables\n    * Playbook\n    * Role\n\n* Module https://docs.ansible.com/ansible/2.8/modules/list_of_all_modules.html\n\n* Astuces https://devdocs.io/ansible~2.9/modules/list_of_files_modules\n\n* Galaxy\n    * Bibliotheque en fonction des clients\n\n\n\n##  Inventaire\n\n1. Installation  (a faire par formateur)\n    a. les manières\n    b. les dependences\n    c. pip\n2. Statique / dynamique (cloud provider) --\u003e statique\n3. Construire inventaire (formateur + chaque utilisateur dans sa home)\n    a. host\n    b. group_vars --\u003e all\n    c. host_vars\n4. Vérification setup\n    a. Check cnx ssh\n    b. Check connection avec Ansible  (ansible -m setup host)\n\n## Playbook hello world\n\n1. Playbook installation package sur target\n\n\n    a. Playbook --\u003e recette de cuisine\n    b. gather_facts --\u003e test cnx\n    c. hosts --\u003e inventaire\n    d. tasks\n    e. module --\u003e voir doc module\n\n```\n---\n- name: Installation apache\n  gather_facts: yes\n  hosts: front\n\n\n  tasks:\n  - name: ensure apache is at the latest version\n    yum:\n      name: httpd\n      state: latest\n```\n\n\n2. Modifier playbook pour utiliser root\n    a. Editer sudoers\n    b. Modifier playbook ajouter:\n    ```\n      become: yes\n      become_user: root\n    ```\n\n3. Montrer idempotence\n    a. relance playbook\n\n\n4. Ajouter node db\n\n```\n---\n- name: Installation apache\n  gather_facts: yes\n  hosts: front\n  become: yes\n  become_user: root\n\n\n  tasks:\n  - name: ensure apache is at the latest version\n    yum:\n      name: httpd\n      state: latest\n\n- name: update db servers\n  hosts: back\n  become: yes\n  become_user: root\n\n  tasks:\n  - name: ensure postgresql is at the latest version\n    yum:\n      name: postgresql\n      state: latest\n```\n\n5. Ajouter le demarrage des services\n\n```\n---\n- name: Installation apache\n  gather_facts: yes\n  hosts: front\n  become: yes\n  become_user: root\n\n\n  tasks:\n  - name: ensure apache is at the latest version\n    yum:\n      name: httpd\n      state: latest\n\n  - name: ensure that postgresql is started\n    service:\n      name: httpd\n      state: started\n\n- name: update db servers\n  hosts: back\n  become: yes\n  become_user: root\n\n  tasks:\n  - name: ensure postgresql is at the latest version\n    yum:\n      name: postgresql\n      state: latest\n\n  - name: ensure that postgresql is started\n    service:\n      name: postgresql\n      state: started\n```\n\n6. Modularisation avec des roles\n\n\n```\n---\n- name: Installation nexcloud\n  gather_facts: yes\n  hosts: front\n  become: yes\n  become_user: root\n\n\n  roles:\n    - role: front\n\n- name: update db servers\n  hosts: back\n  become: yes\n  become_user: root\n\n  roles:\n    - role: back\n```\n\nRole back:\n```\n  - name: ensure postgresql is at the latest version\n    yum:\n      name: postgresql\n      state: latest\n\n  - name: ensure that postgresql is started\n    service:\n      name: postgresql\n      state: started\n\n```\n\n* Creation db + users\n* Loop (création users)\n* Templating conf\n* Module vs shell\n* cli nextcloud --\u003e users  --\u003e loop\n* when\n* debug\n* register --\u003e unique et list\n* pattern debug (ignore errors + debug + fail)\n* mode diff\n* vault et secret\n* cowsay (ultra bonus)\n* vars --\u003e en fn inventaire --\u003e unicité de l'info.\n* Récuperation de log (exploit)\n* jinja (lb)\n* set_fact\n* variables prio et portée\n* serial\n* molecule  --\u003e test (TU) + infra as code (donc bonne pratique de code) + on manipe plus à la main sur les machines\n\n\n\n\nRole front\n\n```\n  - name: ensure apache is at the latest version\n    yum:\n      name: httpd\n      state: latest\n\n  - name: ensure that postgresql is started\n    service:\n      name: httpd\n      state: started\n\nphp + dep\ninstallation depuis un tar de nextcloud\n\n```\n\n\n\n8. Ajouter un role de sanity checks (Tests)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuggla%2Fansible_lab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuggla%2Fansible_lab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuggla%2Fansible_lab/lists"}