diff options
| author | jerome <jerome@xlinfo.fr> | 2025-02-12 15:05:59 +0100 |
|---|---|---|
| committer | jerome <jerome@xlinfo.fr> | 2025-02-12 15:05:59 +0100 |
| commit | 3605d4eec0065530f692cb3e779e9ab50a0ca3e3 (patch) | |
| tree | e20e657391c18d44af5d03f864a4c3db05b81690 | |
| parent | 9041e48cd9b37e2bb39328ec21088ab48658f0f7 (diff) | |
| download | kvm-3605d4eec0065530f692cb3e779e9ab50a0ca3e3.tar.gz kvm-3605d4eec0065530f692cb3e779e9ab50a0ca3e3.zip | |
correction
| -rw-r--r-- | playbooks/files/default.conf | 8 | ||||
| -rw-r--r-- | playbooks/hosts | 3 | ||||
| -rw-r--r-- | playbooks/lamp.yml | 3 | ||||
| -rw-r--r-- | playbooks/lamp/.travis.yml | 29 | ||||
| -rw-r--r-- | playbooks/lamp/README.md | 38 | ||||
| -rw-r--r-- | playbooks/lamp/defaults/main.yml | 2 | ||||
| -rw-r--r-- | playbooks/lamp/handlers/main.yml | 7 | ||||
| -rw-r--r-- | playbooks/lamp/meta/main.yml | 53 | ||||
| -rw-r--r-- | playbooks/lamp/tasks/Debian-phpmyadmin.yml | 23 | ||||
| -rw-r--r-- | playbooks/lamp/tasks/RedHat-phpmyadmin.yml | 23 | ||||
| -rw-r--r-- | playbooks/lamp/tasks/clean.yml | 15 | ||||
| -rw-r--r-- | playbooks/lamp/tasks/main.yml | 60 | ||||
| -rw-r--r-- | playbooks/lamp/tasks/test.yml | 19 | ||||
| -rw-r--r-- | playbooks/lamp/templates/index.j2 | 20 | ||||
| -rw-r--r-- | playbooks/lamp/tests/inventory | 2 | ||||
| -rw-r--r-- | playbooks/lamp/tests/test.yml | 5 | ||||
| -rw-r--r-- | playbooks/lamp/vars/Debian.yml | 14 | ||||
| -rw-r--r-- | playbooks/lamp/vars/RedHat.yml | 14 | ||||
| -rw-r--r-- | playbooks/lamp/vars/main.yml | 2 | ||||
| -rw-r--r-- | playbooks/lxc.yml | 72 | ||||
| -rwxr-xr-x | script_local | 7 |
21 files changed, 0 insertions, 419 deletions
diff --git a/playbooks/files/default.conf b/playbooks/files/default.conf deleted file mode 100644 index bc5449b..0000000 --- a/playbooks/files/default.conf +++ /dev/null @@ -1,8 +0,0 @@ -lxc.net.0.type = veth -lxc.net.0.link = lxcbr0 -lxc.net.0.flags = up -lxc.net.0.hwaddr = xx:xx:xx:xx:xx:xx - -lxc.apparmor.profile = generated -lxc.apparmor.allow_nesting = 1 -lxc.start.auto = 1 diff --git a/playbooks/hosts b/playbooks/hosts deleted file mode 100644 index be027e9..0000000 --- a/playbooks/hosts +++ /dev/null @@ -1,3 +0,0 @@ -[containers] -10.0.3.236 -10.0.3.136
\ No newline at end of file diff --git a/playbooks/lamp.yml b/playbooks/lamp.yml deleted file mode 100644 index bbfb572..0000000 --- a/playbooks/lamp.yml +++ /dev/null @@ -1,3 +0,0 @@ -- hosts: all - roles: - - lamp diff --git a/playbooks/lamp/.travis.yml b/playbooks/lamp/.travis.yml deleted file mode 100644 index 36bbf62..0000000 --- a/playbooks/lamp/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -language: python -python: "2.7" - -# Use the new container infrastructure -sudo: false - -# Install ansible -addons: - apt: - packages: - - python-pip - -install: - # Install ansible - - pip install ansible - - # Check ansible version - - ansible --version - - # Create ansible.cfg with correct roles_path - - printf '[defaults]\nroles_path=../' >ansible.cfg - -script: - # Basic role syntax check - - ansible-playbook tests/test.yml -i tests/inventory --syntax-check - -notifications: - webhooks: https://galaxy.ansible.com/api/v1/notifications/
\ No newline at end of file diff --git a/playbooks/lamp/README.md b/playbooks/lamp/README.md deleted file mode 100644 index 225dd44..0000000 --- a/playbooks/lamp/README.md +++ /dev/null @@ -1,38 +0,0 @@ -Role Name -========= - -A brief description of the role goes here. - -Requirements ------------- - -Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. - -Role Variables --------------- - -A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. - -Dependencies ------------- - -A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. - -Example Playbook ----------------- - -Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: - - - hosts: servers - roles: - - { role: username.rolename, x: 42 } - -License -------- - -BSD - -Author Information ------------------- - -An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/playbooks/lamp/defaults/main.yml b/playbooks/lamp/defaults/main.yml deleted file mode 100644 index 56675e7..0000000 --- a/playbooks/lamp/defaults/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# vars file for lamp diff --git a/playbooks/lamp/handlers/main.yml b/playbooks/lamp/handlers/main.yml deleted file mode 100644 index b583d01..0000000 --- a/playbooks/lamp/handlers/main.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# handlers file for lamp -- name: restarting_apache - service: - name: '{{apache.service}}' - state: restarted - diff --git a/playbooks/lamp/meta/main.yml b/playbooks/lamp/meta/main.yml deleted file mode 100644 index 227ad9c..0000000 --- a/playbooks/lamp/meta/main.yml +++ /dev/null @@ -1,53 +0,0 @@ -galaxy_info: - author: your name - description: your role description - company: your company (optional) - - # If the issue tracker for your role is not on github, uncomment the - # next line and provide a value - # issue_tracker_url: http://example.com/issue/tracker - - # Choose a valid license ID from https://spdx.org - some suggested licenses: - # - BSD-3-Clause (default) - # - MIT - # - GPL-2.0-or-later - # - GPL-3.0-only - # - Apache-2.0 - # - CC-BY-4.0 - license: license (GPL-2.0-or-later, MIT, etc) - - min_ansible_version: 2.9 - - # If this a Container Enabled role, provide the minimum Ansible Container version. - # min_ansible_container_version: - - # - # Provide a list of supported platforms, and for each platform a list of versions. - # If you don't wish to enumerate all versions for a particular platform, use 'all'. - # To view available platforms and versions (or releases), visit: - # https://galaxy.ansible.com/api/v1/platforms/ - # - # platforms: - # - name: Fedora - # versions: - # - all - # - 25 - # - name: SomePlatform - # versions: - # - all - # - 1.0 - # - 7 - # - 99.99 - - galaxy_tags: [] - # List tags for your role here, one per line. A tag is a keyword that describes - # and categorizes the role. Users find roles by searching for tags. Be sure to - # remove the '[]' above, if you add tags to this list. - # - # NOTE: A tag is limited to a single word comprised of alphanumeric characters. - # Maximum 20 tags per role. - -dependencies: [] - # List your role dependencies here, one per line. Be sure to remove the '[]' above, - # if you add dependencies to this list. -
\ No newline at end of file diff --git a/playbooks/lamp/tasks/Debian-phpmyadmin.yml b/playbooks/lamp/tasks/Debian-phpmyadmin.yml deleted file mode 100644 index 8bfb478..0000000 --- a/playbooks/lamp/tasks/Debian-phpmyadmin.yml +++ /dev/null @@ -1,23 +0,0 @@ ---- -- name: configuration debconf - block: - - debconf: - name: phpmyadmin - question: 'phpmyadmin/reconfigure-webserver' - value: 'apache2' - vtype: select - - debconf: - name: phpmyadmin - question: 'phpmyadmin/mysql/admin-pass' - value: '(password omitted)' - vtype: string - - debconf: - name: phpmyadmin - question: 'phpmyadmin/dbconfig-install' - value : 'true' - vtype: boolean - -- name: installation phpmyadmin - package: - name: phpmyadmin - state: present diff --git a/playbooks/lamp/tasks/RedHat-phpmyadmin.yml b/playbooks/lamp/tasks/RedHat-phpmyadmin.yml deleted file mode 100644 index 569ddd2..0000000 --- a/playbooks/lamp/tasks/RedHat-phpmyadmin.yml +++ /dev/null @@ -1,23 +0,0 @@ ---- -- name: installation epel-release - package: - name: epel-release - state: present - -- name: installation phpmyadmin - package: - name: phpmyadmin - state: present - -- name: phpmyadmin.conf - replace: - path: /etc/httpd/conf.d/phpMyAdmin.conf - regexp: "Require local" - replace: "Require all granted" - after: "<Directory /usr/share/phpMyAdmin/>" - before: "</Directory>" - notify: restarting_apache - -- name: database - shell: mysql < /usr/share/phpMyAdmin/sql/create_tables.sql - diff --git a/playbooks/lamp/tasks/clean.yml b/playbooks/lamp/tasks/clean.yml deleted file mode 100644 index 7e3571e..0000000 --- a/playbooks/lamp/tasks/clean.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -- name: supprimer la base de données test - community.mysql.mysql_db: - name: toto - state: absent - login_unix_socket: '{{mariadb.socket}}' - -- name: supprimer l'utilisateur test - community.mysql.mysql_user: - name: toto - password: secret - priv: 'toto.*:ALL' - state: absent - login_unix_socket: '{{mariadb.socket}}' - diff --git a/playbooks/lamp/tasks/main.yml b/playbooks/lamp/tasks/main.yml deleted file mode 100644 index 11e0600..0000000 --- a/playbooks/lamp/tasks/main.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -# tasks file for lamp -- include_vars: '{{ansible_os_family}}.yml' - tags: - - test - - clean - -- name: installation de lamp - package: - update_cache: true - name: "{{item}}" - state: present - with_items: '{{lamp_packages}}' - -- name: activation des services sur Redhat - service: - state: started - name: '{{item}}' - with_items: - - httpd - - mariadb - when: ansible_os_family == 'RedHat' - -- name : activation du mod_rewrite d'apache sur Debian - apache2_module: - state: present - name: rewrite - when: ansible_os_family == 'Debian' - notify: - - restarting_apache - -- name: mise en place de index.html - template: - src: templates/index.j2 - dest: /var/www/html/index.html - owner: "{{apache.user}}" - group: "{{apache.user}}" - mode: 0644 - -- name: installation de phpmyadmin - vars: - - apache: '{{apache}}' - include_tasks: - file: '{{ansible_os_family}}-phpmyadmin.yml' - apply: - tags: phpmyadmin - tags: phpmyadmin - -- name: test user - import_tasks: test.yml - tags: - - never - - test - -- name: clean user - import_tasks: clean.yml - tags: - - never - - clean - diff --git a/playbooks/lamp/tasks/test.yml b/playbooks/lamp/tasks/test.yml deleted file mode 100644 index c3d9c32..0000000 --- a/playbooks/lamp/tasks/test.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -- name: install dépendances python - package: - name: '{{ mariadb.pythonlib }}' - state: present - -- name: Créer la base de données test - community.mysql.mysql_db: - name: toto - state: present - login_unix_socket: '{{mariadb.socket}}' - -- name: Créer un utilisateur test - community.mysql.mysql_user: - name: toto - password: secret - priv: 'toto.*:ALL' - state: present - login_unix_socket: '{{mariadb.socket}}' diff --git a/playbooks/lamp/templates/index.j2 b/playbooks/lamp/templates/index.j2 deleted file mode 100644 index 29619c2..0000000 --- a/playbooks/lamp/templates/index.j2 +++ /dev/null @@ -1,20 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<title>{{ansible_distribution}} Apache Web Server</title> -<meta charset="utf-8" /> -</head> -<body> -<h1>{{ansible_distribution}} Apache Web Server</h1> -<h2>Site en Constuction</h2> -{% if lamp_packages is defined %} -<h3>Packages :</h3> -<ul> -{% for item in lamp_packages %} -<li>{{item}}</li> -{% endfor %} -</ul> -{% endif %} -<p>Généré par {{ ansible_distribution }} {{ ansible_distribution_version }}</p> -</body> -</html> diff --git a/playbooks/lamp/tests/inventory b/playbooks/lamp/tests/inventory deleted file mode 100644 index 878877b..0000000 --- a/playbooks/lamp/tests/inventory +++ /dev/null @@ -1,2 +0,0 @@ -localhost - diff --git a/playbooks/lamp/tests/test.yml b/playbooks/lamp/tests/test.yml deleted file mode 100644 index 10107f3..0000000 --- a/playbooks/lamp/tests/test.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- hosts: localhost - remote_user: root - roles: - - lamp
\ No newline at end of file diff --git a/playbooks/lamp/vars/Debian.yml b/playbooks/lamp/vars/Debian.yml deleted file mode 100644 index 1c7659f..0000000 --- a/playbooks/lamp/vars/Debian.yml +++ /dev/null @@ -1,14 +0,0 @@ -lamp_packages: - - apache2 - - mariadb-server - - php - - php-mysql - -apache: - service: apache2 - user: www-data - -mariadb: - socket: /var/run/mysqld/mysqld.sock - pythonlib: python3-pymysql - diff --git a/playbooks/lamp/vars/RedHat.yml b/playbooks/lamp/vars/RedHat.yml deleted file mode 100644 index b8033ee..0000000 --- a/playbooks/lamp/vars/RedHat.yml +++ /dev/null @@ -1,14 +0,0 @@ -lamp_packages: - - httpd - - mariadb-server - - php - - php-mysqlnd - -apache: - service: httpd - user: apache - -mariadb: - socket: /var/lib/mysql/mysql.sock - pythonlib: python3-PyMySQL - diff --git a/playbooks/lamp/vars/main.yml b/playbooks/lamp/vars/main.yml deleted file mode 100644 index 56675e7..0000000 --- a/playbooks/lamp/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# vars file for lamp diff --git a/playbooks/lxc.yml b/playbooks/lxc.yml deleted file mode 100644 index 3fb1b18..0000000 --- a/playbooks/lxc.yml +++ /dev/null @@ -1,72 +0,0 @@ ---- -- hosts: all - tasks: - - name: install lxc - package: - name: '{{item}}' - state: present - update_cache: yes - with_items: - - lxc - - python3-lxc - - - name: Configuration de lxc - copy: - src: default.conf - dest: /etc/lxc/default.conf - - - name: Creation d'un container rocky - community.general.lxc_container: - name: rocky-lxc - template: download - template_options: --dist rockylinux --release 9 --arch amd64 - state: started - container_command: | - sleep 5 - dnf install -y openssh-server python3 - systemctl enable --now sshd - - - - name: Creation d'un container debian - community.general.lxc_container: - name: debian-lxc - template: download - template_options: --dist debian --release bookworm --arch amd64 - state: started - container_command: | - sleep 5 - apt install -y openssh-server python3 - systemctl enable --now ssh - - - name: copie des clefs ssh - copy: - src: "~/.ssh/id_rsa.pub" - dest: "{{item}}" - mode: "0600" - with_items: - - /var/lib/lxc/debian-lxc/rootfs/root/.ssh/authorized_keys - - /var/lib/lxc/rocky-lxc/rootfs/root/.ssh/authorized_keys - - - name: recuperation ip rocky - shell: "lxc-info -iH rocky-lxc" - register: ip_rocky - - - name: recuperation ip debian - shell: "lxc-info -iH debian-lxc" - register: ip_debian - - - name: ssh-keyscan ip debian - remote_user: "jerome" - become: no - local_action: shell ssh-keyscan -H {{ip_debian.stdout}} >> ~/.ssh/known_hosts - - - name: ssh-keyscan ip rocky - remote_user: "jerome" - become: no - local_action: shell ssh-keyscan -H {{ip_rocky.stdout}} >> ~/.ssh/known_hosts - - - name: inventaire - remote_user: "jerome" - become: no - local_action: copy content="[containers]\n{{ip_rocky.stdout}}\n{{ip_debian.stdout}}" dest="hosts" - diff --git a/script_local b/script_local index cfe5d09..422f322 100755 --- a/script_local +++ b/script_local @@ -1,13 +1,6 @@ #!/bin/bash ssh-keygen -f ~/.ssh/known_hosts -R $1 ssh-keyscan -H $1 >> ~/.ssh/known_hosts -# nécessite droits sudo sans mot de passe pour ip à l'utilisateur local -sudo ip route del 10.0.3.0/24 -sudo ip route add 10.0.3.0/24 via $1 -ansible-playbook -u ansible --become -i "$1," playbooks/lxc.yml -# remplacé par les local_actions dans le playbook lxc.yml -#ssh-keyscan -H -f playbooks/hosts >> ~/.ssh/known_hosts -ansible-playbook -u root -i playbooks/hosts playbooks/lamp.yml |
