25 | | |
26 | | === Playbook === |
27 | | |
28 | | {{{ |
29 | | - name: Set up machine |
30 | | hosts: all |
31 | | become: true |
32 | | become_method: sudo |
33 | | tasks: |
34 | | - name: install nfs-utils autofs |
35 | | yum: |
36 | | name: '{{ item }}' |
37 | | state: present |
38 | | with_items: |
39 | | - nfs-utils |
40 | | - autofs |
41 | | |
42 | | - name: test for line in /etc/idmapd.conf |
43 | | command: grep 'Domain = localadmin' /etc/idmapd.conf |
44 | | register: idmapd_check |
45 | | ignore_errors: true |
46 | | |
47 | | - name: add line in /etc/idmapd.conf |
48 | | lineinfile: |
49 | | dest: /etc/idmapd.conf |
50 | | line: 'Domain = localadmin' |
51 | | when: idmapd_check|failed |
52 | | |
53 | | - name: test for line in /etc/auto.master |
54 | | command: grep '/- /etc/auto.nfs4' /etc/auto.master |
55 | | register: auto_master_check |
56 | | ignore_errors: true |
57 | | |
58 | | - name: add line in /etc/auto.master |
59 | | blockinfile: |
60 | | dest: /etc/auto.master |
61 | | content: '/- /etc/auto.nfs4 |
62 | | +auto.master' |
63 | | when: auto_master_check|failed |
64 | | |
65 | | - name: check if /etc/auto.nfs4 is ready |
66 | | command: grep '^/vols/seal/oceano/gmeteo/DATA/ESGF/UNICAN-NODE' /etc/auto.nfs4 |
67 | | register: nfs4_check |
68 | | ignore_errors: true |
69 | | |
70 | | - name: add line in /etc/auto.nfs4 |
71 | | lineinfile: |
72 | | create: yes |
73 | | state: present |
74 | | dest: /etc/auto.nfs4 |
75 | | line: '/vols/seal/oceano/gmeteo/DATA/ESGF/UNICAN-NODE -fstype=nfs4 192.168.x.x:/oceano/gmeteo/DATA/ESGF/UNICAN-NODE' |
76 | | when: nfs4_check|failed |
77 | | |
78 | | - name: synchronize time |
79 | | shell: 'ntpdate -u hora.rediris.es' |
80 | | |
81 | | - name: create user esgfuser |
82 | | user: |
83 | | name: esgfuser |
84 | | shell: /bin/bash |
85 | | |
86 | | - name: allow ssh in private network |
87 | | iptables: |
88 | | table: filter |
89 | | chain: INPUT |
90 | | source: '192.168.202.0/24' |
91 | | protocol: tcp |
92 | | in_interface: eth1 |
93 | | destination_port: ssh |
94 | | jump: ACCEPT |
95 | | }}} |