From a2816a152e12b7aba913babab96c65acb3db7dc4 Mon Sep 17 00:00:00 2001 From: Tobias Hachmer Date: Mon, 11 Sep 2017 12:48:16 +0200 Subject: [PATCH] Add role git-repos --- playbooks/gateways.yml | 1 + roles/git-repos/README.md | 18 ++++++++++++++++++ roles/git-repos/tasks/main.yml | 23 +++++++++++++++++++++++ roles/git-repos/vars/main.yml | 8 ++++++++ 4 files changed, 50 insertions(+) create mode 100644 roles/git-repos/README.md create mode 100644 roles/git-repos/tasks/main.yml create mode 100644 roles/git-repos/vars/main.yml diff --git a/playbooks/gateways.yml b/playbooks/gateways.yml index d22c61f..9fd38ed 100755 --- a/playbooks/gateways.yml +++ b/playbooks/gateways.yml @@ -6,6 +6,7 @@ - prerequisites - server-repos - server-basic + - git-repos - service-haveged - service-ntpd - kmod-batman diff --git a/roles/git-repos/README.md b/roles/git-repos/README.md new file mode 100644 index 0000000..51f5acb --- /dev/null +++ b/roles/git-repos/README.md @@ -0,0 +1,18 @@ +# Ansible role git-repos + +Diese Ansible role klont wichtige git Repositories. + +- installiert git +- legt /home/admin/clones an +- klont alle git Repositories aus dem Dictionary `common_repos` + +## Benötigte Variablen + +- Dictionary `common_repos` # role variable +``` +common_repos: + name: # name des Repositories == Ordner Name + repo_url: # HTTP-URL zum Repository +... + +``` diff --git a/roles/git-repos/tasks/main.yml b/roles/git-repos/tasks/main.yml new file mode 100644 index 0000000..46d5c33 --- /dev/null +++ b/roles/git-repos/tasks/main.yml @@ -0,0 +1,23 @@ +--- +- name: install git packages + apt: + name: "{{ item }}" + state: present + with_items: + - git + become: true + +- name: ensure git directory is present + file: + path: /home/admin/clones + state: directory + mode: 0755 + owner: admin + group: admin + become: true + +- name: clone git repositories + git: + repo: "{{ item.value.repo_url }}" + dest: "/home/admin/clones/{{ item.key }}" + with_dict: "{{ common_repos }}" diff --git a/roles/git-repos/vars/main.yml b/roles/git-repos/vars/main.yml new file mode 100644 index 0000000..572463e --- /dev/null +++ b/roles/git-repos/vars/main.yml @@ -0,0 +1,8 @@ +--- +common_repos: + backend-scripts: + repo_url: https://github.com/freifunk-mwu/backend-scripts.git + icvpn-meta: + repo_url: https://github.com/freifunk/icvpn-meta.git + icvpn-scripts: + repo_url: https://github.com/freifunk/icvpn-scripts.git