From 26aeba85600a2fab3d67249be7f920a080b5add7 Mon Sep 17 00:00:00 2001 From: hygienic-books Date: Mon, 25 Jul 2022 00:01:00 +0200 Subject: [PATCH] feat(role): Delete files and instructions related to venvs, only leave bare bones Miniconda install --- files/_current_user_home_/.condarc | 1 - .../system/update-firewall-source.service | 12 ----- .../update-firewall-source.service.example | 12 ----- .../system/update-firewall-source.timer | 13 ------ .../update-firewall-source.timer.example | 13 ------ .../update-firewall-source/master/config.ini | 27 ----------- tasks/50-setup-miniconda-env.yml | 30 ------------- tasks/55-setup-git-repo.yml | 45 ------------------- tasks/60-install-packages.yml | 21 --------- tasks/main.yml | 17 ------- .../cookiecutter_conda_environment.yml.j2 | 7 --- ...e-firewall-source_conda_environment.yml.j2 | 7 --- 12 files changed, 205 deletions(-) delete mode 100644 files/_current_user_home_/.condarc delete mode 100644 files/etc/systemd/system/update-firewall-source.service delete mode 100644 files/etc/systemd/system/update-firewall-source.service.example delete mode 100644 files/etc/systemd/system/update-firewall-source.timer delete mode 100644 files/etc/systemd/system/update-firewall-source.timer.example delete mode 100644 files/opt/python/update-firewall-source/master/config.ini delete mode 100644 tasks/50-setup-miniconda-env.yml delete mode 100644 tasks/55-setup-git-repo.yml delete mode 100644 tasks/60-install-packages.yml delete mode 100644 templates/_conda_envs_dir_/cookiecutter_conda_environment.yml.j2 delete mode 100644 templates/_conda_envs_dir_/update-firewall-source_conda_environment.yml.j2 diff --git a/files/_current_user_home_/.condarc b/files/_current_user_home_/.condarc deleted file mode 100644 index 14d8073..0000000 --- a/files/_current_user_home_/.condarc +++ /dev/null @@ -1 +0,0 @@ -auto_activate_base: false diff --git a/files/etc/systemd/system/update-firewall-source.service b/files/etc/systemd/system/update-firewall-source.service deleted file mode 100644 index 8688f27..0000000 --- a/files/etc/systemd/system/update-firewall-source.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=firewalld direct rules generator -After=multi-user.target network-online.target - -[Service] -Type=oneshot -RemainAfterExit=no -Environment='PATH=/usr/local/sbin:/usr/local/bin:/usr/bin' 'UFS_LOGLEVEL=INFO' -ExecStart=/opt/miniconda3/envs/update-firewall-source/bin/python /opt/python/update-firewall-source/master/update-firewall-source.py - -[Install] -WantedBy=multi-user.target diff --git a/files/etc/systemd/system/update-firewall-source.service.example b/files/etc/systemd/system/update-firewall-source.service.example deleted file mode 100644 index 8688f27..0000000 --- a/files/etc/systemd/system/update-firewall-source.service.example +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=firewalld direct rules generator -After=multi-user.target network-online.target - -[Service] -Type=oneshot -RemainAfterExit=no -Environment='PATH=/usr/local/sbin:/usr/local/bin:/usr/bin' 'UFS_LOGLEVEL=INFO' -ExecStart=/opt/miniconda3/envs/update-firewall-source/bin/python /opt/python/update-firewall-source/master/update-firewall-source.py - -[Install] -WantedBy=multi-user.target diff --git a/files/etc/systemd/system/update-firewall-source.timer b/files/etc/systemd/system/update-firewall-source.timer deleted file mode 100644 index 8185522..0000000 --- a/files/etc/systemd/system/update-firewall-source.timer +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Run firewalld direct rules generator - -[Timer] -OnCalendar= -OnCalendar=4,5,6:00,15,30,45 Europe/Berlin -OnCalendar=1,10,14,18,22:00 Europe/Berlin -OnBootSec=5min -RandomizedDelaySec=2min -Persistent=true - -[Install] -WantedBy=timers.target diff --git a/files/etc/systemd/system/update-firewall-source.timer.example b/files/etc/systemd/system/update-firewall-source.timer.example deleted file mode 100644 index 76f8f97..0000000 --- a/files/etc/systemd/system/update-firewall-source.timer.example +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Run firewalld direct rules generator - -[Timer] -OnCalendar= -OnCalendar=4,5,6:00,15,30,45 Asia/Shanghai -OnCalendar=1,10,14,18,22:00 Asia/Shanghai -OnBootSec=5min -RandomizedDelaySec=2min -Persistent=true - -[Install] -WantedBy=timers.target diff --git a/files/opt/python/update-firewall-source/master/config.ini b/files/opt/python/update-firewall-source/master/config.ini deleted file mode 100644 index 3e48ef1..0000000 --- a/files/opt/python/update-firewall-source/master/config.ini +++ /dev/null @@ -1,27 +0,0 @@ -[DEFAULT] -target = ACCEPT -addr = -ports = 80, 443 -proto = tcp -state = NEW -do_ipv6 = true -firewalld_direct_file_abs = /etc/firewalld/direct.xml -restart_firewalld_after_change = true - -[home.seneve.de] -addr = home.seneve.de -ports = 22, 80, 443 - -[fornjot.uberspace.de IPv4/6 connectivity testing] -addr = fornjot.uberspace.de -ports = 22, 80, 443 - -[allow-anyone-to-access-mail-services] -ports = 143, 993, 110, 995, 25, 465, 587 - -[deny-all] -target = DROP -addr = -ports = -proto = -state = diff --git a/tasks/50-setup-miniconda-env.yml b/tasks/50-setup-miniconda-env.yml deleted file mode 100644 index 627c50c..0000000 --- a/tasks/50-setup-miniconda-env.yml +++ /dev/null @@ -1,30 +0,0 @@ -- name: 'Set conda env file basename' - set_fact: - conda_env_file_base: '{{ conda_env_file | basename }}' - - - -- name: 'Set conda env file absolute path' - set_fact: - conda_env_file_abs: '{{ miniconda_envs_dir }}/{{ conda_env_file_base | regex_search(''.*?\.yml'', ''\0'') | first }}' - - - -- name: 'Set conda env name' - set_fact: - conda_env_name: '{{ conda_env_file_base | regex_search(''(.*?)(_conda_environment.yml)'', ''\1'') | first }}' - - - -- name: 'Store conda environment.yml file' - ansible.builtin.template: - src: '{{ conda_env_file }}' - dest: '{{ conda_env_file_abs }}' - - - -- name: 'Set up conda env ''{{ conda_env_name }}''' - register: 'rv_conda_env_install' - changed_when: 'not rv_conda_env_install.stderr' - failed_when: 'false' - ansible.builtin.shell: '{{ miniconda_conda_binary }} env create --quiet --file ''{{ conda_env_file_abs }}''' diff --git a/tasks/55-setup-git-repo.yml b/tasks/55-setup-git-repo.yml deleted file mode 100644 index d145dda..0000000 --- a/tasks/55-setup-git-repo.yml +++ /dev/null @@ -1,45 +0,0 @@ -- name: 'Clone Python package Git repo ''{{ git.repo_url }}''' - ansible.builtin.git: - repo: '{{ git.repo_url }}' - dest: '{{ git.path }}/{{ git.branch }}' - - - -- name: 'If Git repo has config: Add config' - when: 'git.config_file' - ansible.builtin.copy: - src: '{{ git.config_file }}' - dest: '/{{ git.config_file }}' - mode: '0644' - - - -- name: 'If Git repo wants systemd: Copy systemd unit file' - when: '(git.systemd.service) and (git.systemd.timer)' - register: 'rv_copy_systemd_unit_files' - loop_control: - loop_var: 'unit' - label: '{{ unit.destination }}' - loop: - - { source: '{{ git.systemd.service }}', destination: '/{{ git.systemd.service }}', mode: '0644' } - - { source: '{{ git.systemd.timer }}', destination: '/{{ git.systemd.timer }}', mode: '0644' } - ansible.builtin.copy: - src: '{{ unit.source }}' - dest: '{{ unit.destination }}' - mode: '{{ unit.mode }}' - - - -- name: 'If systemd copy changed: systemctl daemon-reload' - when: '(rv_copy_systemd_unit_files.changed)' - ansible.builtin.systemd: - daemon_reload: 'yes' - - - -- name: 'If systemd copy succeeded: systemctl enable --now timer unit' - when: '(rv_copy_systemd_unit_files is success)' - ansible.builtin.systemd: - enabled: 'yes' - state: 'started' - name: '{{ git.systemd.timer | basename }}' diff --git a/tasks/60-install-packages.yml b/tasks/60-install-packages.yml deleted file mode 100644 index f087d8e..0000000 --- a/tasks/60-install-packages.yml +++ /dev/null @@ -1,21 +0,0 @@ -- name: 'If venv wants packages: Install packages' - when: 'python_pip_packages' - loop_control: - loop_var: 'pip' - label: 'Into ''{{ pip.env_name }}'' venv install {{ pip.packages }}' - loop: '{{ python_pip_packages }}' - ansible.builtin.pip: - name: '{{ pip.packages }}' - executable: '{{ miniconda_envs_dir }}/{{ pip.env_name }}/bin/pip' - - - -- name: 'If venv wants requirements: Install requirements' - when: 'python_pip_requirements' - loop_control: - loop_var: 'pip' - label: 'Into ''{{ pip.env_name }}'' venv install requirements text file' - loop: '{{ python_pip_requirements }}' - ansible.builtin.pip: - requirements: '{{ pip.requirements }}' - executable: '{{ miniconda_envs_dir }}/{{ pip.env_name }}/bin/pip' diff --git a/tasks/main.yml b/tasks/main.yml index 5bec0c7..a190b0e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,18 +1 @@ - import_tasks: '40-install-miniconda.yml' -- name: 'Set up conda environment' - loop_control: - loop_var: 'conda_env' - label: '{{ conda_env | regex_search(''(.*?)/(.*?)(_conda_environment.yml)'', ''\2'') | first }}' - loop: '{{ lookup(''ansible.builtin.fileglob'', ''{{ role_path }}/templates/{{ conda_envs_template_dir }}/*'', wantlist=True) | map(''regex_search'', conda_envs_template_dir + ''/.*?_conda_environment.yml.j2'') }}' - vars: - conda_env_file: '{{ conda_env }}' - include_tasks: '50-setup-miniconda-env.yml' -- name: 'Set up Git repos' - loop_control: - loop_var: 'git_package' - label: 'From ''{{ git_package.repo_url }}'' clone ''{{ git_package.branch }}'' branch' - loop: '{{ python_git_packages }}' - vars: - git: '{{ git_package }}' - include_tasks: '55-setup-git-repo.yml' -- import_tasks: '60-install-packages.yml' diff --git a/templates/_conda_envs_dir_/cookiecutter_conda_environment.yml.j2 b/templates/_conda_envs_dir_/cookiecutter_conda_environment.yml.j2 deleted file mode 100644 index 1f433fd..0000000 --- a/templates/_conda_envs_dir_/cookiecutter_conda_environment.yml.j2 +++ /dev/null @@ -1,7 +0,0 @@ -name: cookiecutter -channels: - - defaults -dependencies: - - python=3 - - pip -prefix: {{ miniconda_envs_dir }}/cookiecutter diff --git a/templates/_conda_envs_dir_/update-firewall-source_conda_environment.yml.j2 b/templates/_conda_envs_dir_/update-firewall-source_conda_environment.yml.j2 deleted file mode 100644 index bd2cb89..0000000 --- a/templates/_conda_envs_dir_/update-firewall-source_conda_environment.yml.j2 +++ /dev/null @@ -1,7 +0,0 @@ -name: update-firewall-source -channels: - - defaults -dependencies: - - python=3 - - pip -prefix: {{ miniconda_envs_dir }}/update-firewall-source