ansible/host: Fix indentation
[autocluster.git] / ansible / host / autocluster_setup_centos7.yml
1 ---
2 - name: Set up the host machine for autocluster
3   connection: local
4   hosts: localhost
5
6   tasks:
7   - name: install latest vagrant rpm
8     package:
9       name: https://releases.hashicorp.com/vagrant/2.2.5/vagrant_2.2.5_x86_64.rpm
10       state: present
11
12   - name: install vagrant plugins
13     command: vagrant plugin install {{item}}
14     with_items:
15     - vagrant-libvirt
16     - vagrant-proxyconf
17
18   - name: dependencies for virt_pool module
19     package:
20       name:
21       - libvirt-python
22       - python-lxml
23       state: present
24
25   - name: ensure autocluster storage pool exists
26     virt_pool:
27       name: autocluster
28       state: present
29       autostart: yes
30       xml: >
31         <pool type='dir'>
32           <name>autocluster</name>
33             <target>
34               <path>/virtual/autocluster</path>
35             </target>
36         </pool>
37
38   # It seems that you can't force the pool to be active above when creating it!
39   - name: ensure autocluster storage pool is active
40     virt_pool:
41       name: autocluster
42       state: active
43
44   - name: install NFS server
45     package:
46       name: nfs-utils
47       state: present
48
49   - name: enable/start NFS server
50     service:
51       name: "{{item}}"
52       enabled: yes
53       state: started
54     with_items:
55     - nfs
56     - nfslock
57
58   # This was tough to figure out...
59   - name: allow NFS through firewall
60     firewalld:
61       service: "{{item}}"
62       zone: public
63       state: enabled
64       permanent: yes
65       immediate: yes
66     with_items:
67     - mountd
68     - rpc-bind
69     - nfs3
70
71   # Need to add a restart or "exportfs -r"
72   - name: export /home via NFS
73     template:
74       # This can be parameterised later when there are host onfig variables
75       src:  home_exports.j2
76       dest: /etc/exports.d/autocluster-home.exports
77
78   - name: ensure an NTP server is installed
79     package:
80       name: chrony
81       state: present
82
83   - name: allow NTP through firewall
84     firewalld:
85       service: ntp
86       zone: public
87       state: enabled
88       permanent: yes
89       immediate: yes
90
91   - name: enable/start NTP server
92     service:
93       name: chronyd
94       enabled: yes
95       state: started
96
97   - name: ensure an HTTP server is installed
98     package:
99       name: httpd
100       state: present
101
102   - name: enable/start HTTP server
103     service:
104       name: httpd
105       enabled: yes
106       state: started
107
108   - name: allow HTTP through firewall
109     firewalld:
110       service: http
111       zone: public
112       state: enabled
113       permanent: yes
114       immediate: yes
115
116   - name: ensure HTTP link for mediasets directory
117     file:
118       src: /home/mediasets
119       path: /var/www/html/mediasets
120       state: link
121       force: yes
122
123   - name: ensure semanage command is available
124     package:
125       name: policycoreutils-python
126       state: present
127
128   - name: selinux setup for /home/mediasets
129     command: "{{item}}"
130     with_items:
131     - chcon -R -t httpd_user_content_t /home/mediasets
132     - semanage boolean -m -1 httpd_unified
133     - semanage boolean -m -1 httpd_enable_homedirs
134
135   - name: install Python dependencies for Ansible Jinja templating
136     package:
137       name: python-netaddr
138       state: present