aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/openstack
diff options
context:
space:
mode:
authorcarey.xu <carey.xuhan@huawei.com>2016-01-16 13:50:42 +0800
committerJustin chi <chigang@huawei.com>2016-01-18 12:47:22 +0000
commit15cd9fed3e0ff4bdd5d712df459037a765fe562e (patch)
tree806198c5b27b17df33b212bb498ae0da4714f425 /deploy/adapters/ansible/openstack
parentcd9a37eec7b6a25b33af9b6400697c2386cc1cbd (diff)
bugfix: SSH permissions error when resizing or migrating an instance
- make all host cant ssh login each other with out password, so nova can resize on diffrent hosts - remove some error httpchk options in haproxy JIRA: COMPASS-269 Change-Id: If9d75bc94446000ed1a8fb7bbd777ae205ecd630 Signed-off-by: carey.xu <carey.xuhan@huawei.com>
Diffstat (limited to 'deploy/adapters/ansible/openstack')
-rw-r--r--deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml85
1 files changed, 83 insertions, 2 deletions
diff --git a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml
index b8fff581..472bb30a 100644
--- a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml
+++ b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml
@@ -1,6 +1,42 @@
---
- hosts: all
remote_user: root
+ pre_tasks:
+ - name: make sure ssh dir exist
+ file:
+ path: '{{ item.path }}'
+ owner: '{{ item.owner }}'
+ group: '{{ item.group }}'
+ state: directory
+ mode: 0755
+ with_items:
+ - path: /root/.ssh
+ owner: root
+ group: root
+
+ - name: write ssh config
+ copy:
+ content: "UserKnownHostsFile /dev/null\nStrictHostKeyChecking no"
+ dest: '{{ item.dest }}'
+ owner: '{{ item.owner }}'
+ group: '{{ item.group }}'
+ mode: 0600
+ with_items:
+ - dest: /root/.ssh/config
+ owner: root
+ group: root
+
+ - name: generate ssh keys
+ shell: if [ ! -f ~/.ssh/id_rsa.pub ]; then ssh-keygen -q -t rsa -f ~/.ssh/id_rsa -N ""; else echo "already gen ssh key!"; fi;
+
+ - name: fetch ssh keys
+ fetch: src=/root/.ssh/id_rsa.pub dest=/tmp/ssh-keys-{{ ansible_hostname }} flat=yes
+
+ - authorized_key:
+ user: root
+ key: "{{ lookup('file', 'item') }}"
+ with_fileglob:
+ - /tmp/ssh-keys-*
roles:
- common
@@ -38,8 +74,8 @@
- hosts: all
remote_user: root
accelerate: true
- roles:
- - storage
+ roles:
+ - storage
- hosts: compute
remote_user: root
@@ -116,3 +152,48 @@
accelerate: true
roles:
- secgroup
+
+- hosts: all
+ remote_user: root
+ accelerate: true
+ tasks:
+ - name: set bash to nova
+ user:
+ name: nova
+ shell: /bin/bash
+
+ - name: make sure ssh dir exist
+ file:
+ path: '{{ item.path }}'
+ owner: '{{ item.owner }}'
+ group: '{{ item.group }}'
+ state: directory
+ mode: 0755
+ with_items:
+ - path: /var/lib/nova/.ssh
+ owner: nova
+ group: nova
+
+ - name: copy ssh keys for nova
+ shell: cp -rf /root/.ssh/id_rsa /var/lib/nova/.ssh;
+
+ - name: write ssh config
+ copy:
+ content: "UserKnownHostsFile /dev/null\nStrictHostKeyChecking no"
+ dest: '{{ item.dest }}'
+ owner: '{{ item.owner }}'
+ group: '{{ item.group }}'
+ mode: 0600
+ with_items:
+ - dest: /var/lib/nova/.ssh/config
+ owner: nova
+ group: nova
+
+ - authorized_key:
+ user: nova
+ key: "{{ lookup('file', 'item') }}"
+ with_fileglob:
+ - /tmp/ssh-keys-*
+
+ - name: chown ssh file
+ shell: chown -R nova:nova /var/lib/nova/.ssh;