summaryrefslogtreecommitdiffstats
path: root/vagrant/ansible/roles/client.prep/tasks/main.yml
blob: 808a678cd650b2d5190645cf9be9109d14c87a42 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
- name: Enable GlusterFS nightly rpms repository
  command: yum-config-manager --add-repo http://artifacts.ci.centos.org/gluster/nightly/master.repo

- name: Install required packages
  yum:
    name:
      - glusterfs-fuse
      - cifs-utils
      - samba-test
      - python-pip
      - git
    state: latest

- name: Install Python yaml package
  pip:
    name: PyYAML

- debug:
    msg: "{{ ctdb_network_public_interfaces }}"

- name: Set variables to be used later
  set_fact:
    num_hosts: "{{ ctdb_network_public_interfaces | length }}"
    num_users: "{{ samba_users | length }}"
    testhost0: "{{ ctdb_network_public_interfaces[0] }}"

- name: Make directory to contain share mount points
  file:
    path: /test-mnt
    state: directory
    owner: root
    group: root
    mode: 0755

- name: Add fuse mount share
  mount:
    path: /test-mnt/fuse
    src: "{{ testhost0 }}:vol"
    fstype: glusterfs
    state: present

- name: Add test hosts to /etc/hosts
  lineinfile:
    path: /etc/hosts
    line: "{{ ctdb_network_public_interfaces[item|int] }} testhost{{ item }}"
    regexp: "^{{ ctdb_network_public_interfaces[item|int] }} "
    insertafter: EOF
  with_sequence: start=0 end={{ num_hosts |int -1 }}

- name: Create folders for each directory
  file:
    path: "/test-mnt/testhost{{ item }}"
    state: directory
    owner: root
    group: root
    mode: 0755
  with_sequence: start=0 end={{ num_hosts |int -1 }}

- include_tasks: "mkdir_usermounts.yml"
  with_sequence: start=0 end={{ num_hosts |int -1 }}
  loop_control:
    loop_var: testhost_num

- name: Create a README file
  template:
    src: README.j2
    dest: /root/README
    owner: root
    group: root
    mode: '0644'

- name: Create the test-info.yml file with test cluster information
  template:
    src: test-info.yml.j2
    dest: /root/test-info.yml
  vars:
    private_interfaces: "{{ ctdb_network_private_interfaces }}"
    public_interfaces: "{{ ctdb_network_public_interfaces }}"
    exported_sharenames:
      - "gluster-vol"
    test_users: "{{ samba_users }}"