diff options
author | Sachin Prabhu <sprabhu@redhat.com> | 2020-03-28 23:55:12 +0000 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2020-04-28 08:11:24 +0200 |
commit | 977e7ee062ed96e3b5cfb1450ac348fac07d9eb8 (patch) | |
tree | cd3a98aca1f6dea3920e27eeaa0e6ac48f109d5d /vagrant/ansible/roles/client.prep | |
parent | 3b758f3406244f0fa5d14ccfbaafea7234860b46 (diff) | |
download | samba-integration-977e7ee062ed96e3b5cfb1450ac348fac07d9eb8.tar.gz samba-integration-977e7ee062ed96e3b5cfb1450ac348fac07d9eb8.tar.xz samba-integration-977e7ee062ed96e3b5cfb1450ac348fac07d9eb8.zip |
Add role client.prep
To prep client machines.
Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Diffstat (limited to 'vagrant/ansible/roles/client.prep')
-rw-r--r-- | vagrant/ansible/roles/client.prep/tasks/main.yml | 55 | ||||
-rw-r--r-- | vagrant/ansible/roles/client.prep/tasks/mkdir_usermounts.yml | 18 |
2 files changed, 73 insertions, 0 deletions
diff --git a/vagrant/ansible/roles/client.prep/tasks/main.yml b/vagrant/ansible/roles/client.prep/tasks/main.yml new file mode 100644 index 0000000..63e512e --- /dev/null +++ b/vagrant/ansible/roles/client.prep/tasks/main.yml @@ -0,0 +1,55 @@ +- 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 + state: latest + +- 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 diff --git a/vagrant/ansible/roles/client.prep/tasks/mkdir_usermounts.yml b/vagrant/ansible/roles/client.prep/tasks/mkdir_usermounts.yml new file mode 100644 index 0000000..58d2b2f --- /dev/null +++ b/vagrant/ansible/roles/client.prep/tasks/mkdir_usermounts.yml @@ -0,0 +1,18 @@ +--- +- name: Create user mount directories + file: + path: "/test-mnt/testhost{{ testhost_num }}/{{item.username}}" + state: directory + owner: root + group: root + mode: 0755 + with_items: "{{ samba_users }}" + +- name: Add user mounts + mount: + path: "/test-mnt/testhost{{ testhost_num }}/{{item.username}}" + src: "//testhost{{ testhost_num }}/gluster-vol" + fstype: cifs + opts: "username={{ item.username }},password={{ item.password }},vers=2.1" + state: present + with_items: "{{ samba_users }}" |