forked from UCCNetsoc/NaC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
provision-nfs.yml
76 lines (71 loc) · 2.03 KB
/
provision-nfs.yml
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
- name: "Enroll in IPA server"
hosts: nfs
roles:
- role: freeipa-client
vars:
realm: VM.NETSOC.CO
domain: vm.netsoc.co
server_hostname: ipa.vm.netsoc.co
client_hostname: "{{ inventory_hostname }}"
client_ip_address: "{{ ansible_ens18.ipv4.address }}"
ds_password: "{{ freeipa_ds_password }}"
admin_password: "{{ freeipa_admin_password }}"
vars_files:
- "vars/freeipa.yml"
- "vars/secrets.yml"
- name: "Setup NFS keytab"
become: yes
hosts: nfs
tasks:
- shell: |
echo '{{ freeipa_admin_password }}' | kinit admin -l 0h1m
ipa service-del nfs/{{ inventory_hostname }} || True
ipa service-add nfs/{{ inventory_hostname }}
ipa-getkeytab -s ipa.vm.netsoc.co -p nfs/{{ inventory_hostname }} -k /tmp/nfs.keytab
chmod 700 /tmp/nfs.keytab
(echo rkt /tmp/nfs.keytab; echo wkt /etc/krb5.keytab) | ktutil
register: result
- debug:
msg: "{{result.stdout}}"
- debug:
msg: "{{result.stderr}}"
vars_files:
- "vars/freeipa.yml"
- "vars/secrets.yml"
- name: "Ensure data disk made"
hosts: nfs
become: yes
roles:
- role: simple-disk
vars:
device: "/dev/vdb"
partition_size: "100%"
fstype: "ext4"
mount_path: "/mnt/nfs-data-disk"
mount_opts: "rw"
- name: "Ensure nfs directories"
hosts: nfs
become: yes
tasks:
- file:
path: "/mnt/nfs-data-disk/{{ item }}"
state: directory
recurse: yes
with_items:
- "docker/"
- "docker/traefik/dynamic_config/"
- name: "Ensure server"
hosts: nfs
become: yes
roles:
- role: nfs-server-docker-krb5
vars:
hostname: "nfs.vm.netsoc.co"
krb5_keytab: "/etc/krb5.keytab"
krb5_conf: "/etc/krb5.conf"
nfs_mount: "/mnt/nfs-data-disk"
# /nfs/ is the root of nfs_disk
exports: |
/nfs {{ ip_allocation.infra }}(rw,sync,no_root_squash,sec=krb5p:krb5i:krb5:sys)
vars_files:
- vars/ip_allocation.yml