mirror of
https://github.com/ansible/awx.git
synced 2026-03-01 00:38:45 -03:30
Add blocks around the different SCMs, for clarity purposes.
This commit is contained in:
@@ -23,88 +23,91 @@
|
|||||||
state: absent
|
state: absent
|
||||||
when: scm_delete_on_update|default('')
|
when: scm_delete_on_update|default('')
|
||||||
|
|
||||||
- name: update project using git and accept hostkey
|
- block:
|
||||||
git:
|
- name: update project using git and accept hostkey
|
||||||
dest: "{{project_path|quote}}"
|
git:
|
||||||
repo: "{{scm_url}}"
|
dest: "{{project_path|quote}}"
|
||||||
version: "{{scm_branch|quote}}"
|
repo: "{{scm_url}}"
|
||||||
force: "{{scm_clean}}"
|
version: "{{scm_branch|quote}}"
|
||||||
accept_hostkey: "{{scm_accept_hostkey}}"
|
force: "{{scm_clean}}"
|
||||||
#clone: "{{ scm_full_checkout }}"
|
accept_hostkey: "{{scm_accept_hostkey}}"
|
||||||
#update: "{{ scm_full_checkout }}"
|
when: scm_accept_hostkey is defined
|
||||||
when: scm_type == 'git' and scm_accept_hostkey is defined
|
register: scm_result
|
||||||
register: scm_result
|
|
||||||
|
|
||||||
- name: Set the git repository version
|
- name: Set the git repository version
|
||||||
set_fact:
|
set_fact:
|
||||||
scm_version: "{{ scm_result['after'] }}"
|
scm_version: "{{ scm_result['after'] }}"
|
||||||
when: "'after' in scm_result"
|
when: "'after' in scm_result"
|
||||||
|
|
||||||
- name: update project using git
|
- name: update project using git
|
||||||
git:
|
git:
|
||||||
dest: "{{project_path|quote}}"
|
dest: "{{project_path|quote}}"
|
||||||
repo: "{{scm_url}}"
|
repo: "{{scm_url}}"
|
||||||
version: "{{scm_branch|quote}}"
|
version: "{{scm_branch|quote}}"
|
||||||
force: "{{scm_clean}}"
|
force: "{{scm_clean}}"
|
||||||
#clone: "{{ scm_full_checkout }}"
|
when: scm_accept_hostkey is not defined
|
||||||
#update: "{{ scm_full_checkout }}"
|
register: scm_result
|
||||||
when: scm_type == 'git' and scm_accept_hostkey is not defined
|
|
||||||
register: scm_result
|
|
||||||
|
|
||||||
- name: Set the git repository version
|
- name: Set the git repository version
|
||||||
set_fact:
|
set_fact:
|
||||||
scm_version: "{{ scm_result['after'] }}"
|
scm_version: "{{ scm_result['after'] }}"
|
||||||
when: "'after' in scm_result"
|
when: "'after' in scm_result"
|
||||||
|
when: scm_type == 'git'
|
||||||
|
|
||||||
- name: update project using hg
|
- block:
|
||||||
hg:
|
- name: update project using hg
|
||||||
dest: "{{project_path|quote}}"
|
hg:
|
||||||
repo: "{{scm_url|quote}}"
|
dest: "{{project_path|quote}}"
|
||||||
revision: "{{scm_branch|quote}}"
|
repo: "{{scm_url|quote}}"
|
||||||
force: "{{scm_clean}}"
|
revision: "{{scm_branch|quote}}"
|
||||||
#clone: "{{ scm_full_checkout }}"
|
force: "{{scm_clean}}"
|
||||||
#update: "{{ scm_full_checkout }}"
|
register: scm_result
|
||||||
|
|
||||||
|
- name: Set the hg repository version
|
||||||
|
set_fact:
|
||||||
|
scm_version: "{{ scm_result['after'] }}"
|
||||||
|
when: "'after' in scm_result"
|
||||||
|
|
||||||
|
- name: parse hg version string properly
|
||||||
|
set_fact:
|
||||||
|
scm_version: "{{scm_version|regex_replace('^([A-Za-z0-9]+).*$', '\\1')}}"
|
||||||
when: scm_type == 'hg'
|
when: scm_type == 'hg'
|
||||||
register: scm_result
|
|
||||||
|
|
||||||
- name: Set the hg repository version
|
- block:
|
||||||
set_fact:
|
- name: update project using svn
|
||||||
scm_version: "{{ scm_result['after'] }}"
|
subversion:
|
||||||
when: "'after' in scm_result"
|
dest: "{{project_path|quote}}"
|
||||||
|
repo: "{{scm_url|quote}}"
|
||||||
|
revision: "{{scm_branch|quote}}"
|
||||||
|
force: "{{scm_clean}}"
|
||||||
|
when: not scm_username|default('')
|
||||||
|
register: scm_result
|
||||||
|
|
||||||
- name: update project using svn
|
- name: Set the svn repository version
|
||||||
subversion:
|
set_fact:
|
||||||
dest: "{{project_path|quote}}"
|
scm_version: "{{ scm_result['after'] }}"
|
||||||
repo: "{{scm_url|quote}}"
|
when: "'after' in scm_result"
|
||||||
revision: "{{scm_branch|quote}}"
|
|
||||||
force: "{{scm_clean}}"
|
|
||||||
#checkout: "{{ scm_full_checkout }}"
|
|
||||||
#update: "{{ scm_full_checkout }}"
|
|
||||||
when: scm_type == 'svn' and not scm_username|default('')
|
|
||||||
register: scm_result
|
|
||||||
|
|
||||||
- name: Set the svn repository version
|
- name: update project using svn with auth
|
||||||
set_fact:
|
subversion:
|
||||||
scm_version: "{{ scm_result['after'] }}"
|
dest: "{{project_path|quote}}"
|
||||||
when: "'after' in scm_result"
|
repo: "{{scm_url|quote}}"
|
||||||
|
revision: "{{scm_branch|quote}}"
|
||||||
|
force: "{{scm_clean}}"
|
||||||
|
username: "{{scm_username|quote}}"
|
||||||
|
password: "{{scm_password|quote}}"
|
||||||
|
when: scm_username|default('')
|
||||||
|
register: scm_result
|
||||||
|
|
||||||
- name: update project using svn with auth
|
- name: Set the svn repository version
|
||||||
subversion:
|
set_fact:
|
||||||
dest: "{{project_path|quote}}"
|
scm_version: "{{ scm_result['after'] }}"
|
||||||
repo: "{{scm_url|quote}}"
|
when: "'after' in scm_result"
|
||||||
revision: "{{scm_branch|quote}}"
|
|
||||||
force: "{{scm_clean}}"
|
|
||||||
username: "{{scm_username|quote}}"
|
|
||||||
password: "{{scm_password|quote}}"
|
|
||||||
#checkout: "{{ scm_full_checkout }}"
|
|
||||||
#update: "{{ scm_full_checkout }}"
|
|
||||||
when: scm_type == 'svn' and scm_username|default('')
|
|
||||||
register: scm_result
|
|
||||||
|
|
||||||
- name: Set the svn repository version
|
- name: parse subversion version string properly
|
||||||
set_fact:
|
set_fact:
|
||||||
scm_version: "{{ scm_result['after'] }}"
|
scm_version: "{{scm_version|regex_replace('^.*Revision: ([0-9]+).*$', '\\1')}}"
|
||||||
when: "'after' in scm_result"
|
when: scm_type == 'svn'
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Ensure the project directory is present
|
- name: Ensure the project directory is present
|
||||||
@@ -120,33 +123,24 @@
|
|||||||
project_path: "{{project_path}}"
|
project_path: "{{project_path}}"
|
||||||
register: results
|
register: results
|
||||||
|
|
||||||
|
- name: Save Insights Version
|
||||||
|
set_fact:
|
||||||
|
scm_version: "{{results.version}}"
|
||||||
|
when: results is defined
|
||||||
when: scm_type == 'insights'
|
when: scm_type == 'insights'
|
||||||
|
|
||||||
- name: Save Insights Version
|
|
||||||
set_fact:
|
|
||||||
scm_version: "{{results.version}}"
|
|
||||||
when: scm_type == 'insights' and results is defined
|
|
||||||
|
|
||||||
- name: detect requirements.yml
|
- block:
|
||||||
stat: path={{project_path|quote}}/roles/requirements.yml
|
- name: detect requirements.yml
|
||||||
register: doesRequirementsExist
|
stat: path={{project_path|quote}}/roles/requirements.yml
|
||||||
|
register: doesRequirementsExist
|
||||||
|
|
||||||
- name: fetch galaxy roles from requirements.yml
|
- name: fetch galaxy roles from requirements.yml
|
||||||
command: ansible-galaxy install -r requirements.yml -p {{project_path|quote}}/roles/ --force
|
command: ansible-galaxy install -r requirements.yml -p {{project_path|quote}}/roles/ --force
|
||||||
args:
|
args:
|
||||||
chdir: "{{project_path|quote}}/roles"
|
chdir: "{{project_path|quote}}/roles"
|
||||||
when: doesRequirementsExist.stat.exists and scm_full_checkout|bool
|
when: doesRequirementsExist.stat.exists
|
||||||
|
when: scm_full_checkout|bool
|
||||||
# format provided by ansible is ["Revision: 12345", "URL: ..."]
|
|
||||||
- name: parse subversion version string properly
|
|
||||||
set_fact:
|
|
||||||
scm_version: "{{scm_version|regex_replace('^.*Revision: ([0-9]+).*$', '\\1')}}"
|
|
||||||
when: scm_type == 'svn'
|
|
||||||
|
|
||||||
- name: parse hg version string properly
|
|
||||||
set_fact:
|
|
||||||
scm_version: "{{scm_version|regex_replace('^([A-Za-z0-9]+).*$', '\\1')}}"
|
|
||||||
when: scm_type == 'hg'
|
|
||||||
|
|
||||||
- name: Repository Version
|
- name: Repository Version
|
||||||
debug: msg="Repository Version {{ scm_version }}"
|
debug: msg="Repository Version {{ scm_version }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user