Matteo Scandolo | eb0d11c | 2017-08-08 13:05:26 -0700 | [diff] [blame] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | |
rdudyala | b086cf3 | 2016-08-11 00:07:45 -0400 | [diff] [blame] | 17 | --- |
| 18 | - name: Install Standalone ceilometer |
| 19 | hosts: local |
| 20 | vars: |
| 21 | mysql_root_password: "password" |
| 22 | sudo: yes |
| 23 | tasks: |
| 24 | # Adding cloud repo and update,upgrade |
| 25 | - name: install repository |
| 26 | apt: name=software-properties-common state=present |
| 27 | - name: Adding package to repository list |
| 28 | shell: add-apt-repository cloud-archive:mitaka |
| 29 | - name: apt update |
| 30 | apt: update_cache=yes |
| 31 | - name: apt dist-upgrade |
| 32 | apt: upgrade=dist |
| 33 | - name: installing openstack clients |
| 34 | apt: name=python-openstackclient state=present |
| 35 | #Installing Mysql Service |
| 36 | - name: Install Mysql Service |
| 37 | apt: name={{ item }} state=installed update_cache=yes |
| 38 | with_items: |
| 39 | - mariadb-server |
| 40 | - python-pymysql |
| 41 | - python-mysqldb |
| 42 | |
| 43 | - name: Copy cnf file |
| 44 | template: src=openstack.cnf.j2 dest=/etc/mysql/conf.d/openstack.cnf owner=root group=root mode=0644 |
| 45 | - name: Start the MySQL service |
| 46 | service: name=mysql state=restarted enabled=true |
| 47 | |
| 48 | # Mysql secure installation |
| 49 | # Note: Please comment this section if this playbook is not excuting first time(fix me) |
| 50 | - name: delete anonymous MySQL server user for localhost |
| 51 | action: mysql_user user="" host="localhost" state="absent" |
| 52 | - name: delete anonymous MySQL server user for localhost |
| 53 | action: mysql_user user="" state="absent" |
| 54 | - name: remove the MySQL test database |
| 55 | action: mysql_db db=test state=absent |
| 56 | |
| 57 | #Updating root permissions |
| 58 | - name: update mysql root password for all root accounts |
| 59 | sudo: yes |
| 60 | mysql_user: |
| 61 | name: root |
| 62 | host: "{{ item }}" |
| 63 | login_user: root |
| 64 | #password: "{{ mysql_root_password }}" |
| 65 | password: "password" |
| 66 | login_password: "{{ mysql_root_password }}" |
| 67 | check_implicit_admin: yes |
| 68 | priv: "*.*:ALL,GRANT" |
| 69 | with_items: |
| 70 | - "{{ ansible_hostname }}" |
| 71 | - 127.0.0.1 |
| 72 | - ::1 |
| 73 | - localhost |
| 74 | #Installing rabbitmq service |
| 75 | - name: rabbitmq-server |
| 76 | apt: name=rabbitmq-server state=present |
| 77 | - name : Adding Rabbitmq user |
| 78 | shell : rabbitmqctl add_user openstack "password";rabbitmqctl set_permissions openstack ".*" ".*" ".*" |
| 79 | |
| 80 | # Installing Keystone Service |
| 81 | - name: Creating keystone.override file |
| 82 | template: src=keystone.override.j2 dest=/etc/init/keystone.override owner=root group=root mode=0644 |
| 83 | |
| 84 | - name: Install Keystone |
| 85 | apt: name={{ item }} state=installed update_cache=yes |
| 86 | with_items: |
| 87 | - keystone |
| 88 | - apache2 |
| 89 | - libapache2-mod-wsgi |
| 90 | |
| 91 | # installing memcached |
| 92 | - name : installing memcached service |
| 93 | apt: name={{ item }} state=present |
| 94 | with_items: |
| 95 | - memcached |
| 96 | - python-memcache |
| 97 | - name: reStart the memcached service |
| 98 | service: name=memcached state=restarted enabled=true |
| 99 | #editing memcache conf file |
| 100 | - name: Adding new line |
| 101 | lineinfile: dest=/etc/memcached.conf line="-l 127.0.0.1" |
| 102 | - name: Restart memcached service |
| 103 | service: name=memcached state=restarted enabled=true |
| 104 | - name: Keystone create DB for service |
| 105 | mysql_db: |
| 106 | login_user: "root" |
| 107 | login_password: "password" |
| 108 | login_host: "localhost" |
| 109 | name: "keystone" |
| 110 | state: "present" |
| 111 | - name: Keystone grant access to the DB for the service |
| 112 | mysql_user: |
| 113 | login_user: "root" |
| 114 | login_password: "password" |
| 115 | login_host: "localhost" |
| 116 | name: "keystone" |
| 117 | password: "password" |
| 118 | host: "{{ item }}" |
| 119 | state: "present" |
| 120 | priv: "keystone.*:ALL" |
| 121 | with_items: |
| 122 | - "localhost" |
| 123 | - "%" |
| 124 | # Installing Keystone Service |
| 125 | - name: Creating keystone.override file |
| 126 | template: src=keystone.override.j2 dest=/etc/init/keystone.override owner=root group=root mode=0644 |
| 127 | |
| 128 | - name: Install Keystone |
| 129 | apt: name={{ item }} state=installed update_cache=yes |
| 130 | with_items: |
| 131 | - keystone |
| 132 | - apache2 |
| 133 | - libapache2-mod-wsgi |
| 134 | - name: Creating keystone.conf |
| 135 | template: src=keystone.conf.j2 dest=/etc/keystone/keystone.conf owner=root group=root mode=0644 |
| 136 | - name: Running sync database |
| 137 | shell: /bin/sh -c "keystone-manage db_sync" keystone |
| 138 | - name: initializing fernet keystone |
| 139 | shell: keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone |
| 140 | # Configuring apache server |
| 141 | - name: Adding new line |
| 142 | lineinfile: dest=/etc/apache2/apache2.conf line="ServerName localhost" |
| 143 | |
| 144 | - name: Creating wsgi-keystone.conf |
| 145 | template: src=wsgi-keystone.conf.j2 dest=/etc/apache2/sites-available/wsgi-keystone.conf owner=root group=root mode=0644 |
| 146 | - name : Configuring apache2 |
| 147 | shell: ln -s /etc/apache2/sites-available/wsgi-keystone.conf /etc/apache2/sites-enabled |
| 148 | ignore_errors: yes |
| 149 | - name: Restart apache2 service |
| 150 | service: name=apache2 state=restarted enabled=true |
| 151 | - name : removing previous databases |
| 152 | shell: rm -f /var/lib/keystone/keystone.db |
| 153 | #Installing mongod db server |
| 154 | - name: Install the Mongo db server |
| 155 | apt: name={{ item }} state=installed update_cache=yes |
| 156 | with_items: |
| 157 | - mongodb-server |
| 158 | - mongodb-clients |
| 159 | - python-pymongo |
| 160 | - name: Creating mongodb.conf |
| 161 | template: src=mongodb.conf.j2 dest=/etc/mongodb.conf owner=root group=root mode=0644 |
| 162 | - name: Stopping mongodb service |
| 163 | service: name=mongodb state=stopped |
| 164 | - name: Removing mongodb files |
| 165 | shell: rm -rf /var/lib/mongodb/journal/prealloc.* |
| 166 | - name: starting mongodb service |
| 167 | service: name=mongodb state=started |
| 168 | - name : Configuring users |
| 169 | script: configure_users_mitaka.sh |
| 170 | - name: Adding ceilometer database |
| 171 | script: mongo_user.sh |
| 172 | #mongodb_user: database=ceilometer name=ceilometer password=password roles='readWrite,userAdmin' state=present |
| 173 | #Installing Ceilometer Services |
| 174 | - name : Install Ceilometer services |
| 175 | apt: name={{ item }} state=installed update_cache=yes |
| 176 | with_items: |
| 177 | - ceilometer-api |
Srikanth Vavilapalli | 0d483e5 | 2017-01-31 05:21:08 +0000 | [diff] [blame] | 178 | # - ceilometer-collector ---> This service is not needed as ceilometer support direct publishing to database |
rdudyala | b086cf3 | 2016-08-11 00:07:45 -0400 | [diff] [blame] | 179 | - ceilometer-agent-central |
| 180 | - ceilometer-agent-notification |
| 181 | - python-ceilometerclient |
| 182 | |
| 183 | - name: Creating Ceilometer.conf |
| 184 | template: src=ceilometer.conf.j2 dest=/etc/ceilometer/ceilometer.conf owner=root group=root mode=0644 |
| 185 | |
| 186 | - name: Restarting ceilometer-agent-central |
| 187 | service: name=ceilometer-agent-central state=restarted |
| 188 | |
| 189 | - name: Restarting ceilometer-agent-notification |
| 190 | service: name=ceilometer-agent-notification state=restarted |
| 191 | |
| 192 | - name: Restarting Celometer API |
| 193 | service: name=ceilometer-api state=restarted |
| 194 | |
Srikanth Vavilapalli | 0d483e5 | 2017-01-31 05:21:08 +0000 | [diff] [blame] | 195 | # - name: Restarting ceilometer-collector |
| 196 | # service: name=ceilometer-collector state=restarted |