Cater for git cache when preparing repo server
When a git cache is implemented, a symlink is already in place for the git folder when the repo server is prepared. This causes the directory setup task to fail because the folder already exists as a link. This patch detects the presence of the folder and adjusts the directory creation task to know that it should be a symlink. The task is re-organised a bit to make it easier to read. Change-Id: Idca73d6ac4dc3c668b6991ab2aae4784d1fe059d
This commit is contained in:
parent
07aa872e9f
commit
53f6852ba3
@ -49,30 +49,62 @@
|
|||||||
- repo-key
|
- repo-key
|
||||||
- repo-key-create
|
- repo-key-create
|
||||||
|
|
||||||
- name: File and directory setup
|
- name: Check if the git folder exists already
|
||||||
|
stat:
|
||||||
|
path: "{{ repo_service_home_folder }}/repo/openstackgit"
|
||||||
|
register: _git_folder
|
||||||
|
|
||||||
|
- name: File and directory setup (non-root user)
|
||||||
file:
|
file:
|
||||||
path: "{{ item.path }}"
|
path: "{{ item.path }}"
|
||||||
state: "{{ item.state }}"
|
state: "{{ item.state }}"
|
||||||
owner: "{{ item.owner|default('root') }}"
|
owner: "{{ repo_service_user_name }}"
|
||||||
group: "{{ item.group|default('root') }}"
|
group: "{{ repo_service_group_name }}"
|
||||||
mode: "{{ item.mode }}"
|
mode: "{{ item.mode | default('2755') }}"
|
||||||
with_items:
|
with_items:
|
||||||
- { path: "{{ repo_service_home_folder }}", state: "directory", owner: "{{ repo_service_user_name }}", group: "{{ repo_service_group_name }}", mode: "2755" }
|
- path: "{{ repo_service_home_folder }}"
|
||||||
- { path: "{{ repo_service_home_folder }}/.ssh", state: "directory", owner: "{{ repo_service_user_name }}", group: "{{ repo_service_group_name }}", mode: "2700" }
|
state: "directory"
|
||||||
- { path: "{{ repo_service_home_folder }}/repo", state: "directory", owner: "{{ repo_service_user_name }}", group: "{{ repo_service_group_name }}", mode: "2755" }
|
- path: "{{ repo_service_home_folder }}/.ssh"
|
||||||
- { path: "{{ repo_service_home_folder }}/repo/links", state: "directory", owner: "{{ repo_service_user_name }}", group: "{{ repo_service_group_name }}", mode: "2755" }
|
state: "directory"
|
||||||
- { path: "{{ repo_service_home_folder }}/repo/os-releases", state: "directory", owner: "{{ repo_service_user_name }}", group: "{{ repo_service_group_name }}", mode: "2755" }
|
mode: "2700"
|
||||||
- { path: "{{ repo_service_home_folder }}/repo/os-releases/{{ openstack_release }}", state: "directory", owner: "{{ repo_service_user_name }}", group: "{{ repo_service_group_name }}", mode: "2755" }
|
- path: "{{ repo_service_home_folder }}/repo"
|
||||||
- { path: "{{ repo_service_home_folder }}/repo/openstackgit", state: "directory", owner: "{{ repo_service_user_name }}", group: "{{ repo_service_group_name }}", mode: "2755" }
|
state: "directory"
|
||||||
- { path: "{{ repo_service_home_folder }}/repo/pools", state: "directory", owner: "{{ repo_service_user_name }}", group: "{{ repo_service_group_name }}", mode: "2755" }
|
- path: "{{ repo_service_home_folder }}/repo/links"
|
||||||
- { path: "/etc/lsyncd", state: "directory", mode: "0755" }
|
state: "directory"
|
||||||
- { path: "/var/log/lsyncd", state: "directory", mode: "0755" }
|
- path: "{{ repo_service_home_folder }}/repo/os-releases"
|
||||||
- { path: "/etc/nginx/sites-enabled/default", state: "absent", mode: "0644" }
|
state: "directory"
|
||||||
- { path: "/etc/nginx/sites-available", state: "directory", mode: "0644" }
|
- path: "{{ repo_service_home_folder }}/repo/os-releases/{{ openstack_release }}"
|
||||||
- { path: "/etc/nginx/sites-enabled", state: "directory", mode: "0644" }
|
state: "directory"
|
||||||
|
- path: "{{ repo_service_home_folder }}/repo/openstackgit"
|
||||||
|
state: "{{ (_git_folder.stat.exists and _git_folder.stat.islnk) | ternary('link', 'directory') }}"
|
||||||
|
- path: "{{ repo_service_home_folder }}/repo/pools"
|
||||||
|
state: "directory"
|
||||||
tags:
|
tags:
|
||||||
- pkg-repo-dirs
|
- pkg-repo-dirs
|
||||||
|
|
||||||
|
- name: File and directory setup (root user)
|
||||||
|
file:
|
||||||
|
path: "{{ item.path }}"
|
||||||
|
state: "{{ item.state }}"
|
||||||
|
owner: "root"
|
||||||
|
group: "root"
|
||||||
|
mode: "{{ item.mode | default(omit) }}"
|
||||||
|
with_items:
|
||||||
|
- path: "/etc/lsyncd"
|
||||||
|
state: "directory"
|
||||||
|
mode: "0755"
|
||||||
|
- path: "/var/log/lsyncd"
|
||||||
|
state: "directory"
|
||||||
|
mode: "0755"
|
||||||
|
- path: "/etc/nginx/sites-enabled/default"
|
||||||
|
state: "absent"
|
||||||
|
- path: "/etc/nginx/sites-available"
|
||||||
|
state: "directory"
|
||||||
|
mode: "0644"
|
||||||
|
- path: "/etc/nginx/sites-enabled"
|
||||||
|
state: "directory"
|
||||||
|
mode: "0644"
|
||||||
|
|
||||||
- name: Drop NGINX configuration files
|
- name: Drop NGINX configuration files
|
||||||
template:
|
template:
|
||||||
src: "{{ item.src }}"
|
src: "{{ item.src }}"
|
||||||
|
Loading…
Reference in New Issue
Block a user