Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a basic meta dir for it to work with Tower #1

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
galaxy_info:
role_name: ansible-git
author: Will Tome
# yamllint disable-line rule:line-length
description: |
Role to push and pull git repos
company: Ansible by Red Hat
license: GPLv3
min_ansible_version: 2.8.0.0
github_branch: master
platforms:
- name: GenericLinux
versions:
- all
galaxy_tags:
- github
- git
dependencies: []
8 changes: 6 additions & 2 deletions tasks/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
- name: set repo path
set_fact:
git_repo_path: "{{ git_url | regex_search('/(.+).git') | regex_replace('.git', '') }}"


- name: debug key
debug:
msg: "{{ lookup('file', git_temp_file.path ) }}"

- name: git clone
git:
repo: "{{ git_url }}"
dest: "{{ playbook_dir }}/{{ git_repo_path }}"
dest: "{{ playbook_dir }}{{ git_repo_path }}"
accept_hostkey: yes
key_file: "{{ git_temp_file.path }}"

Expand Down
4 changes: 4 additions & 0 deletions tasks/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
dest: "{{ playbook_dir }}/.ssh/ssh"
content: "ssh -i {{ git_temp_file.path }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $*"
mode: 0700

- name: debug key
debug:
msg: "{{ lookup('file', git_temp_file.path ) }}"

- name: git push
shell: git push --force
Expand Down
2 changes: 1 addition & 1 deletion tasks/unpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
tempfile:
path: "{{ playbook_dir }}/.ssh"
register: git_temp_file

- name: copy key to temp file
copy:
content: "{{ git_key }}"
Expand Down