From b435a3dceb06241b7d36e7320b54bb0ebbb3618e Mon Sep 17 00:00:00 2001 From: mg Date: Tue, 20 Jul 2021 10:27:33 +0200 Subject: [PATCH] =?UTF-8?q?branch=20f=C3=BCr=20git=20(#164)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit testvar docker branch branch docker branch dotfiles Co-authored-by: Michael Grote Reviewed-on: https://git.mgrote.net/mg/ansible/pulls/164 Co-Authored-By: mg Co-Committed-By: mg --- host_vars/docker-test.grote.lan.yml | 1 + roles/mgrote.docker-compose-deploy/README.md | 1 + roles/mgrote.docker-compose-deploy/tasks/dockercompose-up.yml | 1 + roles/mgrote.dotfiles/defaults/main.yml | 1 + roles/mgrote.dotfiles/tasks/main.yml | 1 + 5 files changed, 5 insertions(+) diff --git a/host_vars/docker-test.grote.lan.yml b/host_vars/docker-test.grote.lan.yml index e096f037..9488fa6d 100644 --- a/host_vars/docker-test.grote.lan.yml +++ b/host_vars/docker-test.grote.lan.yml @@ -6,6 +6,7 @@ dir_name: docker-homer repository_url: git.mgrote.net/mg/docker-homer state: present + git_branch: test - name: watchtower dir_name: docker-watchtower repository_url: git.mgrote.net/mg/docker-watchtower diff --git a/roles/mgrote.docker-compose-deploy/README.md b/roles/mgrote.docker-compose-deploy/README.md index 01017a0f..827ce36d 100644 --- a/roles/mgrote.docker-compose-deploy/README.md +++ b/roles/mgrote.docker-compose-deploy/README.md @@ -22,6 +22,7 @@ docker_compose_projects: repository_user_password: k1BvXXXXXXXrbg # git user password for login on private Repositories; optional; just dont let it empty, remove it network_name: homer-network # docker-network to create; optional; just dont let it empty, remove it state: present|absent # should the project be present or absent? + git_branch: master # branch to checkout; optional; just dont let it empty, remove it ``` diff --git a/roles/mgrote.docker-compose-deploy/tasks/dockercompose-up.yml b/roles/mgrote.docker-compose-deploy/tasks/dockercompose-up.yml index 3b5ed6ea..c9fe901e 100644 --- a/roles/mgrote.docker-compose-deploy/tasks/dockercompose-up.yml +++ b/roles/mgrote.docker-compose-deploy/tasks/dockercompose-up.yml @@ -29,6 +29,7 @@ ansible.builtin.git: repo: "https://{{ login | default () }}{{ item.repository_url }}" dest: "{{ project_dir }}" + version: "{{ item.git_branch | default ('master') }}" register: repo - name: create networks - "{{ item.name }}" diff --git a/roles/mgrote.dotfiles/defaults/main.yml b/roles/mgrote.dotfiles/defaults/main.yml index ee4ae3c8..2a50b1e6 100644 --- a/roles/mgrote.dotfiles/defaults/main.yml +++ b/roles/mgrote.dotfiles/defaults/main.yml @@ -1,6 +1,7 @@ --- dotfiles_repo_url: https://git.mgrote.net/mg/dotfiles # url zum repo dotfiles_repo_path: /home/mg/dotfiles # wo soll das repo lokal gespeichert werden + dotfiles_repo_branch: master #default branch for checking out dotfiles_files: # welche dateien sollen wohin verlinkt werden (ln -s) - repo_path: "{{ dotfiles_repo_path}}/.vimrc" local_path: "/home/mg/.vimrc" diff --git a/roles/mgrote.dotfiles/tasks/main.yml b/roles/mgrote.dotfiles/tasks/main.yml index 36ae2578..d21fd0ef 100644 --- a/roles/mgrote.dotfiles/tasks/main.yml +++ b/roles/mgrote.dotfiles/tasks/main.yml @@ -22,6 +22,7 @@ repo: "{{ dotfiles_repo_url }}" dest: "{{ dotfiles_repo_path }}" depth: 1 + version: "{{ dotfiles_repo_branch }}" register: git_clone - name: set owner recursive for repo