Skip to content

Commit

Permalink
Make force a setting for all repositories and individually.
Browse files Browse the repository at this point in the history
  • Loading branch information
robertdebock committed Feb 5, 2019
1 parent 14e180d commit d336a7b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,21 @@ These variables are set in `defaults/main.yml`:
# Where to place the copies of the repositories.
git_repository_destination: /home/{{ git_username }}/Documents/github.com/{{ git_username }}


# Should git force (overwrite locally changed) clone? (Can also be controlled
# per repository, see below.
git_force: no

# The repositories to check out, bootstrap is pinned to a version, java will get HEAD/latest.
# git_repositories:
# - repo: https://github.com/robertdebock/ansible-role-bootstrap.git
# dest: bootstrap
# version: 2.2.4
# - repo: ssh://[email protected]/robertdebock/ansible-role-java.git
# dest: java
# - repo: ssh://[email protected]/robertdebock/ansible-role-tomcat.git
# dest: tomcat
# force: yes

# To update packages this role places on the system, set `git_package_state` to `latest`.
git_package_state: present
Expand Down
8 changes: 8 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,21 @@
# Where to place the copies of the repositories.
git_repository_destination: /home/{{ git_username }}/Documents/github.com/{{ git_username }}


# Should git force (overwrite locally changed) clone? (Can also be controlled
# per repository, see below.
git_force: no

# The repositories to check out, bootstrap is pinned to a version, java will get HEAD/latest.
# git_repositories:
# - repo: https://github.com/robertdebock/ansible-role-bootstrap.git
# dest: bootstrap
# version: 2.2.4
# - repo: ssh://[email protected]/robertdebock/ansible-role-java.git
# dest: java
# - repo: ssh://[email protected]/robertdebock/ansible-role-tomcat.git
# dest: tomcat
# force: yes

# To update packages this role places on the system, set `git_package_state` to `latest`.
git_package_state: present
Expand Down
2 changes: 1 addition & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
dest: "{{ git_repository_destination }}/{{ item.dest }}"
accept_hostkey: yes
version: "{{ item.version | default('HEAD') }}"
force: "{{ item.force | default('no') }}"
force: "{{ item.force | default(git_force) }}"
with_items: "{{ git_repositories }}"
become: yes
become_user: "{{ git_username }}"
Expand Down

0 comments on commit d336a7b

Please sign in to comment.