--- # Copyright 2014, Rackspace US, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - name: create the system group group: name: "{{ repo_service_group_name }}" state: "present" system: "yes" tags: - pkg-repo-group - name: Remove old key file(s) if found file: path: "{{ item }}" state: "absent" with_items: - "{{ repo_service_home_folder }}/.ssh/authorized_keys" - "{{ repo_service_home_folder }}/.ssh/id_rsa" - "{{ repo_service_home_folder }}/.ssh/id_rsa.pub" when: repo_recreate_keys | bool tags: - repo-key - repo-key-create - name: Create the nginx system user user: name: "{{ repo_service_user_name }}" group: "{{ repo_service_group_name }}" comment: "Nginx repo user" shell: "/bin/bash" system: "yes" createhome: "yes" home: "{{ repo_service_home_folder }}" generate_ssh_key: "yes" tags: - pkg-repo-user - repo-key - repo-key-create - name: File and directory setup file: path: "{{ item.path }}" state: "{{ item.state }}" owner: "{{ item.owner|default('root') }}" group: "{{ item.group|default('root') }}" mode: "{{ item.mode }}" 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 }}/.ssh", state: "directory", owner: "{{ repo_service_user_name }}", group: "{{ repo_service_group_name }}", mode: "2700" } - { 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 }}/repo/links", state: "directory", owner: "{{ repo_service_user_name }}", group: "{{ repo_service_group_name }}", mode: "2755" } - { path: "{{ repo_service_home_folder }}/repo/os-releases", state: "directory", owner: "{{ repo_service_user_name }}", group: "{{ repo_service_group_name }}", mode: "2755" } - { 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/openstackgit", state: "directory", owner: "{{ repo_service_user_name }}", group: "{{ repo_service_group_name }}", mode: "2755" } - { path: "{{ repo_service_home_folder }}/repo/python_packages", state: "directory", owner: "{{ repo_service_user_name }}", group: "{{ repo_service_group_name }}", mode: "2755" } - { path: "{{ repo_service_home_folder }}/repo/python_packages/pools", state: "directory", owner: "{{ repo_service_user_name }}", group: "{{ repo_service_group_name }}", mode: "2755" } - { 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/reports", state: "directory", owner: "{{ repo_service_user_name }}", group: "{{ repo_service_group_name }}", mode: "2755" } - { path: "/etc/lsyncd", state: "directory", mode: "0755" } - { path: "/var/log/lsyncd", state: "directory", mode: "0755" } - { path: "/etc/nginx/sites-enabled/default", state: "absent", mode: "0644" } tags: - pkg-repo-dirs - name: Drop NGINX configuration files template: src: "{{ item.src }}" dest: "{{ item.dest }}" with_items: - { src: "nginx.conf.j2", dest: "/etc/nginx/nginx.conf" } - { src: "rsyncd.conf.j2", dest: "/etc/rsyncd.conf" } - { src: "openstack-slushee.vhost.j2", dest: "/etc/nginx/sites-available/openstack-slushee.vhost" } notify: - reload nginx tags: - pkg-repo-nginx - pkg-repo-config - name: Change fcgiwrap GID/UID lineinfile: dest: "/etc/init.d/fcgiwrap" regexp: "{{ item.regexp }}" line: "{{ item.line }}" with_items: - { regexp: "^FCGI_SOCKET_OWNER=", line: 'FCGI_SOCKET_OWNER="{{ repo_service_user_name }}"' } - { regexp: "^FCGI_SOCKET_GROUP=", line: 'FCGI_SOCKET_GROUP="{{ repo_service_group_name }}"' } notify: - reload nginx - reload fcgiwrap tags: - pkg-repo-nginx - pkg-repo-config - name: Enable openstack-slushee site file: src: "/etc/nginx/sites-available/openstack-slushee.vhost" dest: "/etc/nginx/sites-enabled/openstack-slushee.vhost" state: "link" notify: - reload nginx tags: - pkg-repo-nginx - pkg-repo-config