diff options
Diffstat (limited to 'deploy/adapters/ansible')
5 files changed, 41 insertions, 16 deletions
diff --git a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml index 5b958b73..ac2f2a8d 100644 --- a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml +++ b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml @@ -56,10 +56,14 @@ roles: - ext-network +- hosts: ceph + remote_user: root + sudo: True + roles: + - ceph-deploy - hosts: all remote_user: root sudo: True roles: - - ceph-deploy - monitor diff --git a/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_Debian.yml b/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_Debian.yml index 06c28f24..3959d466 100644 --- a/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_Debian.yml +++ b/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_Debian.yml @@ -1,6 +1,6 @@ --- - name: create ceph cluster - shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy new {{ ceph_cluster_hosts.stdout_lines[0] }} + shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy new {{ controller_nodes.stdout_lines[0] }} tags: - create_ceph_cluster @@ -22,21 +22,21 @@ - name: copy create_osd.sh to other nodes shell: scp -o StrictHostKeyChecking=no ~/create_osd.sh {{ item }}:~/ with_items: - - "{{ groups['controller'] }}" + - "{{ groups['compute'] }}" tags: - create_osd - name: create osd shell: ssh -o StrictHostKeyChecking=no -t {{ item }} "~/create_osd.sh" with_items: - - "{{ groups['controller'] }}" + - "{{ groups['compute'] }}" tags: - create_osd - name: prepare create osd shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy osd prepare {{ item }}:/var/local/osd with_items: - - "{{ groups['controller'] }}" + - "{{ groups['compute'] }}" tags: - create_osd @@ -44,7 +44,7 @@ - name: activate osd shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy osd activate {{ item }}:/var/local/osd && ceph-deploy osd activate {{ item }}:/var/local/osd with_items: - - "{{ groups['controller'] }}" + - "{{ groups['compute'] }}" tags: - create_osd - activate_osd diff --git a/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_RedHat.yml b/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_RedHat.yml index 6ce01b86..97d925d6 100644 --- a/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_RedHat.yml +++ b/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_RedHat.yml @@ -1,6 +1,6 @@ --- - name: create ceph cluster - shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy new {{ ceph_cluster_hosts.stdout_lines[0] }} + shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy new {{ controller_nodes.stdout_lines[0] }} tags: - create_ceph_cluster @@ -22,21 +22,21 @@ - name: copy create_osd.sh to other nodes shell: scp -o StrictHostKeyChecking=no ~/create_osd.sh {{ item }}:~/ with_items: - - "{{ groups['controller'] }}" + - "{{ groups['compute'] }}" tags: - create_osd - name: create osd shell: ssh -o StrictHostKeyChecking=no -t {{ item }} "~/create_osd.sh" with_items: - - "{{ groups['controller'] }}" + - "{{ groups['compute'] }}" tags: - create_osd - name: prepare create osd shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy --repo-url http://10.1.0.12/cblr/repo_mirror/centos7-juno-ppa --gpg-url http://10.1.0.12/cblr/repo_mirror/centos7-juno-ppa/ceph_key_release.asc osd prepare {{ item }}:/var/local/osd with_items: - - "{{ groups['controller'] }}" + - "{{ groups['compute'] }}" tags: - create_osd @@ -44,7 +44,7 @@ - name: activate osd shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy --repo-url http://10.1.0.12/cblr/repo_mirror/centos7-juno-ppa --gpg-url http://10.1.0.12/cblr/repo_mirror/centos7-juno-ppa/ceph_key_release.asc osd activate {{ item }}:/var/local/osd with_items: - - "{{ groups['controller'] }}" + - "{{ groups['compute'] }}" tags: - create_osd - activate_osd diff --git a/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_setup_env.yml b/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_setup_env.yml index cacc48d8..f89e2c6d 100644 --- a/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_setup_env.yml +++ b/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_setup_env.yml @@ -25,6 +25,13 @@ - create_ceph_cluster - ceph_install +- name: clear cluster_controller_nodes + file: path=cluster_controller_nodes state=absent + tags: + - create_ceph_cluster + - ceph_install + + - name: echo hosts name to file shell: echo -n "{{ item }} " >> cluster_hosts_name with_items: @@ -41,6 +48,23 @@ - echo_hosts - ceph_install +- name: echo controller name to file + shell: echo -n "{{ item }} " >> cluster_controller_nodes + with_items: + - "{{ groups['controller'] }}" + tags: + - create_ceph_cluster + - ceph_install + +- name: register controller nodes + shell: cat cluster_controller_nodes + register: controller_nodes + tags: + - create_ceph_cluster + - echo_hosts + - ceph_install + + - name: gen clean ceph script template: src=clean_ceph.j2 dest=~/clean_ceph.sh mode=0777 diff --git a/deploy/adapters/ansible/roles/ceph-deploy/tasks/main.yml b/deploy/adapters/ansible/roles/ceph-deploy/tasks/main.yml index b50b38c8..75ed1da2 100644 --- a/deploy/adapters/ansible/roles/ceph-deploy/tasks/main.yml +++ b/deploy/adapters/ansible/roles/ceph-deploy/tasks/main.yml @@ -1,32 +1,29 @@ --- - include: ceph_setup_env.yml - when: inventory_hostname == "{{ groups['controller'][0] }}" tags: - ceph_deploy - ceph_setup_env - ceph_install - include: ceph_install_Debian.yml - when: inventory_hostname == groups['controller'][0] and ansible_os_family == "Debian" + when: ansible_os_family == "Debian" tags: - ceph_deploy - ceph_install - include: ceph_install_RedHat.yml - when: inventory_hostname == groups['controller'][0] and ansible_os_family == "RedHat" + when: ansible_os_family == "RedHat" tags: - ceph_deploy - ceph_install - include: ceph_openstack_pre.yml - when: inventory_hostname == "{{ groups['controller'][0] }}" tags: - ceph_deploy - ceph_openstack_pre - ceph_openstack - include: ceph_openstack_conf.yml - when: inventory_hostname == "{{ groups['controller'][0] }}" tags: - ceph_deploy - ceph_openstack_conf |