From 395b67257438e5c7737bb1e8b9dd052fcc92db12 Mon Sep 17 00:00:00 2001 From: Cyrille Nofficial Date: Wed, 2 Nov 2022 12:20:23 +0100 Subject: [PATCH] clean(ansible): remove unused roles and hosts --- .../group_vars/all/rabbitmq_credentials.yaml | 2 - ansible/hosts | 4 -- ansible/roles/docker/tasks/docker.yml | 35 ----------- ansible/roles/docker/tasks/main.yml | 4 -- ansible/roles/donkey/defaults/main.yml | 13 ---- ansible/roles/donkey/tasks/data.yml | 16 ----- ansible/roles/donkey/tasks/main.yml | 62 ------------------- ansible/roles/donkey/templates/bash_custom | 2 - ansible/roles/python/defaults/main.yml | 4 -- ansible/roles/python/tasks/main.yml | 52 ---------------- ansible/roles/rabbitmq/handlers/main.yml | 11 ---- ansible/roles/rabbitmq/tasks/main.yml | 35 ----------- ansible/site.yml | 8 --- 13 files changed, 248 deletions(-) delete mode 100644 ansible/group_vars/all/rabbitmq_credentials.yaml delete mode 100644 ansible/roles/docker/tasks/docker.yml delete mode 100644 ansible/roles/docker/tasks/main.yml delete mode 100644 ansible/roles/donkey/defaults/main.yml delete mode 100644 ansible/roles/donkey/tasks/data.yml delete mode 100644 ansible/roles/donkey/tasks/main.yml delete mode 100644 ansible/roles/donkey/templates/bash_custom delete mode 100644 ansible/roles/python/defaults/main.yml delete mode 100644 ansible/roles/python/tasks/main.yml delete mode 100644 ansible/roles/rabbitmq/handlers/main.yml delete mode 100644 ansible/roles/rabbitmq/tasks/main.yml diff --git a/ansible/group_vars/all/rabbitmq_credentials.yaml b/ansible/group_vars/all/rabbitmq_credentials.yaml deleted file mode 100644 index 5e96735..0000000 --- a/ansible/group_vars/all/rabbitmq_credentials.yaml +++ /dev/null @@ -1,2 +0,0 @@ -rabbitmq_user: satanas -rabbitmq_password: satanas diff --git a/ansible/hosts b/ansible/hosts index 0112a4e..1ddab4f 100644 --- a/ansible/hosts +++ b/ansible/hosts @@ -1,9 +1,5 @@ [car] -satanas.local ansible_user=pi become=yes become_user=root diabolo.local ansible_user=pi become=yes become_user=root [microservice] diabolo.local - -[donkey] -satanas.local diff --git a/ansible/roles/docker/tasks/docker.yml b/ansible/roles/docker/tasks/docker.yml deleted file mode 100644 index 2d8ce6c..0000000 --- a/ansible/roles/docker/tasks/docker.yml +++ /dev/null @@ -1,35 +0,0 @@ -- name: Add apt key - apt_key: - url: https://download.docker.com/linux/debian/gpg - -- name: Add docker-ce repository - apt_repository: - repo: deb [arch={{ arch | default('armhf') }}] https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable - state: present - filename: 'docker' - - -- meta: flush_handlers - -- name: Install docker-ce - apt: - name: - - python3-pip - - docker-ce - - xfsprogs - state: present - -- name: Set groups to pi user - user: - name: pi - groups: docker - -- meta: flush_handlers -- name: Install ansible tool docker and docker-compose - pip: - name: - - docker-compose - executable: pip3 - - - diff --git a/ansible/roles/docker/tasks/main.yml b/ansible/roles/docker/tasks/main.yml deleted file mode 100644 index 4fc2686..0000000 --- a/ansible/roles/docker/tasks/main.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- - -- include_tasks: docker.yml - diff --git a/ansible/roles/donkey/defaults/main.yml b/ansible/roles/donkey/defaults/main.yml deleted file mode 100644 index a00ce51..0000000 --- a/ansible/roles/donkey/defaults/main.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- - -donkey_username: pi -donkey_groupname: pi -donkey_home_dir: /home/{{ donkey_username }} - -donkey_git_repo: https://github.com/cyrilix/donkey.git -donkey_git_branch: master - -donkey_sources: "{{ donkey_home_dir }}/donkeycar" -donkey_virtualenv_dir: "{{ donkey_home_dir }}/venv" - -donkey_data_dir: "{{ donkey_home_dir }}/data" diff --git a/ansible/roles/donkey/tasks/data.yml b/ansible/roles/donkey/tasks/data.yml deleted file mode 100644 index 795e43f..0000000 --- a/ansible/roles/donkey/tasks/data.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- - -- name: Make data directory - file: - path: "{{ donkey_data_dir }}" - owner: "{{ donkey_username }}" - group: "{{ donkey_groupname }}" - state: directory - -- name: Make tmpfs - mount: - path: "{{ donkey_data_dir }}" - src: tmpfs - fstype: tmpfs - opts: defaults - state: mounted diff --git a/ansible/roles/donkey/tasks/main.yml b/ansible/roles/donkey/tasks/main.yml deleted file mode 100644 index 4e18aa3..0000000 --- a/ansible/roles/donkey/tasks/main.yml +++ /dev/null @@ -1,62 +0,0 @@ ---- - -- include_tasks: data.yml - -- name: Install dependencies - apt: - name: - - python3-setuptools-git - - virtualenv - - libopenjp2-7 - - libtiff5 - - libblas3 - - liblapack3 - - libatlas3-base - - libjpeg-dev - - libilmbase12 - - libopenexr22 - - libgstreamer1.0-0 - - libavcodec57 - - libavformat57 - - libswscale4 - - libgtk-3-0 - - i2c-tools - - read-edid - - libsdl1.2debian - - libjasper1 - - libqtgui4 - - libqt4-test - - python-h5py - state: present - -- name: Fetch git repository - become_user: "{{ donkey_username }}" - git: - repo: "{{ donkey_git_repo }}" - dest: "{{ donkey_sources }}" - version: "{{ donkey_git_branch }}" - ssh_opts: "-o StrictHostKeyChecking=no" - -- name: Install donkey - become_user: "{{ donkey_username }}" - pip: - name: "{{ donkey_sources }}" - virtualenv_python: python3 - virtualenv: "{{ donkey_virtualenv_dir }}" - editable: yes - - -#- name: Install dependencies -# become_user: "{{ donkey_username }}" -# pip: -# requirements: "{{ donkey_sources }}/requirements-pi.txt" -# virtualenv: "{{ donkey_virtualenv_dir }}" -# virtualenv_python: python3 - -- name: Load virtualenv at connection - template: - src: bash_custom - dest: "{{ donkey_home_dir }}/.bash_custom" - owner: "{{ donkey_username }}" - group: "{{ donkey_groupname }}" - mode: 0644 diff --git a/ansible/roles/donkey/templates/bash_custom b/ansible/roles/donkey/templates/bash_custom deleted file mode 100644 index 5b3f1d8..0000000 --- a/ansible/roles/donkey/templates/bash_custom +++ /dev/null @@ -1,2 +0,0 @@ -# Activate virtualenv -source {{ donkey_virtualenv_dir }}/bin/activate diff --git a/ansible/roles/python/defaults/main.yml b/ansible/roles/python/defaults/main.yml deleted file mode 100644 index f6f30d5..0000000 --- a/ansible/roles/python/defaults/main.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- - -version: 3.6.6 -threads: 4 diff --git a/ansible/roles/python/tasks/main.yml b/ansible/roles/python/tasks/main.yml deleted file mode 100644 index dbddefc..0000000 --- a/ansible/roles/python/tasks/main.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- - -- name: "Install python {{version}} runtime & build dependencies" - become: yes - apt: name={{item}} - with_items: - - build-essential - - tk-dev - - libncurses5-dev - - libncursesw5-dev - - libreadline6-dev - - libdb5.3-dev - - libgdbm-dev - - libsqlite3-dev - - libssl-dev - - libbz2-dev - - libexpat1-dev - - liblzma-dev - - libffi-dev - - uuid-dev - - zlib1g-dev - -- name: "Download python{{version}}" - get_url: - url: "https://www.python.org/ftp/python/{{version}}/Python-{{version}}.tar.xz" - dest: "/tmp/Python-{{version}}.tar.xz" - -- name: "Unarchive python{{version}}" - unarchive: - src: "/tmp/Python-{{version}}.tar.xz" - dest: "/tmp/" - copy: no - creates: "/tmp/Python-{{version}}" - -- name: "configure python{{version}} build" - command: ./configure --prefix=/opt/python-{{version}} --enable-optimizations - args: - chdir: "/tmp/Python-{{version}}" - creates: "/tmp/Python-{{version}}/Makefile" - -- name: "build python{{version}}" - # not using make module to be able to use -j and creates option to fully skip step - command: make -j{{threads}} - args: - chdir: "/tmp/Python-{{version}}" - creates: "/tmp/Python-{{version}}/python" - -- name: "install python{{version}}" - become: yes - make: - chdir: "/tmp/Python-{{version}}" - target: altinstall diff --git a/ansible/roles/rabbitmq/handlers/main.yml b/ansible/roles/rabbitmq/handlers/main.yml deleted file mode 100644 index 26c0ea3..0000000 --- a/ansible/roles/rabbitmq/handlers/main.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -- name: expand filesystem - shell: resize2fs /dev/mmcblk0p2 - notify: - - reboot - -- name: restart rabbitmq - service: - name: rabbitmq-server - start: restarted - diff --git a/ansible/roles/rabbitmq/tasks/main.yml b/ansible/roles/rabbitmq/tasks/main.yml deleted file mode 100644 index f0f9cb1..0000000 --- a/ansible/roles/rabbitmq/tasks/main.yml +++ /dev/null @@ -1,35 +0,0 @@ ---- -- name: Install ansible dependencies - apt: - name: "python3-requests" - state: present - -- name: Install rabbitmq package - apt: - name: rabbitmq-server - state: present - with_items: - - rabbitmq-server - - python3-requests - -- name: Enables rabbitmq plugins - rabbitmq_plugin: - names: rabbitmq_management,rabbitmq_mqtt - state: enabled - -- name: Add rabbitmq user - rabbitmq_user: - user: "{{ rabbitmq_user }}" - password: "{{ rabbitmq_password }}" - vhost: / - configure_priv: .* - read_priv: .* - write_priv: .* - tags: administrator - state: present - -- name: Create exchange - rabbitmq_exchange: - name: car - type: topic - vhost: "/" diff --git a/ansible/site.yml b/ansible/site.yml index 6ba0463..179abb6 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -8,13 +8,5 @@ - hosts: microservice become: yes roles: - - { role: rabbitmq, tags: [rabbitmq] } - { role: k3s, tags: [k3s] } - { role: microservices, tags: [microservices, ms] } - - -- hosts: donkey - become: yes - roles: - - { role: python, tags: [python]} - - { role: donkey, tags: [donkey] }