-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathplaybook.yml
47 lines (42 loc) · 1.09 KB
/
playbook.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
- hosts: all
gather_facts: true
ignore_unreachable: true
vars_files:
- vars/default.yml
tasks:
- name: Install Apache packages
become: true
ansible.builtin.yum:
name: httpd
state: present
- name: Create document root
become: true
ansible.builtin.file:
state: directory
dest: "{{ doc_root }}"
mode: 0701
- name: Create configuration file
become: true
ansible.builtin.template:
src: spacelift.conf.j2
dest: /etc/httpd/conf.d/spacelift.conf
mode: 0644
notify: Restart server
- name: Copy web pages
become: true
ansible.builtin.template:
src: index.html.j2
dest: "{{ doc_root }}/index.html"
- name: Ensure httpd is running
become: true
ansible.builtin.service:
name: httpd
state: started
ignore_errors: "{{ ansible_check_mode }}"
handlers:
- name: Restart server
become: true
ansible.builtin.service:
name: httpd
state: restarted
ignore_errors: "{{ ansible_check_mode }}"