mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 01:17:37 -02:30
Revert project_update.yml
Due to problem found in testing reverting
019e6a52fe
This commit is contained in:
@@ -25,21 +25,17 @@
|
|||||||
connection: local
|
connection: local
|
||||||
name: Update source tree if necessary
|
name: Update source tree if necessary
|
||||||
tasks:
|
tasks:
|
||||||
- name: Delete project directory before update
|
|
||||||
ansible.builtin.shell: set -o pipefail && find . -delete -print | tail -2 # volume mounted, cannot delete folder itself
|
- name: delete project directory before update
|
||||||
register: reg
|
command: "find -delete" # volume mounted, cannot delete folder itself
|
||||||
changed_when: reg.stdout_lines | length > 1
|
|
||||||
args:
|
args:
|
||||||
chdir: "{{ project_path }}"
|
chdir: "{{ project_path }}"
|
||||||
tags:
|
tags:
|
||||||
- delete
|
- delete
|
||||||
|
|
||||||
- name: Update project using git
|
- block:
|
||||||
tags:
|
- name: update project using git
|
||||||
- update_git
|
git:
|
||||||
block:
|
|
||||||
- name: Update project using git
|
|
||||||
ansible.builtin.git:
|
|
||||||
dest: "{{project_path|quote}}"
|
dest: "{{project_path|quote}}"
|
||||||
repo: "{{scm_url}}"
|
repo: "{{scm_url}}"
|
||||||
version: "{{scm_branch|quote}}"
|
version: "{{scm_branch|quote}}"
|
||||||
@@ -50,16 +46,15 @@
|
|||||||
register: git_result
|
register: git_result
|
||||||
|
|
||||||
- name: Set the git repository version
|
- name: Set the git repository version
|
||||||
ansible.builtin.set_fact:
|
set_fact:
|
||||||
scm_version: "{{ git_result['after'] }}"
|
scm_version: "{{ git_result['after'] }}"
|
||||||
when: "'after' in git_result"
|
when: "'after' in git_result"
|
||||||
|
|
||||||
- name: Update project using svn
|
|
||||||
tags:
|
tags:
|
||||||
- update_svn
|
- update_git
|
||||||
block:
|
|
||||||
- name: Update project using svn
|
- block:
|
||||||
ansible.builtin.subversion:
|
- name: update project using svn
|
||||||
|
subversion:
|
||||||
dest: "{{project_path|quote}}"
|
dest: "{{project_path|quote}}"
|
||||||
repo: "{{scm_url|quote}}"
|
repo: "{{scm_url|quote}}"
|
||||||
revision: "{{scm_branch|quote}}"
|
revision: "{{scm_branch|quote}}"
|
||||||
@@ -73,24 +68,21 @@
|
|||||||
register: svn_result
|
register: svn_result
|
||||||
|
|
||||||
- name: Set the svn repository version
|
- name: Set the svn repository version
|
||||||
ansible.builtin.set_fact:
|
set_fact:
|
||||||
scm_version: "{{ svn_result['after'] }}"
|
scm_version: "{{ svn_result['after'] }}"
|
||||||
when: "'after' in svn_result"
|
when: "'after' in svn_result"
|
||||||
|
|
||||||
- name: Parse subversion version string properly
|
- name: parse subversion version string properly
|
||||||
ansible.builtin.set_fact:
|
set_fact:
|
||||||
scm_version: "{{scm_version|regex_replace('^.*Revision: ([0-9]+).*$', '\\1')}}"
|
scm_version: "{{scm_version|regex_replace('^.*Revision: ([0-9]+).*$', '\\1')}}"
|
||||||
|
|
||||||
|
|
||||||
- name: Project update for Insights
|
|
||||||
tags:
|
tags:
|
||||||
- update_insights
|
- update_svn
|
||||||
block:
|
|
||||||
|
- block:
|
||||||
- name: Ensure the project directory is present
|
- name: Ensure the project directory is present
|
||||||
ansible.builtin.file:
|
file:
|
||||||
dest: "{{project_path|quote}}"
|
dest: "{{project_path|quote}}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: '0755'
|
|
||||||
|
|
||||||
- name: Fetch Insights Playbook(s)
|
- name: Fetch Insights Playbook(s)
|
||||||
insights:
|
insights:
|
||||||
@@ -103,29 +95,25 @@
|
|||||||
register: results
|
register: results
|
||||||
|
|
||||||
- name: Save Insights Version
|
- name: Save Insights Version
|
||||||
ansible.builtin.set_fact:
|
set_fact:
|
||||||
scm_version: "{{results.version}}"
|
scm_version: "{{results.version}}"
|
||||||
when: results is defined
|
when: results is defined
|
||||||
|
|
||||||
|
|
||||||
- name: Update project using archive
|
|
||||||
tags:
|
tags:
|
||||||
- update_archive
|
- update_insights
|
||||||
block:
|
|
||||||
|
- block:
|
||||||
- name: Ensure the project archive directory is present
|
- name: Ensure the project archive directory is present
|
||||||
ansible.builtin.file:
|
file:
|
||||||
dest: "{{ project_path|quote }}/.archive"
|
dest: "{{ project_path|quote }}/.archive"
|
||||||
state: directory
|
state: directory
|
||||||
mode: '0755'
|
|
||||||
|
|
||||||
- name: Get archive from url
|
- name: Get archive from url
|
||||||
ansible.builtin.get_url:
|
get_url:
|
||||||
url: "{{ scm_url|quote }}"
|
url: "{{ scm_url|quote }}"
|
||||||
dest: "{{ project_path|quote }}/.archive/"
|
dest: "{{ project_path|quote }}/.archive/"
|
||||||
url_username: "{{ scm_username|default(omit) }}"
|
url_username: "{{ scm_username|default(omit) }}"
|
||||||
url_password: "{{ scm_password|default(omit) }}"
|
url_password: "{{ scm_password|default(omit) }}"
|
||||||
force_basic_auth: true
|
force_basic_auth: true
|
||||||
mode: '0755'
|
|
||||||
register: get_archive
|
register: get_archive
|
||||||
|
|
||||||
- name: Unpack archive
|
- name: Unpack archive
|
||||||
@@ -137,7 +125,7 @@
|
|||||||
register: unarchived
|
register: unarchived
|
||||||
|
|
||||||
- name: Find previous archives
|
- name: Find previous archives
|
||||||
ansible.builtin.find:
|
find:
|
||||||
paths: "{{ project_path|quote }}/.archive/"
|
paths: "{{ project_path|quote }}/.archive/"
|
||||||
excludes:
|
excludes:
|
||||||
- "{{ get_archive.dest|basename }}"
|
- "{{ get_archive.dest|basename }}"
|
||||||
@@ -145,18 +133,20 @@
|
|||||||
register: previous_archive
|
register: previous_archive
|
||||||
|
|
||||||
- name: Remove previous archives
|
- name: Remove previous archives
|
||||||
ansible.builtin.file:
|
file:
|
||||||
path: "{{ item.path }}"
|
path: "{{ item.path }}"
|
||||||
state: absent
|
state: absent
|
||||||
loop: "{{ previous_archive.files }}"
|
loop: "{{ previous_archive.files }}"
|
||||||
when: previous_archive.files|default([])
|
when: previous_archive.files|default([])
|
||||||
|
|
||||||
- name: Set scm_version to archive sha1 checksum
|
- name: Set scm_version to archive sha1 checksum
|
||||||
ansible.builtin.set_fact:
|
set_fact:
|
||||||
scm_version: "{{ get_archive.checksum_src }}"
|
scm_version: "{{ get_archive.checksum_src }}"
|
||||||
|
tags:
|
||||||
|
- update_archive
|
||||||
|
|
||||||
- name: Repository Version
|
- name: Repository Version
|
||||||
ansible.builtin.debug:
|
debug:
|
||||||
msg: "Repository Version {{ scm_version }}"
|
msg: "Repository Version {{ scm_version }}"
|
||||||
tags:
|
tags:
|
||||||
- update_git
|
- update_git
|
||||||
@@ -198,22 +188,23 @@
|
|||||||
# otherwise, files cannot be moved accross volumes and will cause error
|
# otherwise, files cannot be moved accross volumes and will cause error
|
||||||
ANSIBLE_LOCAL_TEMP: "{{projects_root}}/.__awx_cache/{{local_path}}/stage/tmp"
|
ANSIBLE_LOCAL_TEMP: "{{projects_root}}/.__awx_cache/{{local_path}}/stage/tmp"
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
- name: Check content sync settings
|
- name: Check content sync settings
|
||||||
|
block:
|
||||||
|
- debug:
|
||||||
|
msg: >
|
||||||
|
Collection and role syncing disabled. Check the AWX_ROLES_ENABLED and
|
||||||
|
AWX_COLLECTIONS_ENABLED settings and Galaxy credentials on the project's organization.
|
||||||
|
|
||||||
|
- meta: end_play
|
||||||
|
|
||||||
when: not roles_enabled|bool and not collections_enabled|bool
|
when: not roles_enabled|bool and not collections_enabled|bool
|
||||||
tags:
|
tags:
|
||||||
- install_roles
|
- install_roles
|
||||||
- install_collections
|
- install_collections
|
||||||
block:
|
|
||||||
- name: Warn about disabled content sync
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: >
|
|
||||||
Collection and role syncing disabled. Check the AWX_ROLES_ENABLED and
|
|
||||||
AWX_COLLECTIONS_ENABLED settings and Galaxy credentials on the project's organization.
|
|
||||||
- name: End play due to disabled content sync
|
|
||||||
ansible.builtin.meta: end_play
|
|
||||||
|
|
||||||
- name: Fetch galaxy roles from requirements.(yml/yaml)
|
- name: fetch galaxy roles from requirements.(yml/yaml)
|
||||||
ansible.builtin.command: >
|
command: >
|
||||||
ansible-galaxy role install -r {{ item }}
|
ansible-galaxy role install -r {{ item }}
|
||||||
--roles-path {{projects_root}}/.__awx_cache/{{local_path}}/stage/requirements_roles
|
--roles-path {{projects_root}}/.__awx_cache/{{local_path}}/stage/requirements_roles
|
||||||
{{ ' -' + 'v' * ansible_verbosity if ansible_verbosity else '' }}
|
{{ ' -' + 'v' * ansible_verbosity if ansible_verbosity else '' }}
|
||||||
@@ -229,8 +220,8 @@
|
|||||||
tags:
|
tags:
|
||||||
- install_roles
|
- install_roles
|
||||||
|
|
||||||
- name: Fetch galaxy collections from collections/requirements.(yml/yaml)
|
- name: fetch galaxy collections from collections/requirements.(yml/yaml)
|
||||||
ansible.builtin.command: >
|
command: >
|
||||||
ansible-galaxy collection install -r {{ item }}
|
ansible-galaxy collection install -r {{ item }}
|
||||||
--collections-path {{projects_root}}/.__awx_cache/{{local_path}}/stage/requirements_collections
|
--collections-path {{projects_root}}/.__awx_cache/{{local_path}}/stage/requirements_collections
|
||||||
{{ ' -' + 'v' * ansible_verbosity if ansible_verbosity else '' }}
|
{{ ' -' + 'v' * ansible_verbosity if ansible_verbosity else '' }}
|
||||||
|
|||||||
Reference in New Issue
Block a user