2014-10-10 12:35:14 +02:00
|
|
|
---
|
2015-04-08 20:22:53 +02:00
|
|
|
- name: mount fs
|
2017-10-17 17:37:03 +00:00
|
|
|
import_tasks: "mount_fs.yml"
|
2014-10-10 12:35:14 +02:00
|
|
|
|
2015-04-01 13:32:45 +00:00
|
|
|
- name: setup networking
|
2017-10-17 17:37:03 +00:00
|
|
|
import_tasks: "network.yml"
|
2015-04-01 13:32:45 +00:00
|
|
|
|
2019-07-11 16:15:32 +02:00
|
|
|
- name: create obsrun group for `sign' command
|
|
|
|
group: name=obsrun
|
|
|
|
|
2017-01-21 17:48:06 +01:00
|
|
|
# pre-create copr user and group with predefined uid and gid
|
|
|
|
- group: name=copr gid=986
|
2019-04-04 13:50:23 +02:00
|
|
|
- user: name=copr group=copr uid=989 groups=obsrun
|
2017-01-21 17:48:06 +01:00
|
|
|
|
2017-01-19 14:39:48 +01:00
|
|
|
- name: install copr-backend and copr-selinux
|
2019-04-02 10:27:12 +02:00
|
|
|
dnf:
|
2019-04-23 12:05:49 +02:00
|
|
|
state: present
|
2019-04-02 10:27:12 +02:00
|
|
|
name: copr-backend
|
2017-01-19 14:39:48 +01:00
|
|
|
|
|
|
|
- name: add additional packages for copr-backend
|
2019-04-02 10:27:12 +02:00
|
|
|
dnf:
|
|
|
|
state: present
|
|
|
|
name:
|
2019-07-11 16:27:56 +02:00
|
|
|
- python3-glanceclient
|
|
|
|
- python3-neutronclient
|
|
|
|
- python3-keystoneclient
|
2019-04-02 10:27:12 +02:00
|
|
|
- php-cli
|
|
|
|
- cronolog
|
2017-02-25 20:18:48 +01:00
|
|
|
|
2018-05-23 19:35:52 +00:00
|
|
|
# disable this in favor of excluding it in /etc/dnf/dnf.conf.
|
|
|
|
# https://github.com/ansible/ansible/issues/33187
|
|
|
|
#- name: install python2-novaclient version that actually works with the current OpenStack deployment
|
2019-02-08 12:18:00 +01:00
|
|
|
# dnf: state=present name=https://kojipkgs.fedoraproject.org/packages/python-novaclient/3.3.1/3.fc25/noarch/python3-novaclient-3.3.1-3.fc25.noarch.rpm
|
2018-01-15 22:17:09 +01:00
|
|
|
|
2014-10-10 12:35:14 +02:00
|
|
|
- name: make copr dirs
|
|
|
|
file: state=directory path={{ item }}
|
|
|
|
with_items:
|
|
|
|
- /var/lib/copr/jobs
|
|
|
|
- /var/lib/copr/public_html/results
|
|
|
|
|
|
|
|
- name: setup dirs there
|
|
|
|
file: state=directory path="/home/copr/{{ item }}" owner=copr group=copr mode=0700
|
|
|
|
with_items:
|
|
|
|
- cloud
|
|
|
|
- .ssh
|
|
|
|
|
|
|
|
- name: add copr-buildsys keys to copr user path
|
|
|
|
copy: src="{{ item }}" dest=/home/copr/cloud/ owner=copr group=copr mode=0600
|
|
|
|
with_fileglob:
|
|
|
|
- "{{ private }}/files/openstack/copr-copr/*"
|
|
|
|
|
|
|
|
- name: setup privkey for copr user
|
|
|
|
copy: src="{{ private }}/files/copr/buildsys.priv" dest=/home/copr/.ssh/id_rsa owner=copr group=copr mode=600
|
|
|
|
|
|
|
|
- name: setup copr user ssh config file
|
|
|
|
copy: src="ssh_config" dest=/home/copr/.ssh/config owner=copr group=copr mode=600
|
|
|
|
|
2015-02-23 16:47:35 +00:00
|
|
|
- name: check known_hosts file
|
|
|
|
command: stat /home/copr/.ssh/known_hosts
|
|
|
|
register: hostsstat
|
2016-11-01 16:29:49 +00:00
|
|
|
check_mode: no
|
2015-02-23 16:47:35 +00:00
|
|
|
changed_when: "1 != 1"
|
2015-03-18 14:04:33 +01:00
|
|
|
ignore_errors: yes
|
2015-02-23 16:47:35 +00:00
|
|
|
|
2014-10-10 12:35:14 +02:00
|
|
|
- name: create empty known_hosts
|
|
|
|
file: state=touch dest=/home/copr/.ssh/known_hosts owner=copr group=copr mode=600
|
2015-02-23 16:47:35 +00:00
|
|
|
when: hostsstat.rc == 1
|
2014-10-10 12:35:14 +02:00
|
|
|
|
|
|
|
- name: replace bashrc for copr user
|
|
|
|
copy: src="copr_bashrc" dest=/home/copr/.bashrc owner=copr group=copr mode=600
|
|
|
|
|
|
|
|
- name: auth_key so we can login to localhost as the copr user from the copr user
|
|
|
|
authorized_key: user=copr key="{{ item }}"
|
|
|
|
no_log: True
|
|
|
|
with_file:
|
|
|
|
- "provision/files/buildsys.pub"
|
|
|
|
|
|
|
|
- name: copy keystonerc
|
|
|
|
template: src="keystonerc" dest=/root/ owner=root group=root mode=600
|
|
|
|
when: not devel
|
|
|
|
|
|
|
|
- name: copy .boto file
|
|
|
|
copy: src="boto" dest=/home/copr/.boto owner=copr group=copr
|
|
|
|
|
|
|
|
# setup webserver
|
2018-10-12 01:18:24 +02:00
|
|
|
- name: add access_log.conf for lighttpd
|
2018-10-25 22:18:47 +02:00
|
|
|
copy: src="lighttpd/access_log.conf" dest=/etc/lighttpd/conf.d/access_log.conf owner=root group=root mode=0644
|
2018-10-12 01:18:24 +02:00
|
|
|
notify:
|
|
|
|
- restart lighttpd
|
|
|
|
|
2014-10-10 12:35:14 +02:00
|
|
|
- name: add config for copr-repo path
|
|
|
|
copy: src="{{ _lighttpd_conf_src }}" dest=/etc/lighttpd/lighttpd.conf owner=root group=root mode=0644
|
|
|
|
notify:
|
|
|
|
- restart lighttpd
|
|
|
|
|
|
|
|
- name: install certificates for production
|
|
|
|
when: not devel
|
2017-10-17 17:37:03 +00:00
|
|
|
import_tasks: "install_certs.yml"
|
2014-10-10 12:35:14 +02:00
|
|
|
|
2018-11-13 00:30:00 +01:00
|
|
|
- name: letsencrypt cert
|
|
|
|
import_tasks: "letsencrypt.yml"
|
|
|
|
when: devel
|
|
|
|
tags:
|
|
|
|
- config
|
|
|
|
|
2015-05-19 15:28:33 +02:00
|
|
|
- name: allow lighttpd set fds limit
|
|
|
|
seboolean: name=httpd_setrlimit state=yes persistent=yes
|
|
|
|
|
|
|
|
- name: create directory for compress module of lighttpd
|
|
|
|
file: path=/var/cache/lighttpd/compress owner=lighttpd group=lighttpd mode=0644 state=directory
|
|
|
|
|
2014-10-10 12:35:14 +02:00
|
|
|
# mime default to text/plain and enable dirlisting for indexes
|
|
|
|
- name: update lighttpd configs
|
|
|
|
copy: src="lighttpd/{{ item }}" dest="/etc/lighttpd/conf.d/{{ item }}" owner=root group=root mode=0644
|
|
|
|
with_items:
|
|
|
|
- dirlisting.conf
|
|
|
|
- mime.conf
|
|
|
|
notify:
|
|
|
|
- restart lighttpd
|
|
|
|
|
2018-02-23 17:57:12 +01:00
|
|
|
- name: provisional copr-backend cron.weekly job
|
|
|
|
copy: src="cron.weekly/copr-backend" dest="/etc/cron.weekly/copr-backend" owner=root group=root mode=0644
|
2017-12-04 21:06:49 +01:00
|
|
|
|
2017-09-21 01:39:37 +02:00
|
|
|
- name: install custom lighttpd template for directory listings
|
|
|
|
template: src="lighttpd/dir-generator.php.j2" dest="/var/lib/copr/public_html/dir-generator.php" owner=copr group=copr mode=0755
|
|
|
|
|
2017-12-18 13:02:40 +01:00
|
|
|
- name: install custom logrotate config for lighttpd
|
|
|
|
template: src="logrotate/lighttpd.j2" dest=/etc/logrotate.d/lighttpd owner=root group=root mode=644
|
|
|
|
|
2014-10-10 12:35:14 +02:00
|
|
|
- name: start webserver
|
2017-04-13 01:37:21 +00:00
|
|
|
service: state=started enabled=yes name=lighttpd
|
2014-10-10 12:35:14 +02:00
|
|
|
|
|
|
|
# setup dirs for the ansible execution off of provisioning
|
2015-04-02 12:59:59 +02:00
|
|
|
#- name: dirs from provision
|
|
|
|
# file: state=directory path="/home/copr/provision/{{ item }}" owner=copr group=copr
|
|
|
|
# with_items:
|
|
|
|
# - action_plugins
|
|
|
|
# - library
|
|
|
|
# tags:
|
|
|
|
# - provision_config
|
2014-10-10 12:35:14 +02:00
|
|
|
|
2019-05-13 11:01:39 +02:00
|
|
|
- name: resalloc
|
|
|
|
import_tasks: resalloc.yml
|
|
|
|
tags:
|
|
|
|
- resalloc
|
|
|
|
|
2014-10-10 12:35:14 +02:00
|
|
|
- name: put ansible.cfg for all this into /etc/ansible/ on the system
|
|
|
|
copy: src="provision/ansible.cfg" dest=/etc/ansible/ansible.cfg
|
|
|
|
tags:
|
|
|
|
- provision_config
|
|
|
|
|
2015-04-03 16:19:32 +02:00
|
|
|
- name: put provisioning files
|
2016-05-16 14:19:13 +02:00
|
|
|
synchronize: src="provision/" dest="/home/copr/provision/"
|
2015-04-03 16:19:32 +02:00
|
|
|
tags:
|
|
|
|
- provision_config
|
|
|
|
|
2014-10-10 12:35:14 +02:00
|
|
|
- name: put some files into the provision subdir
|
2019-05-13 15:44:57 +02:00
|
|
|
template:
|
|
|
|
src: "provision/{{ item }}"
|
2019-05-13 16:19:56 +02:00
|
|
|
dest: "/home/copr/provision/{{ item }}"
|
2019-05-13 15:44:57 +02:00
|
|
|
with_items:
|
|
|
|
- vars.yml
|
|
|
|
- nova_cloud_vars.yml
|
2014-10-10 12:35:14 +02:00
|
|
|
tags:
|
|
|
|
- provision_config
|
|
|
|
|
2017-06-08 14:56:52 +02:00
|
|
|
- name: put copr-rpmbuild configuration file into the provision subdir
|
|
|
|
template: src="provision/copr-rpmbuild/main.ini.j2" dest="/home/copr/provision/files/main.ini" owner=copr group=copr
|
2016-08-01 03:29:13 +02:00
|
|
|
tags:
|
|
|
|
- provision_config
|
2018-04-26 14:50:45 +02:00
|
|
|
|
|
|
|
- name: put rpkg configuration file into the provision subdir
|
|
|
|
template: src="provision/rpkg.conf.j2" dest="/home/copr/provision/files/rpkg.conf" owner=copr group=copr
|
|
|
|
tags:
|
|
|
|
- provision_config
|
2016-08-01 03:29:13 +02:00
|
|
|
|
2014-10-10 12:35:14 +02:00
|
|
|
- name: testing fixture
|
2015-06-16 11:17:26 +00:00
|
|
|
copy: dest="/home/copr/cloud/ec2rc.variable" content=""
|
2014-10-10 12:35:14 +02:00
|
|
|
when: devel
|
|
|
|
|
|
|
|
- name: copy copr-be.conf
|
2015-04-02 15:19:52 +02:00
|
|
|
template: src="copr-be.conf.j2" dest=/etc/copr/copr-be.conf owner=root group=copr mode=640
|
2014-10-10 12:35:14 +02:00
|
|
|
notify:
|
|
|
|
- restart copr-backend
|
|
|
|
tags:
|
|
|
|
- config
|
|
|
|
|
2015-02-03 01:53:50 +01:00
|
|
|
- name: copy sign.conf
|
2014-12-12 17:28:35 +01:00
|
|
|
template: src=sign.conf dest=/etc/sign.conf owner=root group=copr mode=640
|
|
|
|
tags:
|
|
|
|
- config
|
|
|
|
|
2015-05-19 11:50:03 +02:00
|
|
|
- name: get owner for results dir
|
|
|
|
stat: path=/var/lib/copr/public_html
|
2017-11-21 21:38:54 +00:00
|
|
|
check_mode: no
|
2015-05-19 11:50:03 +02:00
|
|
|
register: copr_results_dir_st
|
|
|
|
|
|
|
|
- name: change owner for results dir if it isn't copr
|
|
|
|
shell: "chown -R copr:copr /var/lib/copr/public_html"
|
2017-11-21 22:03:28 +00:00
|
|
|
when: '"copr" not in copr_results_dir_st.stat.pw_name'
|
2015-05-19 11:50:03 +02:00
|
|
|
|
|
|
|
- command: "ls -dZ /var/lib/copr/public_html/"
|
|
|
|
register: public_html_ls
|
2017-11-21 21:26:50 +00:00
|
|
|
check_mode: no
|
2017-11-22 00:40:49 +00:00
|
|
|
changed_when: False
|
2015-05-19 11:50:03 +02:00
|
|
|
|
|
|
|
- name: update selinux context for results if root folder does not have proper type
|
|
|
|
command: "restorecon -vvRF /var/lib/copr/public_html/"
|
2017-11-21 21:21:25 +00:00
|
|
|
when: "public_html_ls is defined and 'copr_data_t' not in public_html_ls.stdout"
|
2015-05-19 11:50:03 +02:00
|
|
|
|
|
|
|
- name: install cert to access fed-cloud09
|
|
|
|
# TODO: remove this when fed-cloud09 receives external cert
|
2017-10-17 17:37:03 +00:00
|
|
|
import_tasks: install_cloud_cert.yml
|
2015-05-19 11:50:03 +02:00
|
|
|
|
2015-03-31 17:15:09 +02:00
|
|
|
- name: enable and run copr-backend services
|
2017-04-13 01:37:21 +00:00
|
|
|
service: name="{{ item }}" enabled=yes state=started
|
2015-03-31 17:15:09 +02:00
|
|
|
with_items:
|
|
|
|
- redis # TODO: .service in copr-backend should depend on redis
|
|
|
|
- copr-backend
|
2014-10-10 12:35:14 +02:00
|
|
|
|
2015-04-13 19:58:59 +02:00
|
|
|
- copy: src="cleanup_vm_nova.py" dest=/home/copr/ mode=755
|
2014-10-10 12:35:14 +02:00
|
|
|
|
2017-04-07 09:21:18 +02:00
|
|
|
- copy: src="cleanup_vms.sh" dest=/etc/cron.hourly/copr_cleanup_vms.sh mode=755
|
|
|
|
when: not devel
|
|
|
|
|
2015-02-03 01:53:50 +01:00
|
|
|
- name: setup monitoring
|
2017-10-17 17:37:03 +00:00
|
|
|
import_tasks: "monitoring.yml"
|
2018-03-02 09:54:22 +01:00
|
|
|
|
|
|
|
# Three tasks for handling our custom selinux module
|
|
|
|
- name: ensure a directory exists for our custom selinux module
|
|
|
|
file: dest=/usr/local/share/copr state=directory
|
|
|
|
|
|
|
|
- name: copy over our custom selinux module
|
|
|
|
copy: src=selinux/copr_rules.pp dest=/usr/local/share/copr/copr_rules.pp
|
|
|
|
register: selinux_module
|
|
|
|
|
|
|
|
- name: install our custom selinux module
|
|
|
|
command: semodule -i /usr/local/share/copr/copr_rules.pp
|
2018-05-07 23:51:48 +00:00
|
|
|
when: selinux_module is changed
|
2018-12-27 15:28:07 +01:00
|
|
|
|
2019-01-09 11:21:24 +01:00
|
|
|
- name: disable swap mount in fstab
|
|
|
|
mount:
|
|
|
|
path: none
|
|
|
|
src: /dev/vdb
|
|
|
|
fstype: swap
|
|
|
|
state: absent
|
|
|
|
|
2018-12-27 15:28:07 +01:00
|
|
|
- name: disable swap so that OOM killer can do his job
|
|
|
|
command: "{{ item }}"
|
|
|
|
with_items:
|
|
|
|
- swapoff -a
|