From 8fb0b275bf00c963a24c21e1dfbaa64491c4f445 Mon Sep 17 00:00:00 2001 From: heqnx Date: Sun, 25 May 2025 11:51:57 +0300 Subject: added role-based playbooks --- roles/attackbox/tasks/apt_packages.yaml | 5 +++++ roles/attackbox/tasks/chrome_install.yaml | 24 ++++++++++++++++++++++ roles/attackbox/tasks/github_repos.yaml | 15 ++++++++++++++ roles/attackbox/tasks/go_tools.yaml | 6 ++++++ roles/attackbox/tasks/golang_install.yaml | 33 +++++++++++++++++++++++++++++++ roles/attackbox/tasks/main.yaml | 5 +++++ 6 files changed, 88 insertions(+) create mode 100644 roles/attackbox/tasks/apt_packages.yaml create mode 100644 roles/attackbox/tasks/chrome_install.yaml create mode 100644 roles/attackbox/tasks/github_repos.yaml create mode 100644 roles/attackbox/tasks/go_tools.yaml create mode 100644 roles/attackbox/tasks/golang_install.yaml create mode 100644 roles/attackbox/tasks/main.yaml (limited to 'roles/attackbox/tasks') diff --git a/roles/attackbox/tasks/apt_packages.yaml b/roles/attackbox/tasks/apt_packages.yaml new file mode 100644 index 0000000..4ed8331 --- /dev/null +++ b/roles/attackbox/tasks/apt_packages.yaml @@ -0,0 +1,5 @@ +- name: install apt packages + apt: + name: "{{ apt_packages }}" + state: present + update_cache: yes diff --git a/roles/attackbox/tasks/chrome_install.yaml b/roles/attackbox/tasks/chrome_install.yaml new file mode 100644 index 0000000..4b9bf4f --- /dev/null +++ b/roles/attackbox/tasks/chrome_install.yaml @@ -0,0 +1,24 @@ +- name: remove old google signing key + file: + path: /etc/apt/trusted.gpg.d/google-signing-key.gpg + state: absent + +- name: download and install google signing key + shell: | + curl -sSL https://dl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /etc/apt/trusted.gpg.d/google-signing-key.gpg + +- name: add google chrome repo + copy: + dest: /etc/apt/sources.list.d/google-chrome.list + content: | + deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/google-signing-key.gpg] https://dl.google.com/linux/chrome/deb stable main + +- name: update apt cache + apt: + update_cache: yes + +- name: install google chrome + apt: + name: google-chrome-stable + state: present + diff --git a/roles/attackbox/tasks/github_repos.yaml b/roles/attackbox/tasks/github_repos.yaml new file mode 100644 index 0000000..042ea6c --- /dev/null +++ b/roles/attackbox/tasks/github_repos.yaml @@ -0,0 +1,15 @@ +- name: ensure /opt/tools exists + ansible.builtin.file: + path: /opt/tools + state: directory + owner: root + group: root + mode: '0755' + +- name: clone github repos into /opt/tools + ansible.builtin.git: + repo: "{{ item }}" + dest: "/opt/tools/{{ item | basename | regex_replace('\\.git$', '') }}" + update: yes + force: yes + loop: "{{ github_repos }}" diff --git a/roles/attackbox/tasks/go_tools.yaml b/roles/attackbox/tasks/go_tools.yaml new file mode 100644 index 0000000..18c0346 --- /dev/null +++ b/roles/attackbox/tasks/go_tools.yaml @@ -0,0 +1,6 @@ +- name: install go tools + ansible.builtin.command: + cmd: "/usr/local/go/bin/go install -trimpath -v {{ item }}" + environment: + GOBIN: /usr/local/bin + loop: "{{ go_tools }}" diff --git a/roles/attackbox/tasks/golang_install.yaml b/roles/attackbox/tasks/golang_install.yaml new file mode 100644 index 0000000..e67d508 --- /dev/null +++ b/roles/attackbox/tasks/golang_install.yaml @@ -0,0 +1,33 @@ +- name: download and extract golang + block: + - name: get latest golang version + shell: | + curl -sSL https://golang.org/dl/ | awk -F '"' '/dl\/.*linux-amd64.*tar.gz/{print $(NF-1)}' | awk -F '/' '{print $3}' | head -1 + register: latest_golang + changed_when: false + + - name: download golang + get_url: + url: "https://golang.org/dl/{{ latest_golang.stdout }}" + dest: /tmp/golang.tar.gz + + - name: extract golang to /usr/local + unarchive: + src: /tmp/golang.tar.gz + dest: /usr/local + remote_src: yes + + - name: remove tarball + file: + path: /tmp/golang.tar.gz + state: absent + + - name: set system-wide go environment variables + copy: + dest: /etc/profile.d/go_env.sh + content: | + export GOPATH=/root/go + export PATH=$PATH:/usr/local/go/bin:$GOPATH:$GOPATH/bin + owner: root + group: root + mode: '0644' diff --git a/roles/attackbox/tasks/main.yaml b/roles/attackbox/tasks/main.yaml new file mode 100644 index 0000000..3c498cd --- /dev/null +++ b/roles/attackbox/tasks/main.yaml @@ -0,0 +1,5 @@ +- import_tasks: tasks/apt_packages.yaml +- import_tasks: tasks/golang_install.yaml +- import_tasks: tasks/chrome_install.yaml +- import_tasks: tasks/go_tools.yaml +- import_tasks: tasks/github_repos.yaml -- cgit v1.2.3