From 0dfe4a42a3b618e400d32fa6be93685cf74ed358 Mon Sep 17 00:00:00 2001
From: BhEaN <bhean@vandalsweb.com>
Date: Thu, 23 Jul 2020 01:15:13 +0200
Subject: [PATCH] Split playbook

---
 .gitlab-ci.yml       |  3 +--
 ansible/playbook.yml | 30 ------------------------------
 tox.ini              |  2 +-
 3 files changed, 2 insertions(+), 33 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3f4a5a4..b17a34b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -45,7 +45,6 @@ deploy:
   only:
     - master
   script:
-    - pip install jmespath
     # Gitlab-CI issue: SSH key files must be "0600" permissions to work
     - chmod 600 ${ANSIBLE_SSH_PRIV_KEY_PATH}
     - ANSIBLE_ROLES_PATH=roles/ ${ANSIBLE_CMD}
@@ -61,4 +60,4 @@ deploy:
           -p ${VANDALSWEB_BASTION_PORT}
           -W %h:%p
           ${ANSIBLE_SSH_USERNAME}@${VANDALSWEB_BASTION_HOST}'"
-      ansible/playbook.yml
+      ansible/pre-tasks.yml ansible/playbook.yml
diff --git a/ansible/playbook.yml b/ansible/playbook.yml
index 4f89969..82195b3 100644
--- a/ansible/playbook.yml
+++ b/ansible/playbook.yml
@@ -12,36 +12,6 @@
     - "{{ playbook_dir }}/../vars/snmpd.yml"
     - "{{ playbook_dir }}/../vars/minecraft.yml"
 
-  pre_tasks:
-    - name: Installing project requirements
-      delegate_to: localhost
-      run_once: yes
-      pip:
-        requirements: "{{ playbook_dir }}/../requirements.txt"
-        state: present
-        virtualenv: "{{ playbook_dir }}/../venv"
-
-    - name: Installing / upgrading required roles
-      delegate_to: localhost
-      run_once: yes
-      command: "{{ playbook_dir }}/../venv/bin/ansible-galaxy install
-        --force
-        --roles-path {{ playbook_dir }}/../roles/
-        --role-file {{ playbook_dir }}/../requirements-roles.yml"
-      changed_when: false
-
-    - name: Installing roles requirements
-      delegate_to: localhost
-      run_once: yes
-      pip:
-        requirements: "{{ playbook_dir }}/../roles/{{ item }}/requirements.txt"
-        state: present
-        virtualenv: "{{ playbook_dir }}/../venv"
-      loop:
-        - bhean.iptables
-        - bhean.snmpd
-        - bhean.minecraft
-
   tasks:
     - name: Running Iptables role
       include_role:
diff --git a/tox.ini b/tox.ini
index 37f4360..c4cfcb7 100644
--- a/tox.ini
+++ b/tox.ini
@@ -13,4 +13,4 @@ deps = -rrequirements-tests.txt
 
 commands =
     yamllint -c .yamllint .
-    ansible-lint -c .ansible-lint ansible/playbook.yml
+    ansible-lint -c .ansible-lint ansible/pre-tasks.yml ansible/playbook.yml
-- 
GitLab