From 72059adb1059c059e1522fbe8de6726681aea410 Mon Sep 17 00:00:00 2001 From: Evgeny Sikachev Date: Mon, 7 Aug 2017 18:12:48 +0000 Subject: [PATCH] Add playbook to run Apache2 Change-Id: Iae46bef8c7722c3a956ffba9dc0a299da116c874 --- .../ansible/roles/apache/tasks/main.yml | 32 +++++++++++++++ .../ansible/roles/jjb/tasks/main.yml | 40 ------------------- .../roles/jjb/templates/jenkins_jobs.ini.j2 | 6 --- system-configs/ansible/site.yml | 5 +++ 4 files changed, 37 insertions(+), 46 deletions(-) create mode 100644 system-configs/ansible/roles/apache/tasks/main.yml delete mode 100644 system-configs/ansible/roles/jjb/tasks/main.yml delete mode 100644 system-configs/ansible/roles/jjb/templates/jenkins_jobs.ini.j2 diff --git a/system-configs/ansible/roles/apache/tasks/main.yml b/system-configs/ansible/roles/apache/tasks/main.yml new file mode 100644 index 00000000..de543806 --- /dev/null +++ b/system-configs/ansible/roles/apache/tasks/main.yml @@ -0,0 +1,32 @@ +--- +- name: Copy files + command: cp -r /root/sahara-ci-config/system-configs/sites-available /etc/apache2/sites-available + become: true + +- name: Connection of modules + apache2_module: + name: "{{ item }}" + with_items: + - proxy + - proxy_http + - proxy_connect + - rewrite + - dav + - dav_fs + become: true + +- name: Connection of cgi modules + shell: a2dismod mpm_event | a2enmod mpm_prefork | service apache2 restart | a2enmod cgi + +- name: Restart Apache + service: + name: apache2 + state: restarted + +- name: Connection of hosts modules + shell: for host in $(/etc/apache2/sites-available/*); do sudo a2ensite $(basename $host); done + +- name: Reload Apache + service: + name: apache2 + state: reloaded diff --git a/system-configs/ansible/roles/jjb/tasks/main.yml b/system-configs/ansible/roles/jjb/tasks/main.yml deleted file mode 100644 index b1877c31..00000000 --- a/system-configs/ansible/roles/jjb/tasks/main.yml +++ /dev/null @@ -1,40 +0,0 @@ ---- -- name: Create jjb directories - file: - path: "{{ item }}" - owner: "{{ jenkins_user }}" - group: "{{ jenkins_user }}" - mode: 0755 - state: directory - with_items: - - /etc/jenkins_jobs - - "{{ ci_dir }}/jjb" - -- name: Clone jjb repo - git: - repo: "{{ jjb_git_url }}" - dest: "{{ ci_dir}}/jjb" - become: true - become_user: "{{ jenkins_user }}" - -- name: Install jjb to virtualenv - command: tox -e venv --notest - args: - chdir: "{{ ci_dir }}/jjb" - become: true - become_user: "{{ jenkins_user }}" - -- name: Copy configs - template: - src: "{{ item }}.j2" - dest: "/etc/jenkins_jobs/{{ item }}" - become: true - with_items: - - credentials.conf - - jenkins_jobs.ini - -- name: Create jjb symlink - file: - src: "{{ ci_dir }}/jenkins-job-builder/.tox/venv/bin/jenkins-jobs" - dest: /usr/local/bin/jenkins-jobs - state: link diff --git a/system-configs/ansible/roles/jjb/templates/jenkins_jobs.ini.j2 b/system-configs/ansible/roles/jjb/templates/jenkins_jobs.ini.j2 deleted file mode 100644 index 40e73a96..00000000 --- a/system-configs/ansible/roles/jjb/templates/jenkins_jobs.ini.j2 +++ /dev/null @@ -1,6 +0,0 @@ -[jenkins] -user={{ jjb_auth_username }} -password={{ jjb_auth_password }} -url=http://127.0.0.1/jenkins -[job_builder] -ignore_cache=True diff --git a/system-configs/ansible/site.yml b/system-configs/ansible/site.yml index 8b219ccc..45ba78c0 100644 --- a/system-configs/ansible/site.yml +++ b/system-configs/ansible/site.yml @@ -4,6 +4,11 @@ roles: - common +- name: Prepare Apache + hosts: localhost + roles: + - apache + - name: Install Jenkins hosts: localhost roles: