|
4 | 4 | hosts: ubuntu |
5 | 5 | become: true |
6 | 6 | tasks: |
7 | | - # Docs: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/user_module.html |
8 | | - - name: "Create a user" |
9 | | - user: "name=fastcampus shell=/bin/bash" |
| 7 | + # Docs: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/user_module.html |
| 8 | + - name: "Create a user" |
| 9 | + user: "name=fastcampus shell=/bin/bash" |
10 | 10 |
|
11 | | - - name: "Hello World" |
12 | | - command: "echo 'Hello World!'" |
| 11 | + - name: "Hello World" |
| 12 | + command: "echo 'Hello World!'" |
13 | 13 |
|
14 | | - # Docs: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/lineinfile_module.html |
15 | | - - name: "Add DNS server to resolv.conf" |
16 | | - lineinfile: |
17 | | - path: /etc/resolv.conf |
18 | | - line: 'nameserver 8.8.8.8' |
| 14 | + # Docs: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/lineinfile_module.html |
| 15 | + - name: "Add DNS server to resolv.conf" |
| 16 | + lineinfile: |
| 17 | + path: /etc/resolv.conf |
| 18 | + line: 'nameserver 8.8.8.8' |
19 | 19 |
|
20 | | - # Docs: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/apt_module.html |
21 | | - - name: "Install Nginx" |
22 | | - apt: |
23 | | - name: nginx |
24 | | - state: present |
25 | | - update_cache: true |
| 20 | + # Docs: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/apt_module.html |
| 21 | + - name: "Install Nginx" |
| 22 | + apt: |
| 23 | + name: nginx |
| 24 | + state: present |
| 25 | + update_cache: true |
26 | 26 |
|
27 | | - # Docs: https://docs.ansible.com/ansible/latest/collections/ansible/posix/synchronize_module.html |
28 | | - - name: "Upload web directory" |
29 | | - synchronize: |
30 | | - src: files/html/ |
31 | | - dest: /var/www/html |
32 | | - archive: true |
33 | | - checksum: true |
34 | | - recursive: true |
35 | | - delete: true |
| 27 | + # Docs: https://docs.ansible.com/ansible/latest/collections/ansible/posix/synchronize_module.html |
| 28 | + - name: "Upload web directory" |
| 29 | + synchronize: |
| 30 | + src: files/html/ |
| 31 | + dest: /var/www/html |
| 32 | + archive: true |
| 33 | + checksum: true |
| 34 | + recursive: true |
| 35 | + delete: true |
36 | 36 |
|
37 | | - # Docs: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/copy_module.html |
38 | | - - name: "Copy nginx configuration file" |
39 | | - copy: |
40 | | - src: files/default |
41 | | - dest: /etc/nginx/sites-enabled/default |
42 | | - owner: "{{ ansible_user }}" |
43 | | - group: "{{ ansible_user }}" |
44 | | - mode: '0644' |
| 37 | + # Docs: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/copy_module.html |
| 38 | + - name: "Copy nginx configuration file" |
| 39 | + copy: |
| 40 | + src: files/default |
| 41 | + dest: /etc/nginx/sites-enabled/default |
| 42 | + owner: "{{ ansible_user }}" |
| 43 | + group: "{{ ansible_user }}" |
| 44 | + mode: '0644' |
45 | 45 |
|
46 | | - # Docs: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/service_module.html |
47 | | - - name: "Ensure nginx service started" |
48 | | - service: |
49 | | - name: nginx |
50 | | - state: started |
| 46 | + # Docs: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/service_module.html |
| 47 | + - name: "Ensure nginx service started" |
| 48 | + service: |
| 49 | + name: nginx |
| 50 | + state: started |
0 commit comments