--- - name: install base packages yum: name={{ item }} state=present with_items: - wget - git - name: check epel presence command: rpm -q epel-release register: epel_presence ignore_errors: yes - name: check atomic repo presence command: rpm -q atomic-release register: atomic_presence ignore_errors: yes #- name: get epel version # command: 'wget -q {{ epel_base_url }} -O - |grep -oE "(href=\"epel-release-6-[0-9,.].*)" | cut -d'"' -f2' # register: epel_file_name # when: epel_presence.rc != 0 - name: install epel yum: name={{ epel_base_url }}/{{ epel_file_name }} state=present when: epel_presence.rc != 0 - name: install atomic repo yum: name={{ atomic_base_url }}/{{ atomic_file_name }} state=present when: atomic_presence.rc != 0 - name: yum update yum: name=* state=latest - name: install essentials yum: name={{ item }} state=present with_items: - git - python-setuptools - python-devel - mysql-devel - httpd - mysql-server - mysql - MySQL-python - redis - mod_wsgi - rabbitmq-server - name: stop iptables service: name=iptables state=stopped enabled=no - name: disable selinux selinux: state=disabled - name: disable selinux real time shell: echo 0 > /selinux/enforce # TODO: currently compass use root user and group, apache has to # be in root group to write wsgi logs in /var/log/compass/, need # to run compass as its own user in the future. # - name: append compass group to apache user groups # user: name=apache groups=root append=yes - name: start mysqld service: name=mysqld state=started enabled=yes - name: start rabbitmq server service: name=rabbitmq-server state=started enabled=yes - name: initialize mysql password mysql_user: user={{ compass_db_user }} password={{ compass_db_pass }} priv=compass.*:ALL,GRANT state=present - name: create compass database mysql_db: name=compass state=present - name: install pip easy_install: name=pip - name: install virtualenv pip: name=virtualenv - name: cloning compass-core git: repo=http://git.openstack.org/stackforge/compass-core.git dest={{ COMPASS_PATH }} version=dev/experimental force=yes - name: pip install compass into virtualenv pip: name={{ COMPASS_PATH }} virtualenv={{ COMPASS_PATH }}/venv - name: create compass directories file: path={{ item }} state=directory with_items: - /etc/compass - /opt/compass/bin - /var/www/compass - /var/www/compass_web - name: create /var/log/compass file: path=/var/log/compass mode=0777 state=directory - name: write python home into switch virtualenv lineinfile: dest={{ COMPASS_PATH }}/bin/switch_virtualenv.py.template regexp="^virtual\_env\ \=\ \'\$PythonHome\'" line="virtual_env = '/opt/compass-core/venv'" - name: rename switch_virtualenv template command: cp {{ COMPASS_PATH }}/bin/switch_virtualenv.py.template {{ COMPASS_PATH }}/bin/switch_virtualenv.py - name: copy compass config files shell: cp -rf {{ COMPASS_PATH }}/conf/* /etc/compass/ - name: copy service init file shell: cp -rf {{ COMPASS_PATH }}/service/* /etc/init.d/ - name: copy compass bin file shell: cp -rf {{ COMPASS_PATH }}/bin/*.py /opt/compass/bin/ - name: copy compass shell script shell: cp -rf {{ COMPASS_PATH }}/bin/*.sh /opt/compass/bin/ - name: copy compass executable shell: cp {{ COMPASS_PATH }}/bin/compassd /usr/bin/ - name: link compass check file: src=/opt/compass/bin/compass_check.py dest=/usr/bin/compass state=link - name: link compass wsgi file: src=/opt/compass/bin/compass_wsgi.py dest=/var/www/compass/compass.wsgi state=link - name: change celery env shell: echo "export C_FORCE_ROOT=1" > /etc/profile.d/celery_env.sh - name: change file mode file: path=/etc/profile.d/celery_env.sh mode=0755 - name: pip install compass into virtualenv pip: name={{ COMPASS_PATH }} virtualenv={{ COMPASS_PATH }}/venv - name: add compass setting template: src=compass.setting.j2 dest=/etc/compass/setting notify: - restart compass service - restart http service tags: debug - name: add cobbler setting template: src=cobbler.conf.nodocker.j2 dest=/etc/compass/os_installer/cobbler.conf notify: - restart compass service - restart http service - name: link celery bin file file: src={{ COMPASS_PATH }}/venv/bin/celery dest=/opt/compass/bin/celery state=link notify: - restart compass service - restart http service - name: create redis folders file: path={{ item }} state=directory owner=redis group=root with_items: - /var/log/redis - /var/lib/redis - /var/run/redis - name: make sure redis service not running command: killall -9 redis-server ignore_errors: yes - name: restart redis service service: name=redis state=restarted enabled=yes - name: initialize db for compass shell: /opt/compass/bin/manage_db.py createdb run_once: True - name: copy ods-server httpd config copy: src=ods-server.conf dest=/etc/httpd/conf.d/ods-server.conf notify: restart http service - name: clone compass web git: repo=http://git.openstack.org/stackforge/compass-web.git dest=/opt/compass-web force=yes - name: copy web ui files shell: cp -rf /opt/compass-web/v2 /var/www/compass_web/ - name: create switch file if test mode enabled template: src=switch_machines_file.j2 dest=/etc/compass/switch_machines_file when: test is defined and test == True - name: inject switches and mac addresses shell: /opt/compass/bin/manage_db.py set_switch_machines --switch_machines_file /etc/compass/switch_machines_file when: test is defined and test == True #- name: run compass check # command: compass check