aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_setup_env.yml
blob: cacc48d87bc39bbec0fc49fcdce7a21437117ed6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
- include_vars: "{{ ansible_os_family }}.yml"

- name: copy rsa secret key from compass-core to host1
  copy: src=/root/.ssh/id_rsa dest=/root/.ssh/id_rsa mode=0600

- name: copy rsa pub key from compass-core to host1
  copy: src=/root/.ssh/id_rsa.pub dest=/root/.ssh/id_rsa.pub mode=0644

- name: gen ssh key for no-ask access to every nodes
  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: copy key to node
  shell: ssh-copy-id -i ~/.ssh/id_rsa.pub -o StrictHostKeyChecking=no root@{{ item }}
  with_items:
    - "{{ groups['all'] }}"

- name: install ceph-related packages
  action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
  with_items: packages | union(packages_noarch)

- name: clear cluster_hosts_name
  file: path=cluster_hosts_name state=absent
  tags:
    - create_ceph_cluster
    - ceph_install

- name: echo hosts name to file
  shell: echo -n "{{ item }} " >> cluster_hosts_name
  with_items:
    - "{{ groups['all'] }}"
  tags:
    - create_ceph_cluster
    - ceph_install

- name: register hosts name
  shell: cat cluster_hosts_name
  register: ceph_cluster_hosts
  tags:
    - create_ceph_cluster
    - echo_hosts
    - ceph_install

- name: gen clean ceph script
  template: src=clean_ceph.j2 dest=~/clean_ceph.sh mode=0777

- name: clean ceph data of last deploy
  shell: ~/clean_ceph.sh

- name: mkdir for ceph-cluster
  file: path={{ ceph_cluster_dir[0] }} state=directory mode=0755