Initial commit

This commit is contained in:
nd 2019-04-09 18:23:19 +02:00
commit a50bd9c88e
No known key found for this signature in database
GPG key ID: 21B5CD4DEE3670E9
3 changed files with 51 additions and 0 deletions

1
defaults/main.yml Normal file
View file

@ -0,0 +1 @@
git: {}

20
tasks/main.yml Normal file
View file

@ -0,0 +1,20 @@
- name: install git
apt:
pkg: git
- debug: var=git
- name: include repositories (with updates)
include_tasks:
file: repo.yml
apply:
tags:
- update
when: item.value.update|d(true)
with_dict: "{{ git }}"
- name: include repositories (without updates)
include_tasks:
file: repo.yml
when: not item.value.update|d(true)
with_dict: "{{ git }}"

30
tasks/repo.yml Normal file
View file

@ -0,0 +1,30 @@
- set_fact:
repo: "{{ (item.value)|combine(item.value, {'name': item.key}) }}"
- name: write deploy key
copy:
content: "{{ repo.deploykey }}"
dest: "{{ repo.deploykeypath }}"
mode: 0600
owner: "{{ repo.user }}"
when:
- repo.deploykey|d(false)
- repo.deploykeypath|d(false)
- name: write hostkey
debug: msg=a
- name: clone repositories
become_user: "{{ repo.user|d('root') }}"
become: true
git:
depth: "{{ repo.depth|d(omit) }}"
dest: "{{ repo.path }}"
repo: "{{ repo.url }}"
accept_hostkey: true
update: true
key_file: "{{ repo.deploykeypath|d(None) }}"
version: "{{ repo.version|d('master') }}"
force: "{{ repo.force|d(false) }}"
reference: "{{ repo.reference|d('+refs/heads/*:refs/remotes/origin/*') }}"