diff options
author | liyuenan <liyuenan@huawei.com> | 2016-12-22 16:59:08 +0800 |
---|---|---|
committer | liyuenan <liyuenan@huawei.com> | 2016-12-26 17:54:43 +0800 |
commit | 6072a49adb33f2bce3f48b9c7b8be7d96cf8501c (patch) | |
tree | a78a15b915741bb3ef7ddd4a61a801dd9f46d577 | |
parent | a9041dbf7b68f56169e82de3c37601b7e86867b0 (diff) |
Update ansible version
JIRA: COMPASS-511
Change-Id: Id0e83c65a08c9f9036b5d3a597b905e8a7bde6e8
Signed-off-by: liyuenan <liyuenan@huawei.com>
66 files changed, 339 insertions, 186 deletions
diff --git a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml index 236035e0..4e85568c 100644 --- a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml +++ b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml @@ -34,7 +34,7 @@ - authorized_key: user: root - key: "{{ lookup('file', 'item') }}" + key: "{{ lookup('file', item) }}" with_fileglob: - /tmp/ssh-keys-* max_fail_percentage: 0 @@ -43,21 +43,18 @@ - hosts: all remote_user: root - accelerate: true max_fail_percentage: 0 roles: - setup-network - hosts: ha remote_user: root - accelerate: true max_fail_percentage: 0 roles: - ha - hosts: controller remote_user: root - accelerate: true max_fail_percentage: 0 roles: - memcached @@ -78,14 +75,12 @@ - hosts: all remote_user: root - accelerate: true max_fail_percentage: 0 roles: - storage - hosts: compute remote_user: root - accelerate: true max_fail_percentage: 0 roles: - nova-compute @@ -95,28 +90,24 @@ #- hosts: all # remote_user: root -# accelerate: true -# max_fail_percentage: 0 +## max_fail_percentage: 0 # roles: # - moon - hosts: all remote_user: root - accelerate: true max_fail_percentage: 0 roles: - secgroup - hosts: ceph_adm remote_user: root - accelerate: true max_fail_percentage: 0 roles: [] # - ceph-deploy - hosts: ceph remote_user: root - accelerate: true max_fail_percentage: 0 roles: - ceph-purge @@ -124,28 +115,24 @@ - hosts: ceph_mon remote_user: root - accelerate: true max_fail_percentage: 0 roles: - ceph-mon - hosts: ceph_osd remote_user: root - accelerate: true max_fail_percentage: 0 roles: - ceph-osd - hosts: ceph remote_user: root - accelerate: true max_fail_percentage: 0 roles: - ceph-openstack - hosts: all remote_user: root - accelerate: true max_fail_percentage: 0 roles: - monitor @@ -153,7 +140,6 @@ - hosts: all remote_user: root - accelerate: true max_fail_percentage: 0 tasks: - name: set bash to nova @@ -190,7 +176,7 @@ - authorized_key: user: nova - key: "{{ lookup('file', 'item') }}" + key: "{{ lookup('file', item) }}" with_fileglob: - /tmp/ssh-keys-* @@ -200,14 +186,12 @@ - hosts: all remote_user: root - accelerate: true max_fail_percentage: 0 roles: - odl_cluster - hosts: all remote_user: root - accelerate: true max_fail_percentage: 0 roles: - onos_cluster @@ -221,7 +205,6 @@ - hosts: all remote_user: root - accelerate: true serial: 1 max_fail_percentage: 0 roles: @@ -229,35 +212,30 @@ - hosts: all remote_user: root - accelerate: true max_fail_percentage: 0 roles: - odl_cluster_post - hosts: controller remote_user: root - accelerate: true max_fail_percentage: 0 roles: - ext-network - hosts: controller remote_user: root - accelerate: true max_fail_percentage: 0 roles: - boot-recovery - hosts: controller remote_user: root - accelerate: true max_fail_percentage: 0 roles: - controller-recovery - hosts: compute remote_user: root - accelerate: true max_fail_percentage: 0 roles: - compute-recovery diff --git a/deploy/adapters/ansible/roles/aodh/handlers/main.yml b/deploy/adapters/ansible/roles/aodh/handlers/main.yml index b3399e0c..a652ea4b 100644 --- a/deploy/adapters/ansible/roles/aodh/handlers/main.yml +++ b/deploy/adapters/ansible/roles/aodh/handlers/main.yml @@ -9,5 +9,5 @@ --- - name: restart aodh services service: name={{ item }} state=restarted enabled=yes - with_items: services | union(services_noarch) + with_items: "{{ services | union(services_noarch) }}" diff --git a/deploy/adapters/ansible/roles/aodh/tasks/aodh_install.yml b/deploy/adapters/ansible/roles/aodh/tasks/aodh_install.yml index d8a82270..4b86f7fd 100644 --- a/deploy/adapters/ansible/roles/aodh/tasks/aodh_install.yml +++ b/deploy/adapters/ansible/roles/aodh/tasks/aodh_install.yml @@ -11,7 +11,7 @@ - name: install aodh packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: packages | union(packages_noarch) + with_items: "{{ packages | union(packages_noarch) }}" - name: update aodh conf template: src={{ item }} dest=/etc/aodh/aodh.conf backup=yes @@ -22,7 +22,7 @@ - name: write services to monitor list lineinfile: dest=/opt/service create=yes line='{{ item }}' - with_items: services | union(services_noarch) + with_items: "{{ services | union(services_noarch) }}" - name: remove default sqlite db shell: rm /var/lib/aodh/aodh.sqlite || touch aodh.sqllite.db.removed diff --git a/deploy/adapters/ansible/roles/apache/handlers/main.yml b/deploy/adapters/ansible/roles/apache/handlers/main.yml index 0f28dc24..53e600dd 100755 --- a/deploy/adapters/ansible/roles/apache/handlers/main.yml +++ b/deploy/adapters/ansible/roles/apache/handlers/main.yml @@ -9,4 +9,4 @@ --- - name: restart apache related services service: name={{ item }} state=restarted enabled=yes - with_items: services| union(services_noarch) + with_items: "{{ services| union(services_noarch) }}" diff --git a/deploy/adapters/ansible/roles/apache/tasks/main.yml b/deploy/adapters/ansible/roles/apache/tasks/main.yml index 7053229a..f87633a6 100755 --- a/deploy/adapters/ansible/roles/apache/tasks/main.yml +++ b/deploy/adapters/ansible/roles/apache/tasks/main.yml @@ -11,7 +11,7 @@ - name: install packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest update_cache=yes" - with_items: packages | union(packages_noarch) + with_items: "{{ packages | union(packages_noarch) }}" - name: assure listen port exist template: diff --git a/deploy/adapters/ansible/roles/boot-recovery/tasks/main.yml b/deploy/adapters/ansible/roles/boot-recovery/tasks/main.yml index 67206bf6..695779f7 100755 --- a/deploy/adapters/ansible/roles/boot-recovery/tasks/main.yml +++ b/deploy/adapters/ansible/roles/boot-recovery/tasks/main.yml @@ -19,7 +19,7 @@ - name: stop controller services service: name={{ item }} state=stopped enabled=yes - with_items: controller_services | union(controller_services_noarch) + with_items: "{{ controller_services | union(controller_services_noarch) }}" when: RECOVERY_ENV tags: - recovery-stop-service diff --git a/deploy/adapters/ansible/roles/ceilometer_compute/handlers/main.yml b/deploy/adapters/ansible/roles/ceilometer_compute/handlers/main.yml index 10b7c683..78178130 100644 --- a/deploy/adapters/ansible/roles/ceilometer_compute/handlers/main.yml +++ b/deploy/adapters/ansible/roles/ceilometer_compute/handlers/main.yml @@ -9,8 +9,8 @@ --- - name: restart ceilometer service service: name={{ item }} state=restarted enabled=yes - with_items: ceilometer_services + with_items: "{{ ceilometer_services }}" - name: restart nova service service: name={{ item }} state=restarted enabled=yes - with_items: nova_services + with_items: "{{ nova_services }}" diff --git a/deploy/adapters/ansible/roles/ceilometer_compute/tasks/ceilometer_config.yml b/deploy/adapters/ansible/roles/ceilometer_compute/tasks/ceilometer_config.yml index b429d65b..9b487def 100644 --- a/deploy/adapters/ansible/roles/ceilometer_compute/tasks/ceilometer_config.yml +++ b/deploy/adapters/ansible/roles/ceilometer_compute/tasks/ceilometer_config.yml @@ -31,7 +31,7 @@ - name: write services to monitor list lineinfile: dest=/opt/service create=yes line='{{ item }}' - with_items: ceilometer_services + with_items: "{{ ceilometer_services }}" - meta: flush_handlers diff --git a/deploy/adapters/ansible/roles/ceilometer_compute/tasks/ceilometer_install.yml b/deploy/adapters/ansible/roles/ceilometer_compute/tasks/ceilometer_install.yml index 0f2ba3d2..b1d86f8d 100644 --- a/deploy/adapters/ansible/roles/ceilometer_compute/tasks/ceilometer_install.yml +++ b/deploy/adapters/ansible/roles/ceilometer_compute/tasks/ceilometer_install.yml @@ -18,7 +18,7 @@ - name: install ceilometer packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: ceilometer_packages | union(packages_noarch) + with_items: "{{ ceilometer_packages | union(packages_noarch) }}" - name: enable auto start file: diff --git a/deploy/adapters/ansible/roles/ceilometer_controller/handlers/main.yml b/deploy/adapters/ansible/roles/ceilometer_controller/handlers/main.yml index a3bfb85d..1507c6e9 100644 --- a/deploy/adapters/ansible/roles/ceilometer_controller/handlers/main.yml +++ b/deploy/adapters/ansible/roles/ceilometer_controller/handlers/main.yml @@ -9,11 +9,11 @@ --- - name: restart ceilometer service service: name={{ item }} state=restarted enabled=yes - with_items: ceilometer_services + with_items: "{{ ceilometer_services }}" - name: restart glance_cinder service service: name={{ item }} state=restarted enabled=yes - with_items: glance_cinder_services + with_items: "{{ glance_cinder_services }}" - name: reload apache server service: name=apache2 state=reloaded diff --git a/deploy/adapters/ansible/roles/ceilometer_controller/tasks/ceilometer_config.yml b/deploy/adapters/ansible/roles/ceilometer_controller/tasks/ceilometer_config.yml index 7f5209c1..694cc0dd 100644 --- a/deploy/adapters/ansible/roles/ceilometer_controller/tasks/ceilometer_config.yml +++ b/deploy/adapters/ansible/roles/ceilometer_controller/tasks/ceilometer_config.yml @@ -66,6 +66,6 @@ - name: write services to monitor list lineinfile: dest=/opt/service create=yes line='{{ item }}' - with_items: ceilometer_services + with_items: "{{ ceilometer_services }}" - meta: flush_handlers diff --git a/deploy/adapters/ansible/roles/ceilometer_controller/tasks/ceilometer_install.yml b/deploy/adapters/ansible/roles/ceilometer_controller/tasks/ceilometer_install.yml index 0f2ba3d2..b1d86f8d 100644 --- a/deploy/adapters/ansible/roles/ceilometer_controller/tasks/ceilometer_install.yml +++ b/deploy/adapters/ansible/roles/ceilometer_controller/tasks/ceilometer_install.yml @@ -18,7 +18,7 @@ - name: install ceilometer packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: ceilometer_packages | union(packages_noarch) + with_items: "{{ ceilometer_packages | union(packages_noarch) }}" - name: enable auto start file: diff --git a/deploy/adapters/ansible/roles/cinder-controller/handlers/main.yml b/deploy/adapters/ansible/roles/cinder-controller/handlers/main.yml index 93bffe79..541bf8d5 100644 --- a/deploy/adapters/ansible/roles/cinder-controller/handlers/main.yml +++ b/deploy/adapters/ansible/roles/cinder-controller/handlers/main.yml @@ -9,5 +9,5 @@ --- - name: restart cinder control serveice service: name={{ item }} state=restarted enabled=yes - with_items: services | union(services_noarch) + with_items: "{{ services | union(services_noarch) }}" diff --git a/deploy/adapters/ansible/roles/cinder-controller/tasks/cinder_install.yml b/deploy/adapters/ansible/roles/cinder-controller/tasks/cinder_install.yml index d41094da..0a0d57f3 100644 --- a/deploy/adapters/ansible/roles/cinder-controller/tasks/cinder_install.yml +++ b/deploy/adapters/ansible/roles/cinder-controller/tasks/cinder_install.yml @@ -16,7 +16,7 @@ - name: install cinder packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: packages | union(packages_noarch) + with_items: "{{ packages | union(packages_noarch) }}" - name: enable auto start file: @@ -26,7 +26,7 @@ - name: generate common cinder service list lineinfile: dest=/opt/service create=yes line='{{ item }}' - with_items: services | union(services_noarch) + with_items: "{{ services | union(services_noarch) }}" - name: upload cinder conf template: src=cinder.conf dest=/etc/cinder/cinder.conf diff --git a/deploy/adapters/ansible/roles/cinder-volume/handlers/main.yml b/deploy/adapters/ansible/roles/cinder-volume/handlers/main.yml index f841a63a..c7ec8d8e 100644 --- a/deploy/adapters/ansible/roles/cinder-volume/handlers/main.yml +++ b/deploy/adapters/ansible/roles/cinder-volume/handlers/main.yml @@ -9,4 +9,4 @@ --- - name: restart cinder-volume services service: name={{ item }} state=restarted enabled=yes - with_items: services | union(services_noarch) + with_items: "{{ services | union(services_noarch) }}" diff --git a/deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml b/deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml index f3f40c12..29256d9c 100644 --- a/deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml +++ b/deploy/adapters/ansible/roles/cinder-volume/tasks/main.yml @@ -18,7 +18,7 @@ - name: install cinder-volume and lvm2 packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: packages | union(packages_noarch) + with_items: "{{ packages | union(packages_noarch) }}" - name: enable auto start file: @@ -28,7 +28,7 @@ - name: generate cinder volume service list lineinfile: dest=/opt/service create=yes line='{{ item }}' - with_items: services | union(services_noarch) + with_items: "{{ services | union(services_noarch) }}" - name: upload cinder-volume configuration template: src=cinder.conf dest=/etc/cinder/cinder.conf diff --git a/deploy/adapters/ansible/roles/common/tasks/main.yml b/deploy/adapters/ansible/roles/common/tasks/main.yml index 1fa0de84..0e19c004 100644 --- a/deploy/adapters/ansible/roles/common/tasks/main.yml +++ b/deploy/adapters/ansible/roles/common/tasks/main.yml @@ -41,7 +41,7 @@ - name: install packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest update_cache=yes" - with_items: packages | union(packages_noarch) + with_items: "{{ packages | union(packages_noarch) }}" - name: make config template dir exist file: path=/opt/os_templates state=directory mode=0755 @@ -57,7 +57,7 @@ - name: install pip packages pip: name={{ item }} state=present extra_args='--pre' - with_items: pip_packages + with_items: "{{ pip_packages }}" - name: install keyczar for accelerate pip: name=python-keyczar state=present extra_args='--pre' @@ -82,11 +82,11 @@ - name: restart services service: name={{ item }} state=restarted enabled=yes - with_items: services| union(services_noarch) + with_items: "{{ services| union(services_noarch) }}" - name: write services to monitor list lineinfile: dest=/opt/service create=yes line='{{ item }}' - with_items: services| union(services_noarch) + with_items: "{{ services| union(services_noarch) }}" - name: kill daemon for accelerate shell: lsof -ni :5099|grep LISTEN|awk '{print $2}'|xargs kill -9 diff --git a/deploy/adapters/ansible/roles/compute-recovery/tasks/main.yml b/deploy/adapters/ansible/roles/compute-recovery/tasks/main.yml index b333b9e0..e67d0088 100644 --- a/deploy/adapters/ansible/roles/compute-recovery/tasks/main.yml +++ b/deploy/adapters/ansible/roles/compute-recovery/tasks/main.yml @@ -19,7 +19,7 @@ - name: restart compute services service: name={{ item }} state=restarted enabled=yes - with_items: compute_services | union(compute_services_noarch) + with_items: "{{ compute_services | union(compute_services_noarch) }}" when: RECOVERY_ENV tags: - recovery diff --git a/deploy/adapters/ansible/roles/controller-recovery/tasks/main.yml b/deploy/adapters/ansible/roles/controller-recovery/tasks/main.yml index ccf3e46b..c5d2e959 100644 --- a/deploy/adapters/ansible/roles/controller-recovery/tasks/main.yml +++ b/deploy/adapters/ansible/roles/controller-recovery/tasks/main.yml @@ -19,7 +19,7 @@ - name: restart controller services service: name={{ item }} state=restarted enabled=yes - with_items: controller_services | union(controller_services_noarch) + with_items: "{{ controller_services | union(controller_services_noarch) }}" when: RECOVERY_ENV tags: - recovery diff --git a/deploy/adapters/ansible/roles/dashboard/handlers/main.yml b/deploy/adapters/ansible/roles/dashboard/handlers/main.yml index 62e0b8e5..8e28bbf6 100755 --- a/deploy/adapters/ansible/roles/dashboard/handlers/main.yml +++ b/deploy/adapters/ansible/roles/dashboard/handlers/main.yml @@ -9,4 +9,4 @@ --- - name: restart dashboard services service: name={{ item }} state=restarted enabled=yes - with_items: services | union(services_noarch) + with_items: "{{ services | union(services_noarch) }}" diff --git a/deploy/adapters/ansible/roles/dashboard/tasks/main.yml b/deploy/adapters/ansible/roles/dashboard/tasks/main.yml index 9be6fd6c..4f8ccad0 100644 --- a/deploy/adapters/ansible/roles/dashboard/tasks/main.yml +++ b/deploy/adapters/ansible/roles/dashboard/tasks/main.yml @@ -18,7 +18,7 @@ - name: install dashboard packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: packages | union(packages_noarch) + with_items: "{{ packages | union(packages_noarch) }}" - name: enable auto start file: diff --git a/deploy/adapters/ansible/roles/database/tasks/mariadb_install.yml b/deploy/adapters/ansible/roles/database/tasks/mariadb_install.yml index 1b08172d..d1897173 100644 --- a/deploy/adapters/ansible/roles/database/tasks/mariadb_install.yml +++ b/deploy/adapters/ansible/roles/database/tasks/mariadb_install.yml @@ -22,7 +22,7 @@ - name: install python-mysqldb action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: maridb_packages | union(packages_noarch) + with_items: "{{ maridb_packages | union(packages_noarch) }}" - name: create conf dir for wsrep file: path=/etc/my.cnf.d state=directory mode=0755 @@ -34,7 +34,7 @@ dest: '{{ item.dest }}' backup: yes mode: 0644 - with_items: mysql_config + with_items: "{{ mysql_config }}" - name: bugfix for rsync version 3.1 lineinfile: diff --git a/deploy/adapters/ansible/roles/database/tasks/mongodb_config.yml b/deploy/adapters/ansible/roles/database/tasks/mongodb_config.yml index 0a449f86..76aa5675 100755 --- a/deploy/adapters/ansible/roles/database/tasks/mongodb_config.yml +++ b/deploy/adapters/ansible/roles/database/tasks/mongodb_config.yml @@ -36,9 +36,20 @@ - debug: msg='{{ servers.stdout |int }}' +- name: Add admin user + mongodb_user: + login_host: "{{ internal_vip.ip }}" + database: admin + name: root + password: root + roles: 'root' + state: present + - name: create mongodb user and db mongodb_user: login_host: "{{ internal_vip.ip }}" + login_user: root + login_password: root database: ceilometer name: ceilometer password: "{{ CEILOMETER_DBPASS }}" @@ -48,6 +59,8 @@ - name: grant user privilege mongodb_user: login_host: "{{ internal_vip.ip }}" + login_user: root + login_password: root database: ceilometer name: ceilometer password: "{{ CEILOMETER_DBPASS }}" diff --git a/deploy/adapters/ansible/roles/database/tasks/mongodb_install.yml b/deploy/adapters/ansible/roles/database/tasks/mongodb_install.yml index dea15a83..bac6c6eb 100755 --- a/deploy/adapters/ansible/roles/database/tasks/mongodb_install.yml +++ b/deploy/adapters/ansible/roles/database/tasks/mongodb_install.yml @@ -9,11 +9,11 @@ --- - name: install mongodb packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: mongodb_packages | union(packages_noarch) + with_items: "{{ mongodb_packages | union(packages_noarch) }}" - name: install pymongod packages pip: name={{ item }} state=present extra_args='--pre' - with_items: pip_packages + with_items: "{{ pip_packages }}" - name: copy ceilometer configs template: src=mongodb.conf dest=/opt/os_templates backup=yes diff --git a/deploy/adapters/ansible/roles/ext-network/tasks/main.yml b/deploy/adapters/ansible/roles/ext-network/tasks/main.yml index f68105f1..10b33b5f 100644 --- a/deploy/adapters/ansible/roles/ext-network/tasks/main.yml +++ b/deploy/adapters/ansible/roles/ext-network/tasks/main.yml @@ -37,6 +37,7 @@ neutron subnet-create \ --name {{ public_net_info.subnet }} \ --gateway {{ public_net_info.external_gw }} \ + --disable-dhcp \ --allocation-pool \ start={{ public_net_info.floating_ip_start }},end={{ public_net_info.floating_ip_end }} \ {{ public_net_info.network }} {{ public_net_info.floating_ip_cidr }} diff --git a/deploy/adapters/ansible/roles/glance/handlers/main.yml b/deploy/adapters/ansible/roles/glance/handlers/main.yml index 53ee01c1..22f31cea 100644 --- a/deploy/adapters/ansible/roles/glance/handlers/main.yml +++ b/deploy/adapters/ansible/roles/glance/handlers/main.yml @@ -9,4 +9,4 @@ --- - name: restart glance services service: name={{ item }} state=restarted enabled=yes - with_items: services | union(services_noarch) + with_items: "{{ services | union(services_noarch) }}" diff --git a/deploy/adapters/ansible/roles/glance/tasks/glance_install.yml b/deploy/adapters/ansible/roles/glance/tasks/glance_install.yml index a4783630..9c95546d 100644 --- a/deploy/adapters/ansible/roles/glance/tasks/glance_install.yml +++ b/deploy/adapters/ansible/roles/glance/tasks/glance_install.yml @@ -9,11 +9,11 @@ --- - name: install glance packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest" - with_items: packages | union(packages_noarch) + with_items: "{{ packages | union(packages_noarch) }}" - name: generate glance service list lineinfile: dest=/opt/service create=yes line='{{ item }}' - with_items: services | union(services_noarch) + with_items: "{{ services | union(services_noarch) }}" - name: update glance conf template: src={{ item }} dest=/etc/glance/{{ item }} diff --git a/deploy/adapters/ansible/roles/glance/tasks/nfs.yml b/deploy/adapters/ansible/roles/glance/tasks/nfs.yml index 39a49dc1..f0176c89 100644 --- a/deploy/adapters/ansible/roles/glance/tasks/nfs.yml +++ b/deploy/adapters/ansible/roles/glance/tasks/nfs.yml @@ -9,7 +9,7 @@ --- - name: install nfs packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: nfs_packages + with_items: "{{ nfs_packages }}" - name: install nfs local_action: yum name={{ item }} state=present diff --git a/deploy/adapters/ansible/roles/ha/tasks/main.yml b/deploy/adapters/ansible/roles/ha/tasks/main.yml index 1a4c8bad..e2f172e7 100644 --- a/deploy/adapters/ansible/roles/ha/tasks/main.yml +++ b/deploy/adapters/ansible/roles/ha/tasks/main.yml @@ -11,11 +11,11 @@ - name: install keepalived xinet haproxy action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: packages | union(packages_noarch) + with_items: "{{ packages | union(packages_noarch) }}" - name: generate ha service list lineinfile: dest=/opt/service create=yes line='{{ item }}' - with_items: services | union(services_noarch) + with_items: "{{ services | union(services_noarch) }}" - name: install pexpect pip: name=pexpect state=present extra_args='--pre' diff --git a/deploy/adapters/ansible/roles/heat/handlers/main.yml b/deploy/adapters/ansible/roles/heat/handlers/main.yml index 6cc567f0..77946a51 100644 --- a/deploy/adapters/ansible/roles/heat/handlers/main.yml +++ b/deploy/adapters/ansible/roles/heat/handlers/main.yml @@ -9,7 +9,7 @@ --- - name: restart heat service service: name={{ item }} state=restarted enabled=yes - with_items: services | union(services_noarch) + with_items: "{{ services | union(services_noarch) }}" - name: remove heat-sqlite-db shell: rm /var/lib/heat/heat.sqlite || touch heat.sqlite.db.removed diff --git a/deploy/adapters/ansible/roles/heat/tasks/heat_install.yml b/deploy/adapters/ansible/roles/heat/tasks/heat_install.yml index 6a0f1c73..15334d40 100644 --- a/deploy/adapters/ansible/roles/heat/tasks/heat_install.yml +++ b/deploy/adapters/ansible/roles/heat/tasks/heat_install.yml @@ -11,13 +11,11 @@ - name: install heat related packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: packages | union(packages_noarch) + with_items: "{{ packages | union(packages_noarch) }}" - name: generate heat service list lineinfile: dest=/opt/service create=yes line='{{ item }}' - with_items: services | union(services_noarch) - -# ' + with_items: "{{ services | union(services_noarch) }}" - name: create heat user domain shell: > diff --git a/deploy/adapters/ansible/roles/keystone/handlers/main.yml b/deploy/adapters/ansible/roles/keystone/handlers/main.yml index 608a8a09..82c1a553 100755 --- a/deploy/adapters/ansible/roles/keystone/handlers/main.yml +++ b/deploy/adapters/ansible/roles/keystone/handlers/main.yml @@ -9,4 +9,4 @@ --- - name: restart keystone services service: name={{ item }} state=restarted enabled=yes - with_items: services | union(services_noarch) + with_items: "{{ services | union(services_noarch) }}" diff --git a/deploy/adapters/ansible/roles/keystone/tasks/keystone_config.yml b/deploy/adapters/ansible/roles/keystone/tasks/keystone_config.yml index ea211470..33892c5f 100644 --- a/deploy/adapters/ansible/roles/keystone/tasks/keystone_config.yml +++ b/deploy/adapters/ansible/roles/keystone/tasks/keystone_config.yml @@ -41,7 +41,7 @@ --delete \ /etc/keystone/fernet-keys \ root@{{ hostvars[ item ].ansible_eth0.ipv4.address }}:/etc/keystone/ - with_items: groups['controller'][1:] + with_items: "{{ groups['controller'][1:] }}" notify: - restart keystone services @@ -74,7 +74,7 @@ --delete \ /etc/keystone/credential-keys \ root@{{ hostvars[ item ].ansible_eth0.ipv4.address }}:/etc/keystone/ - with_items: groups['controller'][1:] + with_items: "{{ groups['controller'][1:] }}" notify: - restart keystone services diff --git a/deploy/adapters/ansible/roles/keystone/tasks/keystone_create.yml b/deploy/adapters/ansible/roles/keystone/tasks/keystone_create.yml index 53077776..ab71fab4 100644 --- a/deploy/adapters/ansible/roles/keystone/tasks/keystone_create.yml +++ b/deploy/adapters/ansible/roles/keystone/tasks/keystone_create.yml @@ -23,6 +23,10 @@ --url {{ item.adminurl }} \ $(openstack endpoint list | grep keystone | grep admin | awk '{print $2}'); with_items: "{{ os_services[0:1] }}" + register: result + until: result.rc == 0 + retries: 10 + delay: 5 - name: add service shell: @@ -32,12 +36,20 @@ --description "{{ item.description }}" \ {{ item.type }} with_items: "{{ os_services[1:] }}" + register: result + until: result.rc == 0 + retries: 10 + delay: 5 - name: add project shell: . /opt/admin-openrc.sh; openstack project create --description "Service Project" service; openstack project create --domain default --description "Demo Project" demo; + register: result + until: result.rc == 0 + retries: 10 + delay: 5 - name: set admin user shell: @@ -50,6 +62,10 @@ {{ item.user }} with_items: "{{ os_users }}" when: item["user"] == "admin" + register: result + until: result.rc == 0 + retries: 10 + delay: 5 - name: add user shell: @@ -61,6 +77,10 @@ --password "{{ item.password }}" \ {{ item.user }} with_items: "{{ os_users[1:] }}" + register: result + until: result.rc == 0 + retries: 10 + delay: 5 - name: add roles shell: @@ -68,6 +88,10 @@ openstack role create {{ item.role }} with_items: "{{ os_users }}" when: item["user"] == "demo" + register: result + until: result.rc == 0 + retries: 10 + delay: 5 - name: grant roles shell: @@ -77,6 +101,10 @@ --user "{{ item.user }}" \ {{ item.role }} with_items: "{{ os_users }}" + register: result + until: result.rc == 0 + retries: 10 + delay: 5 - name: add endpoints shell: @@ -91,3 +119,8 @@ --region {{ item.region }} \ {{ item.name }} admin {{ item.adminurl }}; with_items: "{{ os_services[1:] }}" + register: result + until: result.rc == 0 + retries: 10 + delay: 5 + diff --git a/deploy/adapters/ansible/roles/keystone/tasks/keystone_install.yml b/deploy/adapters/ansible/roles/keystone/tasks/keystone_install.yml index 757349c5..0d3161ed 100644 --- a/deploy/adapters/ansible/roles/keystone/tasks/keystone_install.yml +++ b/deploy/adapters/ansible/roles/keystone/tasks/keystone_install.yml @@ -18,7 +18,7 @@ - name: install keystone packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: packages | union(packages_noarch) + with_items: "{{ packages | union(packages_noarch) }}" - name: enable auto start file: @@ -38,7 +38,7 @@ - name: generate keystone service list lineinfile: dest=/opt/service create=yes line='{{ item }}' - with_items: services | union(services_noarch) + with_items: "{{ services | union(services_noarch) }}" - name: delete sqlite database file: diff --git a/deploy/adapters/ansible/roles/keystone/vars/main.yml b/deploy/adapters/ansible/roles/keystone/vars/main.yml index ecaf7b51..916d6608 100644 --- a/deploy/adapters/ansible/roles/keystone/vars/main.yml +++ b/deploy/adapters/ansible/roles/keystone/vars/main.yml @@ -93,13 +93,13 @@ os_services: internalurl: "http://{{ internal_vip.ip }}:8000/v1" adminurl: "http://{{ internal_vip.ip }}:8000/v1" - - name: congress - type: policy - region: RegionOne - description: "OpenStack Policy Service" - publicurl: "http://{{ public_vip.ip }}:1789" - internalurl: "http://{{ internal_vip.ip }}:1789" - adminurl: "http://{{ internal_vip.ip }}:1789" +# - name: congress +# type: policy +# region: RegionOne +# description: "OpenStack Policy Service" +# publicurl: "http://{{ public_vip.ip }}:1789" +# internalurl: "http://{{ internal_vip.ip }}:1789" +# adminurl: "http://{{ internal_vip.ip }}:1789" # - name: swift # type: object-store @@ -173,12 +173,12 @@ os_users: tenant: service tenant_description: "Service Tenant" - - user: congress - password: "{{ CONGRESS_PASS }}" - email: congress@admin.com - role: admin - tenant: service - tenant_description: "Service Tenant" +# - user: congress +# password: "{{ CONGRESS_PASS }}" +# email: congress@admin.com +# role: admin +# tenant: service +# tenant_description: "Service Tenant" - user: demo password: "{{ DEMO_PASS }}" @@ -193,3 +193,4 @@ os_users: # role: admin # tenant: service # tenant_description: "Service Tenant" + diff --git a/deploy/adapters/ansible/roles/memcached/handlers/main.yml b/deploy/adapters/ansible/roles/memcached/handlers/main.yml index 4c3230c1..bcbcf8e0 100755 --- a/deploy/adapters/ansible/roles/memcached/handlers/main.yml +++ b/deploy/adapters/ansible/roles/memcached/handlers/main.yml @@ -9,4 +9,4 @@ --- - name: restart memcahed services service: name={{ item }} state=restarted enabled=yes - with_items: services| union(services_noarch) + with_items: "{{ services| union(services_noarch) }}" diff --git a/deploy/adapters/ansible/roles/memcached/tasks/main.yml b/deploy/adapters/ansible/roles/memcached/tasks/main.yml index 99ee6e87..a4457f36 100644 --- a/deploy/adapters/ansible/roles/memcached/tasks/main.yml +++ b/deploy/adapters/ansible/roles/memcached/tasks/main.yml @@ -18,7 +18,7 @@ - name: install packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest update_cache=yes" - with_items: packages | union(packages_noarch) + with_items: "{{ packages | union(packages_noarch) }}" - name: enable auto start file: diff --git a/deploy/adapters/ansible/roles/mq/tasks/rabbitmq_install.yml b/deploy/adapters/ansible/roles/mq/tasks/rabbitmq_install.yml index 1c8c2fe7..d6f7759e 100755 --- a/deploy/adapters/ansible/roles/mq/tasks/rabbitmq_install.yml +++ b/deploy/adapters/ansible/roles/mq/tasks/rabbitmq_install.yml @@ -19,7 +19,7 @@ - name: install rabbitmq-server action: "{{ ansible_pkg_mgr }} name=rabbitmq-server state=present" - with_items: packages | union(packages_noarch) + with_items: "{{ packages | union(packages_noarch) }}" - name: enable auto start file: @@ -88,4 +88,4 @@ - name: generate mq service list shell: echo {{ item }} >> /opt/service - with_items: services_noarch + with_items: "{{ services_noarch }}" diff --git a/deploy/adapters/ansible/roles/neutron-compute/handlers/main.yml b/deploy/adapters/ansible/roles/neutron-compute/handlers/main.yml index ca4e8088..83737980 100644 --- a/deploy/adapters/ansible/roles/neutron-compute/handlers/main.yml +++ b/deploy/adapters/ansible/roles/neutron-compute/handlers/main.yml @@ -9,7 +9,7 @@ --- - name: restart neutron compute service service: name={{ item }} state=restarted enabled=yes - with_items: services | union(services_noarch) + with_items: "{{ services | union(services_noarch) }}" - name: restart nova-compute services service: name=nova-compute state=restarted enabled=yes diff --git a/deploy/adapters/ansible/roles/neutron-compute/tasks/main.yml b/deploy/adapters/ansible/roles/neutron-compute/tasks/main.yml index 375e325d..3e58cc38 100644 --- a/deploy/adapters/ansible/roles/neutron-compute/tasks/main.yml +++ b/deploy/adapters/ansible/roles/neutron-compute/tasks/main.yml @@ -30,7 +30,7 @@ - name: install compute-related neutron packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: packages | union(packages_noarch) + with_items: "{{ packages | union(packages_noarch) }}" - name: enable auto start file: @@ -52,7 +52,7 @@ - name: generate neutron compute service list lineinfile: dest=/opt/service create=yes line='{{ item }}' - with_items: services | union(services_noarch) + with_items: "{{ services | union(services_noarch) }}" - name: config ml2 plugin template: src=templates/ml2_conf.ini @@ -72,4 +72,4 @@ - meta: flush_handlers - include: ../../neutron-network/tasks/odl.yml - when: "'opendaylight' in {{ NEUTRON_MECHANISM_DRIVERS }}" + when: "'opendaylight' in {{ NEUTRON_MECHANISM_DRIVERS | to_json }}" diff --git a/deploy/adapters/ansible/roles/neutron-controller/handlers/main.yml b/deploy/adapters/ansible/roles/neutron-controller/handlers/main.yml index 98d21135..8b1bf281 100644 --- a/deploy/adapters/ansible/roles/neutron-controller/handlers/main.yml +++ b/deploy/adapters/ansible/roles/neutron-controller/handlers/main.yml @@ -9,5 +9,5 @@ --- - name: restart neutron control services service: name={{ item }} state=restarted enabled=yes - with_items: services | union(services_noarch) + with_items: "{{ services | union(services_noarch) }}" when: item != "neutron-server" diff --git a/deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_config.yml b/deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_config.yml index fd133f37..47345f7a 100644 --- a/deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_config.yml +++ b/deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_config.yml @@ -13,7 +13,7 @@ register: result run_once: True until: result.rc == 0 - retries: 5 - delay: 3 + retries: 10 + delay: 5 notify: - restart neutron control services diff --git a/deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_install.yml b/deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_install.yml index 917a8356..cc222224 100644 --- a/deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_install.yml +++ b/deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_install.yml @@ -18,7 +18,7 @@ - name: install controller-related neutron packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: packages | union(packages_noarch) + with_items: "{{ packages | union(packages_noarch) }}" - name: enable auto start file: @@ -28,7 +28,7 @@ - name: generate neutron control service list lineinfile: dest=/opt/service create=yes line='{{ item }}' - with_items: services | union(services_noarch) + with_items: "{{ services | union(services_noarch) }}" - name: get tenant id to fill neutron.conf shell: diff --git a/deploy/adapters/ansible/roles/neutron-network/handlers/main.yml b/deploy/adapters/ansible/roles/neutron-network/handlers/main.yml index 9a9c9b4b..a279b5d5 100644 --- a/deploy/adapters/ansible/roles/neutron-network/handlers/main.yml +++ b/deploy/adapters/ansible/roles/neutron-network/handlers/main.yml @@ -10,8 +10,8 @@ - name: restart neutron network relation service service: name={{ item }} state=restarted enabled=yes with_flattened: - - services_noarch - - services + - "{{ services_noarch }}" + - "{{ services }}" - name: restart openvswitch agent service service: name=neutron-openvswitch-agent state=restarted enabled=yes diff --git a/deploy/adapters/ansible/roles/neutron-network/tasks/firewall.yml b/deploy/adapters/ansible/roles/neutron-network/tasks/firewall.yml index aec714f3..49b6a7f1 100755 --- a/deploy/adapters/ansible/roles/neutron-network/tasks/firewall.yml +++ b/deploy/adapters/ansible/roles/neutron-network/tasks/firewall.yml @@ -18,7 +18,7 @@ - name: install firewall packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: firewall_packages + with_items: "{{ firewall_packages }}" - name: enable auto start file: diff --git a/deploy/adapters/ansible/roles/neutron-network/tasks/igmp-router.yml b/deploy/adapters/ansible/roles/neutron-network/tasks/igmp-router.yml index 2ce16510..ec12b318 100644 --- a/deploy/adapters/ansible/roles/neutron-network/tasks/igmp-router.yml +++ b/deploy/adapters/ansible/roles/neutron-network/tasks/igmp-router.yml @@ -9,7 +9,7 @@ --- - name: Install XORP to provide IGMP router functionality action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: xorp_packages + with_items: "{{ xorp_packages }}" - name: create xorp directory file: path=/etc/xorp state=directory diff --git a/deploy/adapters/ansible/roles/neutron-network/tasks/main.yml b/deploy/adapters/ansible/roles/neutron-network/tasks/main.yml index 31f7f17c..753d281a 100644 --- a/deploy/adapters/ansible/roles/neutron-network/tasks/main.yml +++ b/deploy/adapters/ansible/roles/neutron-network/tasks/main.yml @@ -23,13 +23,13 @@ - name: assert kernel support for vxlan command: modinfo -F version vxlan - when: "'vxlan' in {{ NEUTRON_TUNNEL_TYPES }}" + when: "'vxlan' in {{ NEUTRON_TUNNEL_TYPES | to_json }}" - name: assert iproute2 suppport for vxlan command: ip link add type vxlan help register: iproute_out failed_when: iproute_out.rc == 255 - when: "'vxlan' in {{ NEUTRON_TUNNEL_TYPES }}" + when: "'vxlan' in {{ NEUTRON_TUNNEL_TYPES | to_json }}" - name: disable auto start copy: @@ -40,7 +40,7 @@ - name: install neutron network related packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: packages | union(packages_noarch) + with_items: "{{ packages | union(packages_noarch) }}" - name: enable auto start file: @@ -50,7 +50,7 @@ - name: generate neutron network service list lineinfile: dest=/opt/service create=yes line='{{ item }}' - with_items: services | union(services_noarch) + with_items: "{{ services | union(services_noarch) }}" - name: fix openstack neutron plugin config file shell: | @@ -97,7 +97,7 @@ dest: /etc/neutron/dnsmasq-neutron.conf regexp: '^dhcp-option-force' line: 'dhcp-option-force=26,1450' - when: "'vxlan' in {{ NEUTRON_TUNNEL_TYPES }}" + when: "'vxlan' in {{ NEUTRON_TUNNEL_TYPES | to_json }}" - include: firewall.yml when: enable_fwaas == True @@ -106,12 +106,12 @@ when: enable_vpnaas == True - include: odl.yml - when: "'opendaylight' in {{ NEUTRON_MECHANISM_DRIVERS }}" + when: "'opendaylight' in {{ NEUTRON_MECHANISM_DRIVERS | to_json }}" - name: restart neutron network relation service service: name={{ item }} state=restarted enabled=yes with_flattened: - - services_noarch - - services + - "{{ services_noarch }}" + - "{{ services }}" - meta: flush_handlers diff --git a/deploy/adapters/ansible/roles/neutron-network/tasks/vpn.yml b/deploy/adapters/ansible/roles/neutron-network/tasks/vpn.yml index 9722ab7c..925eb709 100755 --- a/deploy/adapters/ansible/roles/neutron-network/tasks/vpn.yml +++ b/deploy/adapters/ansible/roles/neutron-network/tasks/vpn.yml @@ -18,7 +18,7 @@ - name: install vpn packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: vpn_packages + with_items: "{{ vpn_packages }}" - name: enable auto start file: diff --git a/deploy/adapters/ansible/roles/neutron-network/vars/Debian.yml b/deploy/adapters/ansible/roles/neutron-network/vars/Debian.yml index 1a78ca8c..3597f587 100644 --- a/deploy/adapters/ansible/roles/neutron-network/vars/Debian.yml +++ b/deploy/adapters/ansible/roles/neutron-network/vars/Debian.yml @@ -21,5 +21,9 @@ services: openvswitch_agent: neutron-plugin-openvswitch-agent +firewall_packages: + +vpn_packages: + xorp_packages: - xorp diff --git a/deploy/adapters/ansible/roles/nova-compute/handlers/main.yml b/deploy/adapters/ansible/roles/nova-compute/handlers/main.yml index a50ce3d2..cbf0bc1c 100644 --- a/deploy/adapters/ansible/roles/nova-compute/handlers/main.yml +++ b/deploy/adapters/ansible/roles/nova-compute/handlers/main.yml @@ -9,4 +9,4 @@ --- - name: restart nova-compute services service: name={{ item }} state=restarted enabled=yes - with_items: services | union(services_noarch) + with_items: "{{ services | union(services_noarch) }}" diff --git a/deploy/adapters/ansible/roles/nova-compute/tasks/main.yml b/deploy/adapters/ansible/roles/nova-compute/tasks/main.yml index 16315b36..cdbb6472 100644 --- a/deploy/adapters/ansible/roles/nova-compute/tasks/main.yml +++ b/deploy/adapters/ansible/roles/nova-compute/tasks/main.yml @@ -18,7 +18,7 @@ - name: install nova-compute related packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: packages | union(packages_noarch) + with_items: "{{ packages | union(packages_noarch) }}" - name: restart virtlogd service: name=virtlogd state=started enabled=yes @@ -44,7 +44,7 @@ - name: generate neutron control service list lineinfile: dest=/opt/service create=yes line='{{ item }}' - with_items: services | union(services_noarch) + with_items: "{{ services | union(services_noarch) }}" #' - name: remove nova sqlite db shell: rm /var/lib/nova/nova.sqlite || touch nova.sqlite.removed diff --git a/deploy/adapters/ansible/roles/nova-controller/handlers/main.yml b/deploy/adapters/ansible/roles/nova-controller/handlers/main.yml index 0e512a7c..259012c5 100644 --- a/deploy/adapters/ansible/roles/nova-controller/handlers/main.yml +++ b/deploy/adapters/ansible/roles/nova-controller/handlers/main.yml @@ -9,7 +9,7 @@ --- - name: restart nova service service: name={{ item}} state=restarted enabled=yes - with_items: services | union(services_noarch) + with_items: "{{ services | union(services_noarch) }}" - name: remove nova-sqlite-db shell: rm /var/lib/nova/nova.sqlite || touch nova.sqlite.db.removed diff --git a/deploy/adapters/ansible/roles/nova-controller/tasks/nova_install.yml b/deploy/adapters/ansible/roles/nova-controller/tasks/nova_install.yml index 865ad2e5..c7d6cb72 100644 --- a/deploy/adapters/ansible/roles/nova-controller/tasks/nova_install.yml +++ b/deploy/adapters/ansible/roles/nova-controller/tasks/nova_install.yml @@ -18,7 +18,7 @@ - name: install nova related packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: packages | union(packages_noarch) + with_items: "{{ packages | union(packages_noarch) }}" - name: enable auto start file: @@ -28,7 +28,7 @@ - name: generate nova control service list lineinfile: dest=/opt/service create=yes line='{{ item }}' - with_items: services | union(services_noarch) + with_items: "{{ services | union(services_noarch) }}" - name: update nova conf template: src=templates/nova.conf diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-webui.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-webui.yml index 99441b6d..525f4334 100755 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-webui.yml +++ b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-webui.yml @@ -49,7 +49,8 @@ - { regexp: "^\\s*config.storageManager.ip", line: "config.storageManager.ip = '{{ contrail_keystone_address }}';" } - { regexp: "^\\s*config.cnfg.server_ip", line: "config.cnfg.server_ip = '{{ contrail_haproxy_address }}';" } - { regexp: "^\\s*config.analytics.server_ip", line: "config.analytics.server_ip = '{{ contrail_haproxy_address }}';" } - - { regexp: "^\\s*config.cassandra.server_ips", line: "config.cassandra.server_ips = [{{ cassandra_addrs }}];" } +# TODO: when I update ansibel version to 2.2, this playbook can't pass the test. ERROR log: "'cassandra_addrs' is undefined". +# - { regexp: "^\\s*config.cassandra.server_ips", line: "config.cassandra.server_ips = [{{ cassandra_addrs }}];" } - name: "modify webui userauth js" lineinfile: diff --git a/deploy/adapters/ansible/roles/secgroup/handlers/main.yml b/deploy/adapters/ansible/roles/secgroup/handlers/main.yml index e4e11ec7..77082ded 100644 --- a/deploy/adapters/ansible/roles/secgroup/handlers/main.yml +++ b/deploy/adapters/ansible/roles/secgroup/handlers/main.yml @@ -10,9 +10,9 @@ - name: restart controller relation service service: name={{ item }} state=restarted enabled=yes ignore_errors: True - with_items: controller_services + with_items: "{{ controller_services }}" - name: restart compute relation service service: name={{ item }} state=restarted enabled=yes ignore_errors: True - with_items: compute_services + with_items: "{{ compute_services }}" diff --git a/deploy/adapters/ansible/roles/secgroup/tasks/secgroup.yml b/deploy/adapters/ansible/roles/secgroup/tasks/secgroup.yml index 5e8684d4..9323facc 100644 --- a/deploy/adapters/ansible/roles/secgroup/tasks/secgroup.yml +++ b/deploy/adapters/ansible/roles/secgroup/tasks/secgroup.yml @@ -12,24 +12,27 @@ tags: secgroup - name: copy configs - template: src={{ item.src}} dest=/opt/os_templates - with_items: "{{ configs_templates }}" + template: src={{ item }} dest=/opt/os_templates + with_items: + - nova.j2 + - neutron.j2 tags: secgroup - name: update controller configs - shell: '[ -f {{ item.1 }} ] && crudini --merge {{ item.1 }} < /opt/os_templates/{{ item.0.src }} || /bin/true' + shell: "[ -f '{{ item.1 }}' ] && crudini --merge '{{ item.1 }}' < /opt/os_templates/{{ item.0.src }} || /bin/true" tags: secgroup with_subelements: - - configs_templates + - "{{ configs_templates }}" - dest notify: restart controller relation service when: inventory_hostname in "{{ groups['controller'] }}" - name: update compute configs - shell: '[ -f {{ item.1 }} ] && crudini --merge {{ item.1 }} < /opt/os_templates/{{ item.0.src }} || /bin/true' + shell: "[ -f '{{ item.1 }}' ] && crudini --merge '{{ item.1 }}' < /opt/os_templates/{{ item.0.src }} || /bin/true" tags: secgroup with_subelements: - - configs_templates + - "{{ configs_templates }}" - dest notify: restart compute relation service when: inventory_hostname in "{{ groups['compute'] }}" + diff --git a/deploy/adapters/ansible/roles/setup-network/tasks/main.yml b/deploy/adapters/ansible/roles/setup-network/tasks/main.yml index e1fdf925..2649ea79 100644 --- a/deploy/adapters/ansible/roles/setup-network/tasks/main.yml +++ b/deploy/adapters/ansible/roles/setup-network/tasks/main.yml @@ -65,14 +65,14 @@ shell: > python /opt/setup_networks/check_network.py \ "{{ inventory_hostname }}" \ - "{{ ip_settings }}" + "{{ ip_settings | to_json }}" tags: - network_check retries: 3 delay: 2 - name: add to boot scripts - service: name=net_init enabled=yes + shell: update-rc.d net_init defaults - meta: flush_handlers diff --git a/deploy/adapters/ansible/roles/setup-network/templates/network.cfg b/deploy/adapters/ansible/roles/setup-network/templates/network.cfg index 75ba90cb..cf271ad6 100644 --- a/deploy/adapters/ansible/roles/setup-network/templates/network.cfg +++ b/deploy/adapters/ansible/roles/setup-network/templates/network.cfg @@ -1,5 +1,5 @@ -bond_mappings: {{ network_cfg["bond_mappings"] }} -ip_settings: {{ ip_settings[inventory_hostname] }} -sys_intf_mappings: {{ sys_intf_mappings }} -provider_net_mappings: {{ network_cfg["provider_net_mappings"] }} +bond_mappings: {{ network_cfg["bond_mappings"] | to_json }} +ip_settings: {{ ip_settings[inventory_hostname] | to_json }} +sys_intf_mappings: {{ sys_intf_mappings | to_json }} +provider_net_mappings: {{ network_cfg["provider_net_mappings"] | to_json }} diff --git a/deploy/adapters/ansible/roles/storage/tasks/loop.yml b/deploy/adapters/ansible/roles/storage/tasks/loop.yml index 21b393d5..b0fb9c21 100755 --- a/deploy/adapters/ansible/roles/storage/tasks/loop.yml +++ b/deploy/adapters/ansible/roles/storage/tasks/loop.yml @@ -13,7 +13,7 @@ register: part_size - name: create image file if not exitst - script: create_img.sh \"{{ part_size.stdout }}\" + script: create_img.sh "{{ part_size.stdout }}" - name: do a losetup on storage volumes script: losetup.sh diff --git a/deploy/adapters/ansible/roles/storage/tasks/main.yml b/deploy/adapters/ansible/roles/storage/tasks/main.yml index b48e6769..be712c67 100755 --- a/deploy/adapters/ansible/roles/storage/tasks/main.yml +++ b/deploy/adapters/ansible/roles/storage/tasks/main.yml @@ -15,7 +15,7 @@ - name: load loop.yml include: loop.yml - when: status.stat.exists == False or status.stat.isblk == False + when: status.stat.exists == False or status.stat.isblk == False tags: - storage @@ -50,7 +50,7 @@ - name: enable service - service: name=storage enabled=yes + shell: update-rc.d storage defaults tags: - storage diff --git a/deploy/compass_conf/templates/ansible_installer/openstack_newton/ansible_cfg/HA-ansible-multinodes.tmpl b/deploy/compass_conf/templates/ansible_installer/openstack_newton/ansible_cfg/HA-ansible-multinodes.tmpl index d5a6d966..42cdee96 100755 --- a/deploy/compass_conf/templates/ansible_installer/openstack_newton/ansible_cfg/HA-ansible-multinodes.tmpl +++ b/deploy/compass_conf/templates/ansible_installer/openstack_newton/ansible_cfg/HA-ansible-multinodes.tmpl @@ -2,6 +2,10 @@ [defaults] log_path = /var/ansible/run/openstack_newton-$cluster_name/ansible.log host_key_checking = False +callback_whitelist = playbook_done, status_callback callback_plugins = /opt/compass/bin/ansible_callbacks -pipelining=True library = /opt/openstack-ansible-modules +forks=100 + +[ssh_connection] +pipelining=True diff --git a/deploy/deploy_host.sh b/deploy/deploy_host.sh index 5d2f1756..afc3bbeb 100755 --- a/deploy/deploy_host.sh +++ b/deploy/deploy_host.sh @@ -17,6 +17,7 @@ function deploy_host(){ export AYNC_TIMEOUT=20 ssh $ssh_args root@${MGMT_IP} mkdir -p /opt/compass/bin/ansible_callbacks scp $ssh_args -r ${COMPASS_DIR}/deploy/status_callback.py root@${MGMT_IP}:/opt/compass/bin/ansible_callbacks/status_callback.py + scp $ssh_args -r ${COMPASS_DIR}/deploy/playbook_done.py root@${MGMT_IP}:/opt/compass/bin/ansible_callbacks/playbook_done.py # avoid nodes reboot to fast, cobbler can not give response (sleep $AYNC_TIMEOUT; rename_nics; reboot_hosts) & diff --git a/deploy/playbook_done.py b/deploy/playbook_done.py new file mode 100644 index 00000000..c0a81a40 --- /dev/null +++ b/deploy/playbook_done.py @@ -0,0 +1,113 @@ +#!/usr/bin/env python +# +# Copyright 2014 Huawei Technologies Co. Ltd +# +# 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. + +"""Ansible playbook callback after a playbook run has completed.""" +import os +import sys + +from ansible.plugins.callback import CallbackBase + +current_dir = os.path.dirname(os.path.realpath(__file__)) +sys.path.append(current_dir + '/..') + + +import switch_virtualenv # noqa +from compass.apiclient.restful import Client # noqa: E402 +from compass.utils import flags # noqa: E402 + + +flags.add('compass_server', + help='compass server url', + default='http://127.0.0.1/api') +flags.add('compass_user_email', + help='compass user email', + default='admin@huawei.com') +flags.add('compass_user_password', + help='compass user password', + default='admin') + + +class CallbackModule(CallbackBase): + CALLBACK_VERSION = 2.0 + CALLBACK_TYPE = 'notification' + CALLBACK_NAME = 'playbook_done' + CALLBACK_NEEDS_WHITELIST = True + + def __init__(self): + super(CallbackModule, self).__init__() + + self.play = None + self.loader = None + self.disabled = False + try: + self.client = self._get_client() + except Exception: + self.disabled = True + self._display.error("No compass server found" + "disabling this plugin") + + def _get_client(self): + return Client(flags.OPTIONS.compass_server) + + def _login(self, client): + """get apiclient token.""" + status, resp = client.get_token( + flags.OPTIONS.compass_user_email, + flags.OPTIONS.compass_user_password + ) + self._display.warning( + 'login status: %s, resp: %s' % + (status, resp) + ) + if status >= 400: + raise Exception( + 'failed to login %s with user %s', + flags.OPTIONS.compass_server, + flags.OPTIONS.compass_user_email + ) + return resp['token'] + + def v2_playbook_on_play_start(self, play): + self.play = play + self.loader = self.play.get_loader() + return + + def v2_playbook_on_stats(self, stats): + all_vars = self.play.get_variable_manager().get_vars(self.loader) + host_vars = all_vars["hostvars"] + hosts = sorted(stats.processed.keys()) + cluster_name = host_vars[hosts[0]]['cluster_name'] + self._display.warning("cluster_name %s" % cluster_name) + + failures = False + unreachable = False + + for host in hosts: + summary = stats.summarize(host) + + if summary['failures'] > 0: + failures = True + if summary['unreachable'] > 0: + unreachable = True + + if failures or unreachable: + return + + self._login(self.client) + + for host in hosts: + clusterhost_name = host + "." + cluster_name + self.client.clusterhost_ready(clusterhost_name) diff --git a/deploy/status_callback.py b/deploy/status_callback.py index 30dffd34..58072de2 100755 --- a/deploy/status_callback.py +++ b/deploy/status_callback.py @@ -1,86 +1,97 @@ import httplib import json -import sys -import logging +import sys # noqa:F401 +from ansible.plugins.callback import CallbackBase -def task_error(host, data): - logging.info("task_error: host=%s,data=%s" % (host, data)) + +def task_error(display, host, data): + display.display("task_error: host=%s,data=%s" % (host, data)) # if isinstance(data, dict): # invocation = data.pop('invocation', {}) - notify_host("localhost", host, "failed") + notify_host(display, "localhost", host, "failed") -class CallbackModule(object): +class CallbackModule(CallbackBase): """ logs playbook results, per host, in /var/log/ansible/hosts """ + CALLBACK_VERSION = 2.0 + CALLBACK_TYPE = 'notification' + CALLBACK_NAME = 'status_callback' + CALLBACK_NEEDS_WHITELIST = True + + def __init__(self): + super(CallbackModule, self).__init__() - def on_any(self, *args, **kwargs): + def v2_on_any(self, *args, **kwargs): pass - def runner_on_failed(self, host, res, ignore_errors=False): - task_error(host, res) + def v2_runner_on_failed(self, host, res, ignore_errors=False): + task_error(self._display, host, res) - def runner_on_ok(self, host, res): + def v2_runner_on_ok(self, host, res): pass - def runner_on_skipped(self, host, item=None): + def v2_runner_on_skipped(self, host, item=None): pass - def runner_on_unreachable(self, host, res): + def v2_runner_on_unreachable(self, host, res): pass - def runner_on_no_hosts(self): + def v2_runner_on_no_hosts(self): pass - def runner_on_async_poll(self, host, res, jid, clock): + def v2_runner_on_async_poll(self, host, res, jid, clock): pass - def runner_on_async_ok(self, host, res, jid): + def v2_runner_on_async_ok(self, host, res, jid): pass - def runner_on_async_failed(self, host, res, jid): - task_error(host, res) + def v2_runner_on_async_failed(self, host, res, jid): + task_error(self._display, host, res) - def playbook_on_start(self): + def v2_playbook_on_start(self): pass - def playbook_on_notify(self, host, handler): + def v2_playbook_on_notify(self, host, handler): pass - def playbook_on_no_hosts_matched(self): + def v2_playbook_on_no_hosts_matched(self): pass - def playbook_on_no_hosts_remaining(self): + def v2_playbook_on_no_hosts_remaining(self): pass - def playbook_on_task_start(self, name, is_conditional): + def v2_playbook_on_task_start(self, name, is_conditional): pass - def playbook_on_vars_prompt(self, varname, private=True, prompt=None, + def v2_playbook_on_vars_prompt(self, varname, private=True, prompt=None, encrypt=None, confirm=False, salt_size=None, salt=None, default=None): # noqa pass - def playbook_on_setup(self): + def v2_playbook_on_setup(self): pass - def playbook_on_import_for_host(self, host, imported_file): + def v2_playbook_on_import_for_host(self, host, imported_file): pass - def playbook_on_not_import_for_host(self, host, missing_file): + def v2_playbook_on_not_import_for_host(self, host, missing_file): pass - def playbook_on_play_start(self, name): - pass + def v2_playbook_on_play_start(self, play): + self.play = play + self.loader = self.play.get_loader() + return - def playbook_on_stats(self, stats): - logging.info("playbook_on_stats enter") + def v2_playbook_on_stats(self, stats): + self._display.display("playbook_on_stats enter") + all_vars = self.play.get_variable_manager().get_vars(self.loader) + host_vars = all_vars["hostvars"] hosts = sorted(stats.processed.keys()) - host_vars = self.playbook.inventory.get_variables(hosts[0]) - cluster_name = host_vars['cluster_name'] + cluster_name = host_vars[hosts[0]]['cluster_name'] failures = False unreachable = False @@ -94,12 +105,12 @@ class CallbackModule(object): if failures or unreachable: for host in hosts: - notify_host("localhost", host, "error") + notify_host(self._display, "localhost", host, "error") return for host in hosts: clusterhost_name = host + "." + cluster_name - notify_host("localhost", clusterhost_name, "succ") + notify_host(self._display, "localhost", clusterhost_name, "succ") def raise_for_status(resp): @@ -123,7 +134,7 @@ def auth(conn): return json.loads(resp.read())["token"] -def notify_host(compass_host, host, status): +def notify_host(display, compass_host, host, status): if status == "succ": body = {"ready": True} url = "/api/clusterhosts/%s/state_internal" % host @@ -132,7 +143,7 @@ def notify_host(compass_host, host, status): host = host.strip("host") url = "/api/clusterhosts/%s/state" % host else: - logging.error("notify_host: host %s with status %s is not supported" + display.error("notify_host: host %s with status %s is not supported" % (host, status)) return @@ -142,26 +153,17 @@ def notify_host(compass_host, host, status): conn = httplib.HTTPConnection(compass_host, 80) token = auth(conn) headers["X-Auth-Token"] = token - logging.info("host=%s,url=%s,body=%s,headers=%s" % - (compass_host, url, json.dumps(body), headers)) + display.display("host=%s,url=%s,body=%s,headers=%s" % + (compass_host, url, json.dumps(body), headers)) conn.request("POST", url, json.dumps(body), headers) resp = conn.getresponse() try: raise_for_status(resp) - logging.info( + display.display( "notify host status success!!! status=%s, body=%s" % (resp.status, resp.read())) except Exception as e: - logging.error("http request failed %s" % str(e)) + display.error("http request failed %s" % str(e)) raise finally: conn.close() - -if __name__ == "__main__": - if len(sys.argv) != 3: - logging.error("params: host, status is need") - sys.exit(1) - - host = sys.argv[1] - status = sys.argv[2] - notify_host(host, status) diff --git a/repo/repo.conf b/repo/repo.conf index 11a44565..6b3d82a8 100644 --- a/repo/repo.conf +++ b/repo/repo.conf @@ -91,5 +91,6 @@ export SPECIAL_PIP_PACKAGE="https://bootstrap.pypa.io/ez_setup.py \ export PIP_PACKAGE="https://pypi.python.org/packages/0d/af/8ccfb73834a6ddf9d57ecac61466557b7ca0722620bbb16d2d069ce312db/networking-odl-2.0.0.tar.gz \ https://pypi.python.org/packages/90/4f/74b730294de1db393e3e82211b5d2115f9a763849abca7d014348a550d2a/oslosphinx-4.5.0.tar.gz \ + https://pypi.python.org/packages/48/da/5e51cf931e4c7849ba698654877e2951ade8f842f28f0c904453a1d317d7/ansible-2.2.0.0.tar.gz \ https://pypi.python.org/packages/74/f0/386f7f73aa6628c1bef53874c5d453b556356d77732add69000aa53b353b/policy2tosca-1.0.tar.gz " |